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

Method getBucketAndItsStatus

tx.go:813–832  ·  view source on GitHub ↗

getBucketAndItsStatus, get bucket and it is status in pendingBucketList, if bucket is already in bucket manager but not in pendingList, will return BucketStatusExistAlready.

(ds core.Ds, name core.BucketName)

Source from the content-addressed store, hash-verified

811// getBucketAndItsStatus, get bucket and it is status in pendingBucketList,
812// if bucket is already in bucket manager but not in pendingList, will return BucketStatusExistAlready.
813func (tx *Tx) getBucketAndItsStatus(ds core.Ds, name core.BucketName) (BucketStatus, *core.Bucket) {
814 if len(tx.pendingBucketList) > 0 {
815 if bucketInDs, exist := tx.pendingBucketList[ds]; exist {
816 if bucket, exist := bucketInDs[name]; exist {
817 switch bucket.Meta.Op {
818 case core.BucketInsertOperation:
819 return BucketStatusNew, bucket
820 case core.BucketDeleteOperation:
821 return BucketStatusDeleted, bucket
822 case core.BucketUpdateOperation:
823 return BucketStatusUpdated, bucket
824 }
825 }
826 }
827 }
828 if bucket, err := tx.db.bucketMgr.GetBucket(ds, name); err == nil {
829 return BucketStatusExistAlready, bucket
830 }
831 return BucketStatusUnknown, nil
832}
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) {

Callers 8

putMethod · 0.95
PutIfNotExistsMethod · 0.95
getMethod · 0.95
getMaxOrMinKeyMethod · 0.95
HasMethod · 0.95
RangeScanEntriesMethod · 0.95
tryGetMethod · 0.95
GetTTLMethod · 0.95

Calls 1

GetBucketMethod · 0.80

Tested by

no test coverage detected