[#1555] local_object_storage: Rename method GetLocked -> GetLocks

Renamed to better reflect the method's purpose of returning locks
for the specified object.

Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
Aleksey Savchuk 2024-12-11 14:43:36 +03:00
parent e9837bbcf9
commit 72470d6b48
Signed by: a-savchuk
GPG key ID: 70C0A7FF6F9C4639
4 changed files with 15 additions and 15 deletions

View file

@ -176,7 +176,7 @@ func objectLocked(tx *bbolt.Tx, idCnr cid.ID, idObj oid.ID) bool {
}
// return `LOCK` id's if specified object is locked in the specified container.
func getLocked(tx *bbolt.Tx, idCnr cid.ID, idObj oid.ID) ([]oid.ID, error) {
func getLocks(tx *bbolt.Tx, idCnr cid.ID, idObj oid.ID) ([]oid.ID, error) {
var lockers []oid.ID
bucketLocked := tx.Bucket(bucketNameLocked)
if bucketLocked != nil {
@ -351,20 +351,20 @@ func (db *DB) IsLocked(ctx context.Context, prm IsLockedPrm) (res IsLockedRes, e
return res, err
}
// GetLocked return `LOCK` id's if provided object is locked by any `LOCK`. Not found
// GetLocks return `LOCK` id's if provided object is locked by any `LOCK`. Not found
// object is considered as non-locked.
//
// Returns only non-logical errors related to underlying database.
func (db *DB) GetLocked(ctx context.Context, addr oid.Address) (res []oid.ID, err error) {
func (db *DB) GetLocks(ctx context.Context, addr oid.Address) (res []oid.ID, err error) {
var (
startedAt = time.Now()
success = false
)
defer func() {
db.metrics.AddMethodDuration("GetLocked", time.Since(startedAt), success)
db.metrics.AddMethodDuration("GetLocks", time.Since(startedAt), success)
}()
_, span := tracing.StartSpanFromContext(ctx, "metabase.GetLocked",
_, span := tracing.StartSpanFromContext(ctx, "metabase.GetLocks",
trace.WithAttributes(
attribute.String("address", addr.EncodeToString()),
))
@ -377,7 +377,7 @@ func (db *DB) GetLocked(ctx context.Context, addr oid.Address) (res []oid.ID, er
return res, ErrDegradedMode
}
err = metaerr.Wrap(db.boltDB.View(func(tx *bbolt.Tx) error {
res, err = getLocked(tx, addr.Container(), addr.Object())
res, err = getLocks(tx, addr.Container(), addr.Object())
return nil
}))
success = err == nil