Do not pass Block structs around only pointers.

This commit is contained in:
Sascha L. Teichmann 2014-08-20 15:34:20 +02:00
parent 02ada38090
commit 8f4a558234
3 changed files with 4 additions and 5 deletions

View File

@ -19,14 +19,13 @@ type (
}
BlocKProducer interface {
// Returns next block.
// error is NoMoreBlocksErr if it run out of blocks.
Next() (Block, error)
Next(*Block) error
Close() error
}
BlockConsumer interface {
Consume(Block) error
Consume(*Block) error
Close() error
}
)

View File

@ -44,7 +44,7 @@ func (ldbc *LevelDBBlockConsumer) Close() error {
return nil
}
func (ldbc *LevelDBBlockConsumer) Consume(block Block) (err error) {
func (ldbc *LevelDBBlockConsumer) Consume(block *Block) (err error) {
var encodedKey []byte
if encodedKey, err = ldbc.encoder(ldbc.joiner(block.Coord)); err != nil {
return

View File

@ -49,7 +49,7 @@ func NewSQLiteBlockProducer(path string, splitter common.KeySplitter) (sbp *SQLi
return
}
func (sbp *SQLiteBlockProducer) Next() (block Block, err error) {
func (sbp *SQLiteBlockProducer) Next(block *Block) (err error) {
if sbp.rows == nil {
err = NoMoreBlocksErr
return