forked from TrueCloudLab/frostfs-node
[#1131] *: Adopt SDK changes
`object.Address` has been moved to `object/address` `object.ID` has been moved to `object/id` Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
1c821d6c36
commit
1667ec9e6d
139 changed files with 652 additions and 562 deletions
|
@ -3,20 +3,20 @@ package meta
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
|
||||
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
|
||||
"go.etcd.io/bbolt"
|
||||
)
|
||||
|
||||
// ToMoveItPrm groups the parameters of ToMoveIt operation.
|
||||
type ToMoveItPrm struct {
|
||||
addr *objectSDK.Address
|
||||
addr *addressSDK.Address
|
||||
}
|
||||
|
||||
// ToMoveItRes groups resulting values of ToMoveIt operation.
|
||||
type ToMoveItRes struct{}
|
||||
|
||||
// WithAddress sets address of the object to move into another shard.
|
||||
func (p *ToMoveItPrm) WithAddress(addr *objectSDK.Address) *ToMoveItPrm {
|
||||
func (p *ToMoveItPrm) WithAddress(addr *addressSDK.Address) *ToMoveItPrm {
|
||||
if p != nil {
|
||||
p.addr = addr
|
||||
}
|
||||
|
@ -26,14 +26,14 @@ func (p *ToMoveItPrm) WithAddress(addr *objectSDK.Address) *ToMoveItPrm {
|
|||
|
||||
// DoNotMovePrm groups the parameters of DoNotMove operation.
|
||||
type DoNotMovePrm struct {
|
||||
addr *objectSDK.Address
|
||||
addr *addressSDK.Address
|
||||
}
|
||||
|
||||
// DoNotMoveRes groups resulting values of DoNotMove operation.
|
||||
type DoNotMoveRes struct{}
|
||||
|
||||
// WithAddress sets address of the object to prevent moving into another shard.
|
||||
func (p *DoNotMovePrm) WithAddress(addr *objectSDK.Address) *DoNotMovePrm {
|
||||
func (p *DoNotMovePrm) WithAddress(addr *addressSDK.Address) *DoNotMovePrm {
|
||||
if p != nil {
|
||||
p.addr = addr
|
||||
}
|
||||
|
@ -46,16 +46,16 @@ type MovablePrm struct{}
|
|||
|
||||
// MovableRes groups resulting values of Movable operation.
|
||||
type MovableRes struct {
|
||||
addrList []*objectSDK.Address
|
||||
addrList []*addressSDK.Address
|
||||
}
|
||||
|
||||
// AddressList returns resulting addresses of Movable operation.
|
||||
func (p *MovableRes) AddressList() []*objectSDK.Address {
|
||||
func (p *MovableRes) AddressList() []*addressSDK.Address {
|
||||
return p.addrList
|
||||
}
|
||||
|
||||
// ToMoveIt marks object to move it into another shard.
|
||||
func ToMoveIt(db *DB, addr *objectSDK.Address) error {
|
||||
func ToMoveIt(db *DB, addr *addressSDK.Address) error {
|
||||
_, err := db.ToMoveIt(new(ToMoveItPrm).WithAddress(addr))
|
||||
return err
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ func (db *DB) ToMoveIt(prm *ToMoveItPrm) (res *ToMoveItRes, err error) {
|
|||
}
|
||||
|
||||
// DoNotMove prevents the object to be moved into another shard.
|
||||
func DoNotMove(db *DB, addr *objectSDK.Address) error {
|
||||
func DoNotMove(db *DB, addr *addressSDK.Address) error {
|
||||
_, err := db.DoNotMove(new(DoNotMovePrm).WithAddress(addr))
|
||||
return err
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ func (db *DB) DoNotMove(prm *DoNotMovePrm) (res *DoNotMoveRes, err error) {
|
|||
}
|
||||
|
||||
// Movable returns all movable objects of DB.
|
||||
func Movable(db *DB) ([]*objectSDK.Address, error) {
|
||||
func Movable(db *DB) ([]*addressSDK.Address, error) {
|
||||
r, err := db.Movable(new(MovablePrm))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -128,7 +128,7 @@ func (db *DB) Movable(prm *MovablePrm) (*MovableRes, error) {
|
|||
// we can parse strings to structures in-place, but probably it seems
|
||||
// more efficient to keep bolt db TX code smaller because it might be
|
||||
// bottleneck.
|
||||
addrs := make([]*objectSDK.Address, 0, len(strAddrs))
|
||||
addrs := make([]*addressSDK.Address, 0, len(strAddrs))
|
||||
|
||||
for i := range strAddrs {
|
||||
addr, err := addressFromKey([]byte(strAddrs[i]))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue