mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-11-08 11:10:27 +01:00
39 lines
894 B
Go
39 lines
894 B
Go
// Copyright 2014 by Sascha L. Teichmann
|
|
// Use of this source code is governed by the MIT license
|
|
// that can be found in the LICENSE file.
|
|
|
|
package main
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"bitbucket.org/s_l_teichmann/mtredisalize/common"
|
|
)
|
|
|
|
// 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 common.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
|
|
}
|
|
)
|