[#1175] metabase: Add container bucket for LOCKs

Create class of container buckets with `LOCKED` suffix. Put identifiers
of the objects of type `LOCK` to these buckets during `DB.Put`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-02-15 12:53:35 +03:00 committed by LeL
parent e90ac9c6f9
commit 14d27455f3
2 changed files with 15 additions and 0 deletions

View file

@ -0,0 +1,13 @@
package meta
import (
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
)
// suffix for container buckets with locked objects.
const bucketNameSuffixLocked = invalidBase58String + "LOCKED"
// returns name of the bucket with locked objects for specified container.
func bucketNameLocked(idCnr cid.ID) []byte {
return []byte(idCnr.String() + bucketNameSuffixLocked)
}

View file

@ -198,6 +198,8 @@ func uniqueIndexes(obj *objectSDK.Object, si *objectSDK.SplitInfo, id *blobovnic
bucketName = tombstoneBucketName(addr.ContainerID()) bucketName = tombstoneBucketName(addr.ContainerID())
case objectSDK.TypeStorageGroup: case objectSDK.TypeStorageGroup:
bucketName = storageGroupBucketName(addr.ContainerID()) bucketName = storageGroupBucketName(addr.ContainerID())
case objectSDK.TypeLock:
bucketName = bucketNameLocked(*addr.ContainerID())
default: default:
return nil, ErrUnknownObjectType return nil, ErrUnknownObjectType
} }