forked from TrueCloudLab/frostfs-s3-gw
[#669] Optimize PutLockInfo
Signed-off-by: Alex Vanin <a.vanin@yadro.com>
This commit is contained in:
parent
e06f6f1c2a
commit
5ffe28a42f
2 changed files with 14 additions and 6 deletions
|
@ -23,16 +23,23 @@ type PutLockInfoParams struct {
|
|||
ObjVersion *ObjectVersion
|
||||
NewLock *data.ObjectLock
|
||||
CopiesNumber uint32
|
||||
NodeVersion *data.NodeVersion // optional
|
||||
}
|
||||
|
||||
func (n *layer) PutLockInfo(ctx context.Context, p *PutLockInfoParams) error {
|
||||
func (n *layer) PutLockInfo(ctx context.Context, p *PutLockInfoParams) (err error) {
|
||||
var (
|
||||
cnrID = p.ObjVersion.BktInfo.CID
|
||||
newLock = p.NewLock
|
||||
)
|
||||
versionNode, err := n.getNodeVersion(ctx, p.ObjVersion)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
versionNode := p.NodeVersion
|
||||
// sometimes node version can be provided from executing context
|
||||
// if value is not provided, make a tree service call
|
||||
if versionNode == nil {
|
||||
versionNode, err = n.getNodeVersion(ctx, p.ObjVersion)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
lockInfo, err := n.treeService.GetLock(ctx, cnrID, versionNode.ID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue