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)
| 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. |
| 813 | func (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 |
| 835 | func (tx *Tx) findEntryAndItsStatus(_ core.Ds, bucket core.BucketName, key string) (EntryStatus, *core.Entry) { |
no test coverage detected