From 8f4a5582347154ce078d1a93172f9f7884f608cd Mon Sep 17 00:00:00 2001 From: "Sascha L. Teichmann" Date: Wed, 20 Aug 2014 15:34:20 +0200 Subject: [PATCH] Do not pass Block structs around only pointers. --- interleaver/interfaces.go | 5 ++--- interleaver/leveldb.go | 2 +- interleaver/sqlite.go | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/interleaver/interfaces.go b/interleaver/interfaces.go index 0535e38..bc4c404 100644 --- a/interleaver/interfaces.go +++ b/interleaver/interfaces.go @@ -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 } ) diff --git a/interleaver/leveldb.go b/interleaver/leveldb.go index fae0ac0..4941697 100644 --- a/interleaver/leveldb.go +++ b/interleaver/leveldb.go @@ -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 diff --git a/interleaver/sqlite.go b/interleaver/sqlite.go index 6ed5f5e..6ca4f1a 100644 --- a/interleaver/sqlite.go +++ b/interleaver/sqlite.go @@ -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