findEntryStatus finds the latest status for the certain Entry in Tx
(_ core.Ds, bucket core.BucketName, key string)
| 833 | |
| 834 | // findEntryStatus finds the latest status for the certain Entry in Tx |
| 835 | func (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 |