MCPcopy
hub / github.com/canopy-network/canopy / NewIterator

Method NewIterator

store/txn.go:267–275  ·  view source on GitHub ↗

NewIterator() creates a merged iterator with the reader and writer

(prefix []byte, reverse bool, seek bool)

Source from the content-addressed store, hash-verified

265
266// NewIterator() creates a merged iterator with the reader and writer
267func (t *Txn) NewIterator(prefix []byte, reverse bool, seek bool) (lib.IteratorI, lib.ErrorI) {
268 // create an iterator for the parent
269 parentIterator, err := t.reader.NewIterator(lib.Append(t.prefix, prefix), reverse, seek)
270 if err != nil {
271 return nil, err
272 }
273 // create a merged iterator for the parent and in-memory txn
274 return newTxnIterator(parentIterator, t.txn, prefix, t.prefix, reverse), nil
275}
276
277// Copy creates a new Txn with the same configuration and txn as the original
278func (t *Txn) Copy(reader TxnReaderI, writer TxnWriterI) *Txn {

Callers 1

Calls 3

AppendFunction · 0.92
newTxnIteratorFunction · 0.85
NewIteratorMethod · 0.65

Tested by 1