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 {
|
err := bktGraveyard.ForEach(func(k, v []byte) error {
|
||||||
if _, ok := tss[string(v)]; ok {
|
if _, ok := tss[string(v)]; ok {
|
||||||
addr := object.NewAddress()
|
addr, err := addressFromKey(k)
|
||||||
|
|
||||||
err := addr.Parse(string(k))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "could not parse address of the object under tombstone")
|
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))
|
addrs := make([]*objectSDK.Address, 0, len(strAddrs))
|
||||||
|
|
||||||
for i := range strAddrs {
|
for i := range strAddrs {
|
||||||
addr := objectSDK.NewAddress()
|
addr, err := addressFromKey([]byte(strAddrs[i]))
|
||||||
|
|
||||||
err = addr.Parse(strAddrs[i])
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("can't parse object address %v: %w",
|
return nil, fmt.Errorf("can't parse object address %v: %w",
|
||||||
strAddrs[i], err)
|
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
|
continue // ignore objects with unmatched fast filters
|
||||||
}
|
}
|
||||||
|
|
||||||
addr := object.NewAddress()
|
addr, err := addressFromKey([]byte(a))
|
||||||
if err := addr.Parse(a); err != nil {
|
if err != nil {
|
||||||
// TODO: storage was broken, so we need to handle it
|
// TODO: storage was broken, so we need to handle it
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -435,9 +435,7 @@ func (db *DB) selectObjectID(
|
||||||
appendOID := func(oid string) {
|
appendOID := func(oid string) {
|
||||||
addrStr := prefix + string(oid)
|
addrStr := prefix + string(oid)
|
||||||
|
|
||||||
addr := object.NewAddress()
|
addr, err := addressFromKey([]byte(addrStr))
|
||||||
|
|
||||||
err := addr.Parse(addrStr)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
db.log.Debug("can't decode object id address",
|
db.log.Debug("can't decode object id address",
|
||||||
zap.String("addr", addrStr),
|
zap.String("addr", addrStr),
|
||||||
|
|
Loading…
Reference in a new issue