MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / findEntryAndItsStatus

Method findEntryAndItsStatus

tx.go:835–856  ·  view source on GitHub ↗

findEntryStatus finds the latest status for the certain Entry in Tx

(_ core.Ds, bucket core.BucketName, key string)

Source from the content-addressed store, hash-verified

833
834// findEntryStatus finds the latest status for the certain Entry in Tx
835func (tx *Tx) findEntryAndItsStatus(_ core.Ds, bucket core.BucketName, key string) (EntryStatus, *core.Entry) {
836 if tx.pendingWrites.size == 0 {
837 return NotFoundEntry, nil
838 }
839 pendingWriteEntries := tx.pendingWrites.entriesInBTree
840 if pendingWriteEntries == nil {
841 return NotFoundEntry, nil
842 }
843 if pendingWriteEntries[bucket] == nil {
844 return NotFoundEntry, nil
845 }
846 entries := pendingWriteEntries[bucket]
847 if entry, exist := entries[key]; exist {
848 switch entry.Meta.Flag {
849 case DataDeleteFlag:
850 return EntryDeleted, nil
851 default:
852 return EntryUpdated, entry
853 }
854 }
855 return NotFoundEntry, nil
856}
857
858/*
859 * send updated entries to watch manager for monitoring

Callers 3

getMethod · 0.95
HasMethod · 0.95
DeleteMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected