forked from TrueCloudLab/frostfs-node
[#378] shard/gc: Reuse addressFromKey func in all appropriate places
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
72f7df3339
commit
a6d5556dc1
3 changed files with 5 additions and 11 deletions
|
@ -131,9 +131,7 @@ func (db *DB) iterateCoveredByTombstones(tx *bbolt.Tx, tss map[string]struct{},
|
|||
|
||||
err := bktGraveyard.ForEach(func(k, v []byte) error {
|
||||
if _, ok := tss[string(v)]; ok {
|
||||
addr := object.NewAddress()
|
||||
|
||||
err := addr.Parse(string(k))
|
||||
addr, err := addressFromKey(k)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not parse address of the object under tombstone")
|
||||
}
|
||||
|
|
|
@ -131,9 +131,7 @@ func (db *DB) Movable(prm *MovablePrm) (*MovableRes, error) {
|
|||
addrs := make([]*objectSDK.Address, 0, len(strAddrs))
|
||||
|
||||
for i := range strAddrs {
|
||||
addr := objectSDK.NewAddress()
|
||||
|
||||
err = addr.Parse(strAddrs[i])
|
||||
addr, err := addressFromKey([]byte(strAddrs[i]))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("can't parse object address %v: %w",
|
||||
strAddrs[i], err)
|
||||
|
|
|
@ -128,8 +128,8 @@ func (db *DB) selectObjects(tx *bbolt.Tx, cid *container.ID, fs object.SearchFil
|
|||
continue // ignore objects with unmatched fast filters
|
||||
}
|
||||
|
||||
addr := object.NewAddress()
|
||||
if err := addr.Parse(a); err != nil {
|
||||
addr, err := addressFromKey([]byte(a))
|
||||
if err != nil {
|
||||
// TODO: storage was broken, so we need to handle it
|
||||
return nil, err
|
||||
}
|
||||
|
@ -435,9 +435,7 @@ func (db *DB) selectObjectID(
|
|||
appendOID := func(oid string) {
|
||||
addrStr := prefix + string(oid)
|
||||
|
||||
addr := object.NewAddress()
|
||||
|
||||
err := addr.Parse(addrStr)
|
||||
addr, err := addressFromKey([]byte(addrStr))
|
||||
if err != nil {
|
||||
db.log.Debug("can't decode object id address",
|
||||
zap.String("addr", addrStr),
|
||||
|
|
Loading…
Reference in a new issue