package reqbuilder import ( "strconv" clitypes "gitlink.org.cn/cloudream/jcs-pub/client/types" "gitlink.org.cn/cloudream/jcs-pub/common/pkgs/distlock/lockprovider" "gitlink.org.cn/cloudream/jcs-pub/common/pkgs/distlock/types" ) type ShardStoreLockReqBuilder struct { *LockRequestBuilder } func (b *LockRequestBuilder) Shard() *ShardStoreLockReqBuilder { return &ShardStoreLockReqBuilder{LockRequestBuilder: b} } func (b *ShardStoreLockReqBuilder) Buzy(spaceID clitypes.UserSpaceID) *ShardStoreLockReqBuilder { b.locks = append(b.locks, types.Lock{ Path: b.makePath(spaceID), Name: lockprovider.ShardStoreBuzyLock, Target: lockprovider.NewEmptyTarget(), }) return b } func (b *ShardStoreLockReqBuilder) GC(spaceID clitypes.UserSpaceID) *ShardStoreLockReqBuilder { b.locks = append(b.locks, types.Lock{ Path: b.makePath(spaceID), Name: lockprovider.ShardStoreGCLock, Target: lockprovider.NewEmptyTarget(), }) return b } func (b *ShardStoreLockReqBuilder) makePath(hubID clitypes.UserSpaceID) []string { return []string{lockprovider.ShardStoreLockPathPrefix, strconv.FormatInt(int64(hubID), 10)} }