@@ -10,18 +10,13 @@ import (
1010
1111 "github.com/onflow/flow-go/module/irrecoverable"
1212 "github.com/onflow/flow-go/storage"
13+ "github.com/onflow/flow-go/utils/noop"
1314)
1415
1516type dbReader struct {
1617 db * badger.DB
1718}
1819
19- type noopCloser struct {}
20-
21- var _ io.Closer = (* noopCloser )(nil )
22-
23- func (noopCloser ) Close () error { return nil }
24-
2520// Get gets the value for the given key. It returns ErrNotFound if the DB
2621// does not contain the key.
2722// other errors are exceptions
@@ -37,17 +32,17 @@ func (b dbReader) Get(key []byte) ([]byte, io.Closer, error) {
3732 item , err := tx .Get (key )
3833 if err != nil {
3934 if errors .Is (err , badger .ErrKeyNotFound ) {
40- return nil , noopCloser {}, storage .ErrNotFound
35+ return nil , noop. Closer {}, storage .ErrNotFound
4136 }
42- return nil , noopCloser {}, irrecoverable .NewExceptionf ("could not load data: %w" , err )
37+ return nil , noop. Closer {}, irrecoverable .NewExceptionf ("could not load data: %w" , err )
4338 }
4439
4540 value , err := item .ValueCopy (nil )
4641 if err != nil {
47- return nil , noopCloser {}, irrecoverable .NewExceptionf ("could not load value: %w" , err )
42+ return nil , noop. Closer {}, irrecoverable .NewExceptionf ("could not load value: %w" , err )
4843 }
4944
50- return value , noopCloser {}, nil
45+ return value , noop. Closer {}, nil
5146}
5247
5348// NewIter returns a new Iterator for the given key prefix range [startPrefix, endPrefix], both inclusive.
0 commit comments