MCPcopy Create free account
hub / github.com/couchbase/moss / Current

Method Current

iterator.go:375–398  ·  view source on GitHub ↗

Current returns ErrIteratorDone if the iterator is done. Otherwise, Current() returns the current key and val, which should be treated as immutable or read-only. The key and val bytes will remain available until the next call to Next() or Close().

()

Source from the content-addressed store, hash-verified

373// be treated as immutable or read-only. The key and val bytes will
374// remain available until the next call to Next() or Close().
375func (iter *iterator) Current() ([]byte, []byte, error) {
376 entryEx, key, val, err := iter.CurrentEx()
377 if err != nil {
378 return nil, nil, err
379 }
380
381 op := entryEx.Operation
382 if op == OperationDel {
383 return nil, nil, nil
384 }
385
386 if op == OperationMerge {
387 var valMerged []byte
388 valMerged, err = iter.ss.getMerged(key, val, iter.cursors[0].ssIndex-1,
389 iter.iteratorOptions.base, ReadOptions{})
390 if err != nil {
391 return nil, nil, err
392 }
393
394 return key, valMerged, nil
395 }
396
397 return key, val, err
398}
399
400// CurrentEx is a more advanced form of Current() that returns more
401// metadata. It is used when IteratorOptions.IncludeDeletions is

Callers 1

SeekToMethod · 0.95

Calls 2

CurrentExMethod · 0.95
getMergedMethod · 0.80

Tested by

no test coverage detected