2014-08-19 11:14:14 +02:00
|
|
|
// 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
|
|
|
|
|
2014-08-19 12:07:57 +02:00
|
|
|
import (
|
2014-08-19 12:27:42 +02:00
|
|
|
"errors"
|
2014-08-19 12:23:33 +02:00
|
|
|
|
|
|
|
"bitbucket.org/s_l_teichmann/mtredisalize/common"
|
2014-08-19 12:07:57 +02:00
|
|
|
)
|
|
|
|
|
2014-08-19 12:27:42 +02:00
|
|
|
var NoMoreBlocksErr = errors.New("No more blocks.")
|
2014-08-19 11:14:14 +02:00
|
|
|
|
|
|
|
type (
|
|
|
|
Block struct {
|
|
|
|
Coord common.Coord
|
|
|
|
Data []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
BlocKProducer interface {
|
2014-08-19 12:23:33 +02:00
|
|
|
// Returns next block.
|
|
|
|
// error is NoMoreBlocksErr if it run out of blocks.
|
2014-08-19 11:14:14 +02:00
|
|
|
Next() (Block, error)
|
|
|
|
Close() error
|
|
|
|
}
|
|
|
|
|
|
|
|
BlockConsumer interface {
|
2014-08-20 15:26:31 +02:00
|
|
|
Consume(Block) error
|
2014-08-19 11:14:14 +02:00
|
|
|
Close() error
|
|
|
|
}
|
|
|
|
)
|