mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-07-03 08:30:45 +02:00
Moved all the block producer/consumer interfaces to common.
This commit is contained in:
@ -1,7 +1,31 @@
|
||||
package common
|
||||
|
||||
// Block data from Minetest database.
|
||||
type Block struct {
|
||||
Coord Coord
|
||||
Data []byte
|
||||
}
|
||||
import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
// Error returned if a Producer has run to its end.
|
||||
var ErrNoMoreBlocks = errors.New("No more blocks.")
|
||||
|
||||
type (
|
||||
// Block data from Minetest database.
|
||||
Block struct {
|
||||
Coord Coord
|
||||
Data []byte
|
||||
}
|
||||
// BlockProducer is used to over a existing Minetest database
|
||||
// and return its content block by block.
|
||||
BlockProducer interface {
|
||||
// error is ErrNoMoreBlocks if it run out of blocks.
|
||||
Next(*Block) error
|
||||
// Closes the open database connections.
|
||||
Close() error
|
||||
}
|
||||
|
||||
// BlockConsumer is used to store blocks in a new Minetest database.
|
||||
BlockConsumer interface {
|
||||
Consume(*Block) error
|
||||
// Closes the open database connections.
|
||||
Close() error
|
||||
}
|
||||
)
|
||||
|
Reference in New Issue
Block a user