[#437] Rename getCORSAddress

This function is going to be reused
for lifecycles as well.

Signed-off-by: Alex Vanin <a.vanin@yadro.com>
This commit is contained in:
Alexey Vanin 2024-07-25 16:06:38 +03:00 committed by Alexey Vanin
parent f5326b9f04
commit c34680d157

View file

@ -504,7 +504,7 @@ func (c *Tree) GetBucketCORS(ctx context.Context, bktInfo *data.BucketInfo) (oid
return oid.Address{}, err return oid.Address{}, err
} }
return getCORSAddress(node.Latest()) return getTreeNodeAddress(node.Latest())
} }
func (c *Tree) PutBucketCORS(ctx context.Context, bktInfo *data.BucketInfo, addr oid.Address) ([]oid.Address, error) { func (c *Tree) PutBucketCORS(ctx context.Context, bktInfo *data.BucketInfo, addr oid.Address) ([]oid.Address, error) {
@ -537,7 +537,7 @@ func (c *Tree) PutBucketCORS(ctx context.Context, bktInfo *data.BucketInfo, addr
} }
objToDelete := make([]oid.Address, 1, len(multiNode.nodes)) objToDelete := make([]oid.Address, 1, len(multiNode.nodes))
objToDelete[0], err = getCORSAddress(latest) objToDelete[0], err = getTreeNodeAddress(latest)
if err != nil { if err != nil {
return nil, fmt.Errorf("parse object addr of latest cors node in tree: %w", err) return nil, fmt.Errorf("parse object addr of latest cors node in tree: %w", err)
} }
@ -566,7 +566,7 @@ func (c *Tree) DeleteBucketCORS(ctx context.Context, bktInfo *data.BucketInfo) (
return objToDelete, nil return objToDelete, nil
} }
func getCORSAddress(node *treeNode) (oid.Address, error) { func getTreeNodeAddress(node *treeNode) (oid.Address, error) {
var addr oid.Address var addr oid.Address
addr.SetObject(node.ObjID) addr.SetObject(node.ObjID)
@ -592,7 +592,7 @@ func (c *Tree) cleanOldNodes(ctx context.Context, nodes []*treeNode, bktInfo *da
if err := c.service.RemoveNode(ctx, bktInfo, systemTree, node.ID[ind]); err != nil { if err := c.service.RemoveNode(ctx, bktInfo, systemTree, node.ID[ind]); err != nil {
c.reqLogger(ctx).Warn(logs.FailedToRemoveOldSystemNode, zap.String("FileName", node.Meta[FileNameKey]), zap.Uint64("id", node.ID[ind])) c.reqLogger(ctx).Warn(logs.FailedToRemoveOldSystemNode, zap.String("FileName", node.Meta[FileNameKey]), zap.Uint64("id", node.ID[ind]))
} else { } else {
addr, err := getCORSAddress(node) addr, err := getTreeNodeAddress(node)
if err != nil { if err != nil {
c.log.Warn(logs.FailedToParseAddressInTreeNode, zap.String("FileName", node.Meta[FileNameKey]), zap.Uint64("id", node.ID[ind])) c.log.Warn(logs.FailedToParseAddressInTreeNode, zap.String("FileName", node.Meta[FileNameKey]), zap.Uint64("id", node.ID[ind]))
continue continue