[#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:
Pavel Karpy 2022-01-26 15:11:13 +03:00 committed by Alex Vanin
parent 1c821d6c36
commit 1667ec9e6d
139 changed files with 650 additions and 560 deletions

View file

@ -11,6 +11,8 @@ import (
"github.com/nspcc-dev/neofs-sdk-go/eacl" "github.com/nspcc-dev/neofs-sdk-go/eacl"
"github.com/nspcc-dev/neofs-sdk-go/netmap" "github.com/nspcc-dev/neofs-sdk-go/netmap"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/nspcc-dev/neofs-sdk-go/version" "github.com/nspcc-dev/neofs-sdk-go/version"
) )
@ -305,7 +307,7 @@ type PutObjectRes struct {
} }
// ID returns identifier of the created object. // ID returns identifier of the created object.
func (x PutObjectRes) ID() *object.ID { func (x PutObjectRes) ID() *oidSDK.ID {
return x.cliRes.ID() return x.cliRes.ID()
} }
@ -338,7 +340,7 @@ type DeleteObjectRes struct {
} }
// TombstoneAddress returns address of the created object with tombstone. // TombstoneAddress returns address of the created object with tombstone.
func (x DeleteObjectRes) TombstoneAddress() *object.Address { func (x DeleteObjectRes) TombstoneAddress() *addressSDK.Address {
return x.cliRes.TombstoneAddress() return x.cliRes.TombstoneAddress()
} }
@ -464,7 +466,7 @@ type SearchObjectsRes struct {
} }
// IDList returns identifiers of the matched objects. // IDList returns identifiers of the matched objects.
func (x SearchObjectsRes) IDList() []*object.ID { func (x SearchObjectsRes) IDList() []*oidSDK.ID {
return x.cliRes.IDList() return x.cliRes.IDList()
} }

View file

@ -5,7 +5,7 @@ import (
"github.com/nspcc-dev/neofs-sdk-go/client" "github.com/nspcc-dev/neofs-sdk-go/client"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"github.com/nspcc-dev/neofs-sdk-go/session" "github.com/nspcc-dev/neofs-sdk-go/session"
"github.com/nspcc-dev/neofs-sdk-go/token" "github.com/nspcc-dev/neofs-sdk-go/token"
) )
@ -49,10 +49,10 @@ func (x *bearerTokenPrm) SetBearerToken(tok *token.BearerToken) {
} }
type objectAddressPrm struct { type objectAddressPrm struct {
objAddr *object.Address objAddr *addressSDK.Address
} }
func (x *objectAddressPrm) SetAddress(addr *object.Address) { func (x *objectAddressPrm) SetAddress(addr *addressSDK.Address) {
x.objAddr = addr x.objAddr = addr
} }

View file

@ -11,7 +11,7 @@ import (
ircontrolsrv "github.com/nspcc-dev/neofs-node/pkg/services/control/ir/server" ircontrolsrv "github.com/nspcc-dev/neofs-node/pkg/services/control/ir/server"
controlSvc "github.com/nspcc-dev/neofs-node/pkg/services/control/server" controlSvc "github.com/nspcc-dev/neofs-node/pkg/services/control/server"
"github.com/nspcc-dev/neofs-sdk-go/client" "github.com/nspcc-dev/neofs-sdk-go/client"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"github.com/nspcc-dev/neofs-sdk-go/util/signature" "github.com/nspcc-dev/neofs-sdk-go/util/signature"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
@ -325,7 +325,7 @@ var dropObjectsCmd = &cobra.Command{
binAddrList := make([][]byte, 0, len(dropObjectsList)) binAddrList := make([][]byte, 0, len(dropObjectsList))
for i := range dropObjectsList { for i := range dropObjectsList {
a := object.NewAddress() a := addressSDK.NewAddress()
err := a.Parse(dropObjectsList[i]) err := a.Parse(dropObjectsList[i])
if err != nil { if err != nil {

View file

@ -17,6 +17,8 @@ import (
"github.com/nspcc-dev/neofs-sdk-go/checksum" "github.com/nspcc-dev/neofs-sdk-go/checksum"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/nspcc-dev/neofs-sdk-go/owner" "github.com/nspcc-dev/neofs-sdk-go/owner"
"github.com/nspcc-dev/neofs-sdk-go/session" "github.com/nspcc-dev/neofs-sdk-go/session"
"github.com/nspcc-dev/neofs-sdk-go/token" "github.com/nspcc-dev/neofs-sdk-go/token"
@ -669,7 +671,7 @@ func parseSearchFilters(cmd *cobra.Command) (object.SearchFilters, error) {
oid, _ := cmd.Flags().GetString(searchOIDFlag) oid, _ := cmd.Flags().GetString(searchOIDFlag)
if oid != "" { if oid != "" {
id := object.NewID() id := oidSDK.NewID()
if err := id.Parse(oid); err != nil { if err := id.Parse(oid); err != nil {
return nil, fmt.Errorf("could not parse object ID: %w", err) return nil, fmt.Errorf("could not parse object ID: %w", err)
} }
@ -731,8 +733,8 @@ func getCID(cmd *cobra.Command) (*cid.ID, error) {
return id, nil return id, nil
} }
func getOID(cmd *cobra.Command) (*object.ID, error) { func getOID(cmd *cobra.Command) (*oidSDK.ID, error) {
oid := object.NewID() oid := oidSDK.NewID()
err := oid.Parse(cmd.Flag("oid").Value.String()) err := oid.Parse(cmd.Flag("oid").Value.String())
if err != nil { if err != nil {
@ -742,7 +744,7 @@ func getOID(cmd *cobra.Command) (*object.ID, error) {
return oid, nil return oid, nil
} }
func getObjectAddress(cmd *cobra.Command) (*object.Address, error) { func getObjectAddress(cmd *cobra.Command) (*addressSDK.Address, error) {
cid, err := getCID(cmd) cid, err := getCID(cmd)
if err != nil { if err != nil {
return nil, err return nil, err
@ -752,7 +754,7 @@ func getObjectAddress(cmd *cobra.Command) (*object.Address, error) {
return nil, err return nil, err
} }
objAddr := object.NewAddress() objAddr := addressSDK.NewAddress()
objAddr.SetContainerID(cid) objAddr.SetContainerID(cid)
objAddr.SetObjectID(oid) objAddr.SetObjectID(oid)
return objAddr, nil return objAddr, nil

View file

@ -9,6 +9,8 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
"github.com/nspcc-dev/neofs-node/pkg/services/object_manager/storagegroup" "github.com/nspcc-dev/neofs-node/pkg/services/object_manager/storagegroup"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
storagegroupAPI "github.com/nspcc-dev/neofs-sdk-go/storagegroup" storagegroupAPI "github.com/nspcc-dev/neofs-sdk-go/storagegroup"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -136,7 +138,7 @@ type sgHeadReceiver struct {
prm internalclient.HeadObjectPrm prm internalclient.HeadObjectPrm
} }
func (c sgHeadReceiver) Head(addr *objectSDK.Address) (interface{}, error) { func (c sgHeadReceiver) Head(addr *addressSDK.Address) (interface{}, error) {
c.prm.SetAddress(addr) c.prm.SetAddress(addr)
res, err := internalclient.HeadObject(c.prm) res, err := internalclient.HeadObject(c.prm)
@ -163,10 +165,10 @@ func putSG(cmd *cobra.Command, _ []string) {
cid, err := getCID(cmd) cid, err := getCID(cmd)
exitOnErr(cmd, err) exitOnErr(cmd, err)
members := make([]*objectSDK.ID, 0, len(sgMembers)) members := make([]*oidSDK.ID, 0, len(sgMembers))
for i := range sgMembers { for i := range sgMembers {
id := objectSDK.NewID() id := oidSDK.NewID()
err = id.Parse(sgMembers[i]) err = id.Parse(sgMembers[i])
exitOnErr(cmd, errf("could not parse object ID: %w", err)) exitOnErr(cmd, errf("could not parse object ID: %w", err))
@ -207,8 +209,8 @@ func putSG(cmd *cobra.Command, _ []string) {
cmd.Printf(" ID: %s\n CID: %s\n", res.ID(), cid) cmd.Printf(" ID: %s\n CID: %s\n", res.ID(), cid)
} }
func getSGID() (*objectSDK.ID, error) { func getSGID() (*oidSDK.ID, error) {
oid := objectSDK.NewID() oid := oidSDK.NewID()
err := oid.Parse(sgID) err := oid.Parse(sgID)
if err != nil { if err != nil {
return nil, fmt.Errorf("could not parse storage group ID: %w", err) return nil, fmt.Errorf("could not parse storage group ID: %w", err)
@ -224,7 +226,7 @@ func getSG(cmd *cobra.Command, _ []string) {
id, err := getSGID() id, err := getSGID()
exitOnErr(cmd, err) exitOnErr(cmd, err)
addr := objectSDK.NewAddress() addr := addressSDK.NewAddress()
addr.SetContainerID(cid) addr.SetContainerID(cid)
addr.SetObjectID(id) addr.SetObjectID(id)
@ -288,7 +290,7 @@ func delSG(cmd *cobra.Command, _ []string) {
id, err := getSGID() id, err := getSGID()
exitOnErr(cmd, err) exitOnErr(cmd, err)
addr := objectSDK.NewAddress() addr := addressSDK.NewAddress()
addr.SetContainerID(cid) addr.SetContainerID(cid)
addr.SetObjectID(id) addr.SetObjectID(id)

View file

@ -8,6 +8,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/writecache" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/writecache"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -54,7 +55,7 @@ func init() {
} }
func objectInspectCmd(cmd *cobra.Command, _ []string) { func objectInspectCmd(cmd *cobra.Command, _ []string) {
addr := object.NewAddress() addr := addressSDK.NewAddress()
err := addr.Parse(vAddress) err := addr.Parse(vAddress)
common.ExitOnErr(cmd, common.Errf("invalid address argument: %w", err)) common.ExitOnErr(cmd, common.Errf("invalid address argument: %w", err))

View file

@ -6,7 +6,7 @@ import (
common "github.com/nspcc-dev/neofs-node/cmd/neofs-lens/internal" common "github.com/nspcc-dev/neofs-node/cmd/neofs-lens/internal"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/writecache" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/writecache"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -40,7 +40,7 @@ var Command = &cobra.Command{
// other targets can be supported // other targets can be supported
w := cmd.OutOrStderr() w := cmd.OutOrStderr()
wAddr := func(addr *object.Address) error { wAddr := func(addr *addressSDK.Address) error {
_, err := io.WriteString(w, addr.String()+"\n") _, err := io.WriteString(w, addr.String()+"\n")
return err return err
} }

View file

@ -8,7 +8,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
"github.com/nspcc-dev/neofs-node/pkg/services/control" "github.com/nspcc-dev/neofs-node/pkg/services/control"
controlSvc "github.com/nspcc-dev/neofs-node/pkg/services/control/server" controlSvc "github.com/nspcc-dev/neofs-node/pkg/services/control/server"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"google.golang.org/grpc" "google.golang.org/grpc"
) )
@ -33,7 +33,7 @@ func initControlService(c *cfg) {
controlSvc.WithHealthChecker(c), controlSvc.WithHealthChecker(c),
controlSvc.WithNetMapSource(c.cfgNetmap.wrapper), controlSvc.WithNetMapSource(c.cfgNetmap.wrapper),
controlSvc.WithNodeState(c), controlSvc.WithNodeState(c),
controlSvc.WithDeletedObjectHandler(func(addrList []*object.Address) error { controlSvc.WithDeletedObjectHandler(func(addrList []*addressSDK.Address) error {
prm := new(engine.DeletePrm).WithAddresses(addrList...) prm := new(engine.DeletePrm).WithAddresses(addrList...)
_, err := c.cfgObject.cfgLocalStorage.localStorage.Delete(prm) _, err := c.cfgObject.cfgLocalStorage.localStorage.Delete(prm)

View file

@ -38,7 +38,7 @@ import (
"github.com/nspcc-dev/neofs-sdk-go/client" "github.com/nspcc-dev/neofs-sdk-go/client"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
eaclSDK "github.com/nspcc-dev/neofs-sdk-go/eacl" eaclSDK "github.com/nspcc-dev/neofs-sdk-go/eacl"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"github.com/nspcc-dev/neofs-sdk-go/owner" "github.com/nspcc-dev/neofs-sdk-go/owner"
"github.com/nspcc-dev/neofs-sdk-go/util/signature" "github.com/nspcc-dev/neofs-sdk-go/util/signature"
"go.uber.org/zap" "go.uber.org/zap"
@ -99,7 +99,7 @@ type localObjectInhumer struct {
log *logger.Logger log *logger.Logger
} }
func (r *localObjectInhumer) DeleteObjects(ts *objectSDK.Address, addr ...*objectSDK.Address) { func (r *localObjectInhumer) DeleteObjects(ts *addressSDK.Address, addr ...*addressSDK.Address) {
prm := new(engine.InhumePrm) prm := new(engine.InhumePrm)
for _, a := range addr { for _, a := range addr {
@ -238,7 +238,7 @@ func initObjectService(c *cfg) {
policerconfig.HeadTimeout(c.appCfg), policerconfig.HeadTimeout(c.appCfg),
), ),
policer.WithReplicator(repl), policer.WithReplicator(repl),
policer.WithRedundantCopyCallback(func(addr *objectSDK.Address) { policer.WithRedundantCopyCallback(func(addr *addressSDK.Address) {
_, err := ls.Inhume(new(engine.InhumePrm).MarkAsGarbage(addr)) _, err := ls.Inhume(new(engine.InhumePrm).MarkAsGarbage(addr))
if err != nil { if err != nil {
c.log.Warn("could not inhume mark redundant copy as garbage", c.log.Warn("could not inhume mark redundant copy as garbage",

2
go.mod
View file

@ -14,7 +14,7 @@ require (
github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/hrw v1.0.9
github.com/nspcc-dev/neo-go v0.98.0 github.com/nspcc-dev/neo-go v0.98.0
github.com/nspcc-dev/neofs-api-go/v2 v2.11.2-0.20220127135316-32dd0bb3f9c5 github.com/nspcc-dev/neofs-api-go/v2 v2.11.2-0.20220127135316-32dd0bb3f9c5
github.com/nspcc-dev/neofs-sdk-go v0.0.0-20220201140258-9414f42aa349 github.com/nspcc-dev/neofs-sdk-go v0.0.0-20220201141054-6a7ba33b59ef
github.com/nspcc-dev/tzhash v1.5.1 github.com/nspcc-dev/tzhash v1.5.1
github.com/panjf2000/ants/v2 v2.4.0 github.com/panjf2000/ants/v2 v2.4.0
github.com/paulmach/orb v0.2.2 github.com/paulmach/orb v0.2.2

BIN
go.sum

Binary file not shown.

View file

@ -12,6 +12,7 @@ import (
objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object" objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object"
"github.com/nspcc-dev/neofs-node/pkg/core/netmap" "github.com/nspcc-dev/neofs-node/pkg/core/netmap"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"github.com/nspcc-dev/neofs-sdk-go/owner" "github.com/nspcc-dev/neofs-sdk-go/owner"
"github.com/nspcc-dev/neofs-sdk-go/storagegroup" "github.com/nspcc-dev/neofs-sdk-go/storagegroup"
) )
@ -32,7 +33,7 @@ type cfg struct {
// DeleteHandler is an interface of delete queue processor. // DeleteHandler is an interface of delete queue processor.
type DeleteHandler interface { type DeleteHandler interface {
DeleteObjects(*object.Address, ...*object.Address) DeleteObjects(*addressSDK.Address, ...*addressSDK.Address)
} }
var errNilObject = errors.New("object is nil") var errNilObject = errors.New("object is nil")
@ -158,14 +159,14 @@ func (v *FormatValidator) ValidateContent(o *Object) error {
// mark all objects from tombstone body as removed in storage engine // mark all objects from tombstone body as removed in storage engine
cid := o.ContainerID() cid := o.ContainerID()
idList := tombstone.Members() idList := tombstone.Members()
addrList := make([]*object.Address, 0, len(idList)) addrList := make([]*addressSDK.Address, 0, len(idList))
for _, id := range idList { for _, id := range idList {
if id == nil { if id == nil {
return fmt.Errorf("(%T) empty member in tombstone", v) return fmt.Errorf("(%T) empty member in tombstone", v)
} }
a := object.NewAddress() a := addressSDK.NewAddress()
a.SetContainerID(cid) a.SetContainerID(cid)
a.SetObjectID(id) a.SetObjectID(id)

View file

@ -12,6 +12,7 @@ import (
objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object" objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object"
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test" cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/nspcc-dev/neofs-sdk-go/owner" "github.com/nspcc-dev/neofs-sdk-go/owner"
sessiontest "github.com/nspcc-dev/neofs-sdk-go/session/test" sessiontest "github.com/nspcc-dev/neofs-sdk-go/session/test"
"github.com/nspcc-dev/neofs-sdk-go/storagegroup" "github.com/nspcc-dev/neofs-sdk-go/storagegroup"
@ -27,8 +28,8 @@ func testSHA(t *testing.T) [sha256.Size]byte {
return cs return cs
} }
func testObjectID(t *testing.T) *object.ID { func testObjectID(t *testing.T) *oidSDK.ID {
id := object.NewID() id := oidSDK.NewID()
id.SetSHA256(testSHA(t)) id.SetSHA256(testSHA(t))
return id return id
@ -118,7 +119,7 @@ func TestFormatValidator_Validate(t *testing.T) {
require.Error(t, v.ValidateContent(obj.Object())) // no tombstone content require.Error(t, v.ValidateContent(obj.Object())) // no tombstone content
content := object.NewTombstone() content := object.NewTombstone()
content.SetMembers([]*object.ID{nil}) content.SetMembers([]*oidSDK.ID{nil})
data, err := content.Marshal() data, err := content.Marshal()
require.NoError(t, err) require.NoError(t, err)
@ -127,7 +128,7 @@ func TestFormatValidator_Validate(t *testing.T) {
require.Error(t, v.ValidateContent(obj.Object())) // no members in tombstone require.Error(t, v.ValidateContent(obj.Object())) // no members in tombstone
content.SetMembers([]*object.ID{testObjectID(t)}) content.SetMembers([]*oidSDK.ID{testObjectID(t)})
data, err = content.Marshal() data, err = content.Marshal()
require.NoError(t, err) require.NoError(t, err)
@ -160,7 +161,7 @@ func TestFormatValidator_Validate(t *testing.T) {
require.Error(t, v.ValidateContent(obj.Object())) require.Error(t, v.ValidateContent(obj.Object()))
content := storagegroup.New() content := storagegroup.New()
content.SetMembers([]*object.ID{nil}) content.SetMembers([]*oidSDK.ID{nil})
data, err := content.Marshal() data, err := content.Marshal()
require.NoError(t, err) require.NoError(t, err)
@ -169,7 +170,7 @@ func TestFormatValidator_Validate(t *testing.T) {
require.Error(t, v.ValidateContent(obj.Object())) require.Error(t, v.ValidateContent(obj.Object()))
content.SetMembers([]*object.ID{testObjectID(t)}) content.SetMembers([]*oidSDK.ID{testObjectID(t)})
data, err = content.Marshal() data, err = content.Marshal()
require.NoError(t, err) require.NoError(t, err)

View file

@ -4,6 +4,7 @@ import (
objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object" objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object"
"github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/nspcc-dev/neofs-api-go/v2/refs"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
// Object represents the NeoFS object. // Object represents the NeoFS object.
@ -16,13 +17,13 @@ type Object struct {
} }
// Address returns address of the object. // Address returns address of the object.
func (o *Object) Address() *object.Address { func (o *Object) Address() *addressSDK.Address {
if o != nil { if o != nil {
aV2 := new(refs.Address) aV2 := new(refs.Address)
aV2.SetObjectID(o.ID().ToV2()) aV2.SetObjectID(o.ID().ToV2())
aV2.SetContainerID(o.ContainerID().ToV2()) aV2.SetContainerID(o.ContainerID().ToV2())
return object.NewAddressFromV2(aV2) return addressSDK.NewAddressFromV2(aV2)
} }
return nil return nil

View file

@ -11,6 +11,8 @@ import (
apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status" apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
) )
// Client represents NeoFS API client cut down to the needs of a purely IR application. // Client represents NeoFS API client cut down to the needs of a purely IR application.
@ -48,7 +50,7 @@ type SearchSGRes struct {
} }
// IDList returns list of IDs of storage groups in container. // IDList returns list of IDs of storage groups in container.
func (x SearchSGRes) IDList() []*object.ID { func (x SearchSGRes) IDList() []*oid.ID {
return x.cliRes.IDList() return x.cliRes.IDList()
} }
@ -163,7 +165,7 @@ func (x Client) HeadObject(prm HeadObjectPrm) (res HeadObjectRes, err error) {
// GetObjectPayload reads object by address from NeoFS via Client and returns its payload. // GetObjectPayload reads object by address from NeoFS via Client and returns its payload.
// //
// Returns any error prevented the operation from completing correctly in error return. // Returns any error prevented the operation from completing correctly in error return.
func GetObjectPayload(ctx context.Context, c Client, addr *object.Address) ([]byte, error) { func GetObjectPayload(ctx context.Context, c Client, addr *addressSDK.Address) ([]byte, error) {
var prm GetObjectPrm var prm GetObjectPrm
prm.SetContext(ctx) prm.SetContext(ctx)
@ -177,7 +179,7 @@ func GetObjectPayload(ctx context.Context, c Client, addr *object.Address) ([]by
return obj.Object().Payload(), nil return obj.Object().Payload(), nil
} }
func headObject(ctx context.Context, c Client, addr *object.Address, raw bool, ttl uint32) (*object.Object, error) { func headObject(ctx context.Context, c Client, addr *addressSDK.Address, raw bool, ttl uint32) (*object.Object, error) {
var prm HeadObjectPrm var prm HeadObjectPrm
prm.SetContext(ctx) prm.SetContext(ctx)
@ -197,13 +199,13 @@ func headObject(ctx context.Context, c Client, addr *object.Address, raw bool, t
} }
// GetRawObjectHeaderLocally reads raw short object header from server's local storage by address via Client. // GetRawObjectHeaderLocally reads raw short object header from server's local storage by address via Client.
func GetRawObjectHeaderLocally(ctx context.Context, c Client, addr *object.Address) (*object.Object, error) { func GetRawObjectHeaderLocally(ctx context.Context, c Client, addr *addressSDK.Address) (*object.Object, error) {
return headObject(ctx, c, addr, true, 1) return headObject(ctx, c, addr, true, 1)
} }
// GetObjectHeaderFromContainer reads short object header by address via Client with TTL = 10 // GetObjectHeaderFromContainer reads short object header by address via Client with TTL = 10
// for deep traversal of the container. // for deep traversal of the container.
func GetObjectHeaderFromContainer(ctx context.Context, c Client, addr *object.Address) (*object.Object, error) { func GetObjectHeaderFromContainer(ctx context.Context, c Client, addr *addressSDK.Address) (*object.Object, error) {
return headObject(ctx, c, addr, false, 10) return headObject(ctx, c, addr, false, 10)
} }
@ -265,7 +267,7 @@ func (x Client) HashPayloadRange(prm HashPayloadRangePrm) (res HashPayloadRangeR
// from the remote server's local storage via Client. // from the remote server's local storage via Client.
// //
// Returns any error prevented the operation from completing correctly in error return. // Returns any error prevented the operation from completing correctly in error return.
func HashObjectRange(ctx context.Context, c Client, addr *object.Address, rng *object.Range) ([]byte, error) { func HashObjectRange(ctx context.Context, c Client, addr *addressSDK.Address, rng *object.Range) ([]byte, error) {
var prm HashPayloadRangePrm var prm HashPayloadRangePrm
prm.SetContext(ctx) prm.SetContext(ctx)

View file

@ -3,7 +3,7 @@ package neofsapiclient
import ( import (
"context" "context"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
type contextPrm struct { type contextPrm struct {
@ -16,11 +16,11 @@ func (x *contextPrm) SetContext(ctx context.Context) {
} }
type objectAddressPrm struct { type objectAddressPrm struct {
objAddr *object.Address objAddr *addressSDK.Address
} }
// SetAddress sets address of the object. // SetAddress sets address of the object.
func (x *objectAddressPrm) SetAddress(addr *object.Address) { func (x *objectAddressPrm) SetAddress(addr *addressSDK.Address) {
x.objAddr = addr x.objAddr = addr
} }

View file

@ -10,7 +10,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/util/rand" "github.com/nspcc-dev/neofs-node/pkg/util/rand"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/netmap" "github.com/nspcc-dev/neofs-sdk-go/netmap"
"github.com/nspcc-dev/neofs-sdk-go/object" oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -107,8 +107,8 @@ func (ap *Processor) processStartAudit(epoch uint64) {
} }
} }
func (ap *Processor) findStorageGroups(cid *cid.ID, shuffled netmap.Nodes) []*object.ID { func (ap *Processor) findStorageGroups(cid *cid.ID, shuffled netmap.Nodes) []*oidSDK.ID {
var sg []*object.ID var sg []*oidSDK.ID
ln := len(shuffled) ln := len(shuffled)

View file

@ -13,7 +13,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/morph/event" "github.com/nspcc-dev/neofs-node/pkg/morph/event"
"github.com/nspcc-dev/neofs-node/pkg/services/audit" "github.com/nspcc-dev/neofs-node/pkg/services/audit"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/object" oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/panjf2000/ants/v2" "github.com/panjf2000/ants/v2"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -89,11 +89,11 @@ func (x SearchSGPrm) NodeInfo() client.NodeInfo {
// SearchSGDst groups target values which Processor expects from SG searching to process. // SearchSGDst groups target values which Processor expects from SG searching to process.
type SearchSGDst struct { type SearchSGDst struct {
ids []*object.ID ids []*oidSDK.ID
} }
// WriteIDList writes list of identifiers of storage group objects stored in the container. // WriteIDList writes list of identifiers of storage group objects stored in the container.
func (x *SearchSGDst) WriteIDList(ids []*object.ID) { func (x *SearchSGDst) WriteIDList(ids []*oidSDK.ID) {
x.ids = ids x.ids = ids
} }

View file

@ -12,7 +12,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/util/logger" "github.com/nspcc-dev/neofs-node/pkg/util/logger"
"github.com/nspcc-dev/neofs-sdk-go/audit" "github.com/nspcc-dev/neofs-sdk-go/audit"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"github.com/nspcc-dev/neofs-sdk-go/owner" "github.com/nspcc-dev/neofs-sdk-go/owner"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -213,7 +213,7 @@ func (c *Calculator) sumSGSizes(ctx *singleResultCtx) bool {
sumPassSGSize := uint64(0) sumPassSGSize := uint64(0)
addr := object.NewAddress() addr := addressSDK.NewAddress()
addr.SetContainerID(ctx.containerID()) addr.SetContainerID(ctx.containerID())
for _, sgID := range ctx.auditResult.PassSG() { for _, sgID := range ctx.auditResult.PassSG() {

View file

@ -3,7 +3,7 @@ package audit
import ( import (
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/settlement/common" "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/settlement/common"
"github.com/nspcc-dev/neofs-sdk-go/audit" "github.com/nspcc-dev/neofs-sdk-go/audit"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
// CalculatorPrm groups the parameters of Calculator's constructor. // CalculatorPrm groups the parameters of Calculator's constructor.
@ -39,7 +39,7 @@ type SGInfo interface {
// SGStorage is an interface of storage of the storage groups. // SGStorage is an interface of storage of the storage groups.
type SGStorage interface { type SGStorage interface {
// Must return information about the storage group by address. // Must return information about the storage group by address.
SGInfo(*object.Address) (SGInfo, error) SGInfo(*addressSDK.Address) (SGInfo, error)
} }
// FeeFetcher wraps AuditFee method that returns audit fee price from // FeeFetcher wraps AuditFee method that returns audit fee price from

View file

@ -16,6 +16,8 @@ import (
"github.com/nspcc-dev/neofs-sdk-go/client" "github.com/nspcc-dev/neofs-sdk-go/client"
"github.com/nspcc-dev/neofs-sdk-go/netmap" "github.com/nspcc-dev/neofs-sdk-go/netmap"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/nspcc-dev/neofs-sdk-go/storagegroup" "github.com/nspcc-dev/neofs-sdk-go/storagegroup"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -59,15 +61,15 @@ func (c *ClientCache) Get(info clientcore.NodeInfo) (clientcore.Client, error) {
// GetSG polls the container from audit task to get the object by id. // GetSG polls the container from audit task to get the object by id.
// Returns storage groups structure from received object. // Returns storage groups structure from received object.
func (c *ClientCache) GetSG(task *audit.Task, id *object.ID) (*storagegroup.StorageGroup, error) { func (c *ClientCache) GetSG(task *audit.Task, id *oidSDK.ID) (*storagegroup.StorageGroup, error) {
sgAddress := new(object.Address) sgAddress := new(addressSDK.Address)
sgAddress.SetContainerID(task.ContainerID()) sgAddress.SetContainerID(task.ContainerID())
sgAddress.SetObjectID(id) sgAddress.SetObjectID(id)
return c.getSG(task.AuditContext(), sgAddress, task.NetworkMap(), task.ContainerNodes()) return c.getSG(task.AuditContext(), sgAddress, task.NetworkMap(), task.ContainerNodes())
} }
func (c *ClientCache) getSG(ctx context.Context, addr *object.Address, nm *netmap.Netmap, cn netmap.ContainerNodes) (*storagegroup.StorageGroup, error) { func (c *ClientCache) getSG(ctx context.Context, addr *addressSDK.Address, nm *netmap.Netmap, cn netmap.ContainerNodes) (*storagegroup.StorageGroup, error) {
nodes, err := placement.BuildObjectPlacement(nm, cn, addr.ObjectID()) nodes, err := placement.BuildObjectPlacement(nm, cn, addr.ObjectID())
if err != nil { if err != nil {
return nil, fmt.Errorf("can't build object placement: %w", err) return nil, fmt.Errorf("can't build object placement: %w", err)
@ -121,8 +123,8 @@ func (c *ClientCache) getSG(ctx context.Context, addr *object.Address, nm *netma
} }
// GetHeader requests node from the container under audit to return object header by id. // GetHeader requests node from the container under audit to return object header by id.
func (c *ClientCache) GetHeader(task *audit.Task, node *netmap.Node, id *object.ID, relay bool) (*object.Object, error) { func (c *ClientCache) GetHeader(task *audit.Task, node *netmap.Node, id *oidSDK.ID, relay bool) (*object.Object, error) {
objAddress := new(object.Address) objAddress := new(addressSDK.Address)
objAddress.SetContainerID(task.ContainerID()) objAddress.SetContainerID(task.ContainerID())
objAddress.SetObjectID(id) objAddress.SetObjectID(id)
@ -160,8 +162,8 @@ func (c *ClientCache) GetHeader(task *audit.Task, node *netmap.Node, id *object.
// GetRangeHash requests node from the container under audit to return Tillich-Zemor hash of the // GetRangeHash requests node from the container under audit to return Tillich-Zemor hash of the
// payload range of the object with specified identifier. // payload range of the object with specified identifier.
func (c *ClientCache) GetRangeHash(task *audit.Task, node *netmap.Node, id *object.ID, rng *object.Range) ([]byte, error) { func (c *ClientCache) GetRangeHash(task *audit.Task, node *netmap.Node, id *oidSDK.ID, rng *object.Range) ([]byte, error) {
objAddress := new(object.Address) objAddress := new(addressSDK.Address)
objAddress.SetContainerID(task.ContainerID()) objAddress.SetContainerID(task.ContainerID())
objAddress.SetObjectID(id) objAddress.SetObjectID(id)

View file

@ -22,7 +22,7 @@ import (
containerAPI "github.com/nspcc-dev/neofs-sdk-go/container" containerAPI "github.com/nspcc-dev/neofs-sdk-go/container"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
netmapAPI "github.com/nspcc-dev/neofs-sdk-go/netmap" netmapAPI "github.com/nspcc-dev/neofs-sdk-go/netmap"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"github.com/nspcc-dev/neofs-sdk-go/owner" "github.com/nspcc-dev/neofs-sdk-go/owner"
"github.com/nspcc-dev/neofs-sdk-go/storagegroup" "github.com/nspcc-dev/neofs-sdk-go/storagegroup"
"go.uber.org/zap" "go.uber.org/zap"
@ -167,7 +167,7 @@ func (s settlementDeps) ContainerNodes(e uint64, cid *cid.ID) ([]common.NodeInfo
return res, nil return res, nil
} }
func (s settlementDeps) SGInfo(addr *object.Address) (audit.SGInfo, error) { func (s settlementDeps) SGInfo(addr *addressSDK.Address) (audit.SGInfo, error) {
cn, nm, err := s.buildContainer(0, addr.ContainerID()) cn, nm, err := s.buildContainer(0, addr.ContainerID())
if err != nil { if err != nil {
return nil, err return nil, err

View file

@ -11,8 +11,9 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
"github.com/nspcc-dev/neofs-node/pkg/util/logger/test" "github.com/nspcc-dev/neofs-node/pkg/util/logger/test"
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test" cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
objecttest "github.com/nspcc-dev/neofs-sdk-go/object/test" objecttest "github.com/nspcc-dev/neofs-sdk-go/object/address/test"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -22,18 +23,18 @@ func testSHA256() (h [sha256.Size]byte) {
return h return h
} }
func testAddress() *objectSDK.Address { func testAddress() *addressSDK.Address {
oid := objectSDK.NewID() oid := oidSDK.NewID()
oid.SetSHA256(testSHA256()) oid.SetSHA256(testSHA256())
addr := objectSDK.NewAddress() addr := addressSDK.NewAddress()
addr.SetObjectID(oid) addr.SetObjectID(oid)
addr.SetContainerID(cidtest.ID()) addr.SetContainerID(cidtest.ID())
return addr return addr
} }
func testPutGet(t *testing.T, blz *Blobovnicza, sz uint64, expPut, expGet error) *objectSDK.Address { func testPutGet(t *testing.T, blz *Blobovnicza, sz uint64, expPut, expGet error) *addressSDK.Address {
// create binary object // create binary object
data := make([]byte, sz) data := make([]byte, sz)
@ -55,7 +56,7 @@ func testPutGet(t *testing.T, blz *Blobovnicza, sz uint64, expPut, expGet error)
return addr return addr
} }
func testGet(t *testing.T, blz *Blobovnicza, addr *objectSDK.Address, expObj []byte, expErr error) { func testGet(t *testing.T, blz *Blobovnicza, addr *addressSDK.Address, expObj []byte, expErr error) {
pGet := new(GetPrm) pGet := new(GetPrm)
pGet.SetAddress(addr) pGet.SetAddress(addr)

View file

@ -2,14 +2,14 @@ package blobovnicza
import ( import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
"go.uber.org/zap" "go.uber.org/zap"
) )
// DeletePrm groups the parameters of Delete operation. // DeletePrm groups the parameters of Delete operation.
type DeletePrm struct { type DeletePrm struct {
addr *objectSDK.Address addr *addressSDK.Address
} }
// DeleteRes groups resulting values of Delete operation. // DeleteRes groups resulting values of Delete operation.
@ -17,7 +17,7 @@ type DeleteRes struct {
} }
// SetAddress sets address of the requested object. // SetAddress sets address of the requested object.
func (p *DeletePrm) SetAddress(addr *objectSDK.Address) { func (p *DeletePrm) SetAddress(addr *addressSDK.Address) {
p.addr = addr p.addr = addr
} }

View file

@ -2,14 +2,14 @@ package blobovnicza
import ( import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
"go.uber.org/zap" "go.uber.org/zap"
) )
// GetPrm groups the parameters of Get operation. // GetPrm groups the parameters of Get operation.
type GetPrm struct { type GetPrm struct {
addr *objectSDK.Address addr *addressSDK.Address
} }
// GetRes groups resulting values of Get operation. // GetRes groups resulting values of Get operation.
@ -18,7 +18,7 @@ type GetRes struct {
} }
// SetAddress sets address of the requested object. // SetAddress sets address of the requested object.
func (p *GetPrm) SetAddress(addr *objectSDK.Address) { func (p *GetPrm) SetAddress(addr *addressSDK.Address) {
p.addr = addr p.addr = addr
} }

View file

@ -5,11 +5,12 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
// GetRangePrm groups the parameters of GetRange operation. // GetRangePrm groups the parameters of GetRange operation.
type GetRangePrm struct { type GetRangePrm struct {
addr *objectSDK.Address addr *addressSDK.Address
rng *objectSDK.Range rng *objectSDK.Range
} }
@ -20,7 +21,7 @@ type GetRangeRes struct {
} }
// SetAddress sets address of the requested object. // SetAddress sets address of the requested object.
func (p *GetRangePrm) SetAddress(addr *objectSDK.Address) { func (p *GetRangePrm) SetAddress(addr *addressSDK.Address) {
p.addr = addr p.addr = addr
} }

View file

@ -3,7 +3,7 @@ package blobovnicza
import ( import (
"fmt" "fmt"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )
@ -57,7 +57,7 @@ func max(a, b uint64) uint64 {
// IterationElement represents a unit of elements through which Iterate operation passes. // IterationElement represents a unit of elements through which Iterate operation passes.
type IterationElement struct { type IterationElement struct {
addr *object.Address addr *addressSDK.Address
data []byte data []byte
} }
@ -68,7 +68,7 @@ func (x IterationElement) ObjectData() []byte {
} }
// Address returns address of the stored object. // Address returns address of the stored object.
func (x IterationElement) Address() *object.Address { func (x IterationElement) Address() *addressSDK.Address {
return x.addr return x.addr
} }
@ -125,7 +125,7 @@ func (b *Blobovnicza) Iterate(prm IteratePrm) (*IterateRes, error) {
return buck.ForEach(func(k, v []byte) error { return buck.ForEach(func(k, v []byte) error {
if prm.decodeAddresses { if prm.decodeAddresses {
if elem.addr == nil { if elem.addr == nil {
elem.addr = object.NewAddress() elem.addr = addressSDK.NewAddress()
} }
if err := addressFromKey(elem.addr, k); err != nil { if err := addressFromKey(elem.addr, k); err != nil {
@ -164,7 +164,7 @@ func IterateObjects(blz *Blobovnicza, f func([]byte) error) error {
} }
// IterateAddresses is a helper function which iterates over Blobovnicza and passes addresses of the objects to f. // IterateAddresses is a helper function which iterates over Blobovnicza and passes addresses of the objects to f.
func IterateAddresses(blz *Blobovnicza, f func(*object.Address) error) error { func IterateAddresses(blz *Blobovnicza, f func(*addressSDK.Address) error) error {
var prm IteratePrm var prm IteratePrm
prm.DecodeAddresses() prm.DecodeAddresses()

View file

@ -6,7 +6,7 @@ import (
"testing" "testing"
"github.com/nspcc-dev/neo-go/pkg/util/slice" "github.com/nspcc-dev/neo-go/pkg/util/slice"
objecttest "github.com/nspcc-dev/neofs-sdk-go/object/test" objecttest "github.com/nspcc-dev/neofs-sdk-go/object/address/test"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )

View file

@ -4,13 +4,13 @@ import (
"errors" "errors"
"fmt" "fmt"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )
// PutPrm groups the parameters of Put operation. // PutPrm groups the parameters of Put operation.
type PutPrm struct { type PutPrm struct {
addr *objectSDK.Address addr *addressSDK.Address
objData []byte objData []byte
} }
@ -26,7 +26,7 @@ var ErrFull = errors.New("blobovnicza is full")
var errNilAddress = errors.New("object address is nil") var errNilAddress = errors.New("object address is nil")
// SetAddress sets address of saving object. // SetAddress sets address of saving object.
func (p *PutPrm) SetAddress(addr *objectSDK.Address) { func (p *PutPrm) SetAddress(addr *addressSDK.Address) {
p.addr = addr p.addr = addr
} }
@ -86,10 +86,10 @@ func (b *Blobovnicza) Put(prm *PutPrm) (*PutRes, error) {
return nil, err return nil, err
} }
func addressKey(addr *objectSDK.Address) []byte { func addressKey(addr *addressSDK.Address) []byte {
return []byte(addr.String()) return []byte(addr.String())
} }
func addressFromKey(dst *objectSDK.Address, data []byte) error { func addressFromKey(dst *addressSDK.Address, data []byte) error {
return dst.Parse(string(data)) return dst.Parse(string(data))
} }

View file

@ -13,7 +13,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza"
storagelog "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/internal/log" storagelog "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/internal/log"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -132,7 +132,7 @@ func indexSlice(number uint64) []uint64 {
// save object in the maximum weight blobobnicza. // save object in the maximum weight blobobnicza.
// //
// returns error if could not save object in any blobovnicza. // returns error if could not save object in any blobovnicza.
func (b *blobovniczas) put(addr *objectSDK.Address, data []byte) (*blobovnicza.ID, error) { func (b *blobovniczas) put(addr *addressSDK.Address, data []byte) (*blobovnicza.ID, error) {
prm := new(blobovnicza.PutPrm) prm := new(blobovnicza.PutPrm)
prm.SetAddress(addr) prm.SetAddress(addr)
prm.SetMarshaledObject(data) prm.SetMarshaledObject(data)
@ -648,7 +648,7 @@ func (b *blobovniczas) iterateBlobovniczas(ignoreErrors bool, f func(string, *bl
} }
// iterator over the paths of blobovniczas sorted by weight. // iterator over the paths of blobovniczas sorted by weight.
func (b *blobovniczas) iterateSortedLeaves(addr *objectSDK.Address, f func(string) (bool, error)) error { func (b *blobovniczas) iterateSortedLeaves(addr *addressSDK.Address, f func(string) (bool, error)) error {
_, err := b.iterateSorted( _, err := b.iterateSorted(
addr, addr,
make([]string, 0, b.blzShallowDepth), make([]string, 0, b.blzShallowDepth),
@ -660,7 +660,7 @@ func (b *blobovniczas) iterateSortedLeaves(addr *objectSDK.Address, f func(strin
} }
// iterator over directories with blobovniczas sorted by weight. // iterator over directories with blobovniczas sorted by weight.
func (b *blobovniczas) iterateDeepest(addr *objectSDK.Address, f func(string) (bool, error)) error { func (b *blobovniczas) iterateDeepest(addr *addressSDK.Address, f func(string) (bool, error)) error {
depth := b.blzShallowDepth depth := b.blzShallowDepth
if depth > 0 { if depth > 0 {
depth-- depth--
@ -677,7 +677,7 @@ func (b *blobovniczas) iterateDeepest(addr *objectSDK.Address, f func(string) (b
} }
// iterator over particular level of directories. // iterator over particular level of directories.
func (b *blobovniczas) iterateSorted(addr *objectSDK.Address, curPath []string, execDepth uint64, f func([]string) (bool, error)) (bool, error) { func (b *blobovniczas) iterateSorted(addr *addressSDK.Address, curPath []string, execDepth uint64, f func([]string) (bool, error)) (bool, error) {
indices := indexSlice(b.blzShallowWidth) indices := indexSlice(b.blzShallowWidth)
hrw.SortSliceByValue(indices, addressHash(addr, filepath.Join(curPath...))) hrw.SortSliceByValue(indices, addressHash(addr, filepath.Join(curPath...)))
@ -906,7 +906,7 @@ func (b *blobovniczas) openBlobovnicza(p string) (*blobovnicza.Blobovnicza, erro
} }
// returns hash of the object address. // returns hash of the object address.
func addressHash(addr *objectSDK.Address, path string) uint64 { func addressHash(addr *addressSDK.Address, path string) uint64 {
var a string var a string
if addr != nil { if addr != nil {

View file

@ -11,6 +11,8 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/util/logger/test" "github.com/nspcc-dev/neofs-node/pkg/util/logger/test"
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test" cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -20,11 +22,11 @@ func testSHA256() (h [sha256.Size]byte) {
return h return h
} }
func testAddress() *objectSDK.Address { func testAddress() *addressSDK.Address {
oid := objectSDK.NewID() oid := oidSDK.NewID()
oid.SetSHA256(testSHA256()) oid.SetSHA256(testSHA256())
addr := objectSDK.NewAddress() addr := addressSDK.NewAddress()
addr.SetObjectID(oid) addr.SetObjectID(oid)
addr.SetContainerID(cidtest.ID()) addr.SetContainerID(cidtest.ID())
@ -84,7 +86,7 @@ func TestBlobovniczas(t *testing.T) {
objSz := uint64(szLim / 2) objSz := uint64(szLim / 2)
addrList := make([]*objectSDK.Address, 0) addrList := make([]*addressSDK.Address, 0)
minFitObjNum := width * depth * szLim / objSz minFitObjNum := width * depth * szLim / objSz
for i := uint64(0); i < minFitObjNum; i++ { for i := uint64(0); i < minFitObjNum; i++ {

View file

@ -4,7 +4,7 @@ import (
"errors" "errors"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
// ExistsPrm groups the parameters of Exists operation. // ExistsPrm groups the parameters of Exists operation.
@ -46,7 +46,7 @@ func (b *BlobStor) Exists(prm *ExistsPrm) (*ExistsRes, error) {
} }
// checks if object is presented in shallow dir. // checks if object is presented in shallow dir.
func (b *BlobStor) existsBig(addr *object.Address) (bool, error) { func (b *BlobStor) existsBig(addr *addressSDK.Address) (bool, error) {
_, err := b.fsTree.Exists(addr) _, err := b.fsTree.Exists(addr)
if errors.Is(err, fstree.ErrFileNotFound) { if errors.Is(err, fstree.ErrFileNotFound) {
return false, nil return false, nil
@ -56,7 +56,7 @@ func (b *BlobStor) existsBig(addr *object.Address) (bool, error) {
} }
// checks if object is presented in blobovnicza. // checks if object is presented in blobovnicza.
func (b *BlobStor) existsSmall(addr *object.Address) (bool, error) { func (b *BlobStor) existsSmall(_ *addressSDK.Address) (bool, error) {
// TODO: implement // TODO: implement
return false, nil return false, nil
} }

View file

@ -11,7 +11,8 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/util" "github.com/nspcc-dev/neofs-node/pkg/util"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
) )
// FSTree represents object storage as filesystem tree. // FSTree represents object storage as filesystem tree.
@ -41,17 +42,17 @@ const (
// ErrFileNotFound is returned when file is missing. // ErrFileNotFound is returned when file is missing.
var ErrFileNotFound = errors.New("file not found") var ErrFileNotFound = errors.New("file not found")
func stringifyAddress(addr *objectSDK.Address) string { func stringifyAddress(addr *addressSDK.Address) string {
return addr.ObjectID().String() + "." + addr.ContainerID().String() return addr.ObjectID().String() + "." + addr.ContainerID().String()
} }
func addressFromString(s string) (*objectSDK.Address, error) { func addressFromString(s string) (*addressSDK.Address, error) {
ss := strings.SplitN(s, ".", 2) ss := strings.SplitN(s, ".", 2)
if len(ss) != 2 { if len(ss) != 2 {
return nil, errors.New("invalid address") return nil, errors.New("invalid address")
} }
oid := objectSDK.NewID() oid := oidSDK.NewID()
if err := oid.Parse(ss[0]); err != nil { if err := oid.Parse(ss[0]); err != nil {
return nil, err return nil, err
} }
@ -61,7 +62,7 @@ func addressFromString(s string) (*objectSDK.Address, error) {
return nil, err return nil, err
} }
addr := objectSDK.NewAddress() addr := addressSDK.NewAddress()
addr.SetObjectID(oid) addr.SetObjectID(oid)
addr.SetContainerID(id) addr.SetContainerID(id)
@ -70,12 +71,12 @@ func addressFromString(s string) (*objectSDK.Address, error) {
// IterationPrm contains iteraction parameters. // IterationPrm contains iteraction parameters.
type IterationPrm struct { type IterationPrm struct {
handler func(addr *objectSDK.Address, data []byte) error handler func(addr *addressSDK.Address, data []byte) error
ignoreErrors bool ignoreErrors bool
} }
// WithHandler sets a function to call on each object. // WithHandler sets a function to call on each object.
func (p *IterationPrm) WithHandler(f func(addr *objectSDK.Address, data []byte) error) *IterationPrm { func (p *IterationPrm) WithHandler(f func(addr *addressSDK.Address, data []byte) error) *IterationPrm {
p.handler = f p.handler = f
return p return p
} }
@ -143,7 +144,7 @@ func (t *FSTree) iterate(depth int, curPath []string, prm *IterationPrm) error {
return nil return nil
} }
func (t *FSTree) treePath(addr *objectSDK.Address) string { func (t *FSTree) treePath(addr *addressSDK.Address) string {
sAddr := stringifyAddress(addr) sAddr := stringifyAddress(addr)
dirs := make([]string, 0, t.Depth+1+1) // 1 for root, 1 for file dirs := make([]string, 0, t.Depth+1+1) // 1 for root, 1 for file
@ -160,7 +161,7 @@ func (t *FSTree) treePath(addr *objectSDK.Address) string {
} }
// Delete removes object with the specified address from storage. // Delete removes object with the specified address from storage.
func (t *FSTree) Delete(addr *objectSDK.Address) error { func (t *FSTree) Delete(addr *addressSDK.Address) error {
p, err := t.Exists(addr) p, err := t.Exists(addr)
if err != nil { if err != nil {
return err return err
@ -171,7 +172,7 @@ func (t *FSTree) Delete(addr *objectSDK.Address) error {
// Exists returns path to file with object contents if it exists in storage // Exists returns path to file with object contents if it exists in storage
// and an error otherwise. // and an error otherwise.
func (t *FSTree) Exists(addr *objectSDK.Address) (string, error) { func (t *FSTree) Exists(addr *addressSDK.Address) (string, error) {
p := t.treePath(addr) p := t.treePath(addr)
_, err := os.Stat(p) _, err := os.Stat(p)
@ -183,7 +184,7 @@ func (t *FSTree) Exists(addr *objectSDK.Address) (string, error) {
} }
// Put puts object in storage. // Put puts object in storage.
func (t *FSTree) Put(addr *objectSDK.Address, data []byte) error { func (t *FSTree) Put(addr *addressSDK.Address, data []byte) error {
p := t.treePath(addr) p := t.treePath(addr)
if err := util.MkdirAllX(filepath.Dir(p), t.Permissions); err != nil { if err := util.MkdirAllX(filepath.Dir(p), t.Permissions); err != nil {
@ -194,7 +195,7 @@ func (t *FSTree) Put(addr *objectSDK.Address, data []byte) error {
} }
// Get returns object from storage by address. // Get returns object from storage by address.
func (t *FSTree) Get(addr *objectSDK.Address) ([]byte, error) { func (t *FSTree) Get(addr *addressSDK.Address) ([]byte, error) {
p := t.treePath(addr) p := t.treePath(addr)
if _, err := os.Stat(p); os.IsNotExist(err) { if _, err := os.Stat(p); os.IsNotExist(err) {

View file

@ -10,23 +10,24 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/util" "github.com/nspcc-dev/neofs-node/pkg/util"
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test" cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
objecttest "github.com/nspcc-dev/neofs-sdk-go/object/test" objecttest "github.com/nspcc-dev/neofs-sdk-go/object/address/test"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
func testOID() *objectSDK.ID { func testOID() *oidSDK.ID {
cs := [sha256.Size]byte{} cs := [sha256.Size]byte{}
_, _ = rand.Read(cs[:]) _, _ = rand.Read(cs[:])
id := objectSDK.NewID() id := oidSDK.NewID()
id.SetSHA256(cs) id.SetSHA256(cs)
return id return id
} }
func testAddress() *objectSDK.Address { func testAddress() *addressSDK.Address {
a := objectSDK.NewAddress() a := addressSDK.NewAddress()
a.SetObjectID(testOID()) a.SetObjectID(testOID())
a.SetContainerID(cidtest.ID()) a.SetContainerID(cidtest.ID())
@ -56,7 +57,7 @@ func TestFSTree(t *testing.T) {
} }
const count = 3 const count = 3
var addrs []*objectSDK.Address var addrs []*addressSDK.Address
store := map[string][]byte{} store := map[string][]byte{}
@ -93,7 +94,7 @@ func TestFSTree(t *testing.T) {
t.Run("iterate", func(t *testing.T) { t.Run("iterate", func(t *testing.T) {
n := 0 n := 0
err := fs.Iterate(new(IterationPrm).WithHandler(func(addr *objectSDK.Address, data []byte) error { err := fs.Iterate(new(IterationPrm).WithHandler(func(addr *addressSDK.Address, data []byte) error {
n++ n++
expected, ok := store[addr.String()] expected, ok := store[addr.String()]
require.True(t, ok, "object %s was not found", addr.String()) require.True(t, ok, "object %s was not found", addr.String())
@ -107,7 +108,7 @@ func TestFSTree(t *testing.T) {
t.Run("leave early", func(t *testing.T) { t.Run("leave early", func(t *testing.T) {
n := 0 n := 0
errStop := errors.New("stop") errStop := errors.New("stop")
err := fs.Iterate(new(IterationPrm).WithHandler(func(addr *objectSDK.Address, data []byte) error { err := fs.Iterate(new(IterationPrm).WithHandler(func(addr *addressSDK.Address, data []byte) error {
if n++; n == count-1 { if n++; n == count-1 {
return errStop return errStop
} }
@ -134,7 +135,7 @@ func TestFSTree(t *testing.T) {
require.NoError(t, util.MkdirAllX(filepath.Dir(p), fs.Permissions)) require.NoError(t, util.MkdirAllX(filepath.Dir(p), fs.Permissions))
require.NoError(t, os.WriteFile(p, []byte{1, 2, 3}, fs.Permissions)) require.NoError(t, os.WriteFile(p, []byte{1, 2, 3}, fs.Permissions))
err := fs.Iterate(new(IterationPrm).WithHandler(func(addr *objectSDK.Address, data []byte) error { err := fs.Iterate(new(IterationPrm).WithHandler(func(addr *addressSDK.Address, data []byte) error {
n++ n++
return nil return nil
}).WithIgnoreErrors(true)) }).WithIgnoreErrors(true))
@ -144,7 +145,7 @@ func TestFSTree(t *testing.T) {
t.Run("error from handler is returned", func(t *testing.T) { t.Run("error from handler is returned", func(t *testing.T) {
expectedErr := errors.New("expected error") expectedErr := errors.New("expected error")
n := 0 n := 0
err := fs.Iterate(new(IterationPrm).WithHandler(func(addr *objectSDK.Address, data []byte) error { err := fs.Iterate(new(IterationPrm).WithHandler(func(addr *addressSDK.Address, data []byte) error {
n++ n++
if n == count/2 { // process some iterations if n == count/2 { // process some iterations
return expectedErr return expectedErr

View file

@ -6,7 +6,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
// IterationElement represents a unit of elements through which Iterate operation passes. // IterationElement represents a unit of elements through which Iterate operation passes.
@ -88,7 +88,7 @@ func (b *BlobStor) Iterate(prm IteratePrm) (*IterateRes, error) {
elem.blzID = nil elem.blzID = nil
err = b.fsTree.Iterate(new(fstree.IterationPrm).WithHandler(func(_ *objectSDK.Address, data []byte) error { err = b.fsTree.Iterate(new(fstree.IterationPrm).WithHandler(func(_ *addressSDK.Address, data []byte) error {
// decompress the data // decompress the data
elem.data, err = b.decompressor(data) elem.data, err = b.decompressor(data)
if err != nil { if err != nil {

View file

@ -10,9 +10,10 @@ import (
"testing" "testing"
"github.com/klauspost/compress/zstd" "github.com/klauspost/compress/zstd"
"github.com/nspcc-dev/neofs-node/pkg/core/object"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
objecttest "github.com/nspcc-dev/neofs-sdk-go/object/test" objecttest "github.com/nspcc-dev/neofs-sdk-go/object/address/test"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -44,7 +45,7 @@ func TestIterateObjects(t *testing.T) {
type addrData struct { type addrData struct {
big bool big bool
addr *object.Address addr *addressSDK.Address
data []byte data []byte
} }
@ -113,7 +114,7 @@ func TestIterate_IgnoreErrors(t *testing.T) {
require.NoError(t, bs.Open()) require.NoError(t, bs.Open())
require.NoError(t, bs.Init()) require.NoError(t, bs.Init())
addrs := make([]*object.Address, objCount) addrs := make([]*addressSDK.Address, objCount)
for i := range addrs { for i := range addrs {
addrs[i] = objecttest.Address() addrs[i] = objecttest.Address()
obj := object.NewRaw() obj := object.NewRaw()
@ -170,7 +171,7 @@ func TestIterate_IgnoreErrors(t *testing.T) {
prm.IgnoreErrors() prm.IgnoreErrors()
t.Run("skip invalid objects", func(t *testing.T) { t.Run("skip invalid objects", func(t *testing.T) {
actual := make([]*object.Address, 0, len(addrs)) actual := make([]*addressSDK.Address, 0, len(addrs))
prm.SetIterationHandler(func(e IterationElement) error { prm.SetIterationHandler(func(e IterationElement) error {
obj := object.New() obj := object.New()
err := obj.Unmarshal(e.data) err := obj.Unmarshal(e.data)
@ -178,7 +179,7 @@ func TestIterate_IgnoreErrors(t *testing.T) {
return err return err
} }
addr := object.NewAddress() addr := addressSDK.NewAddress()
addr.SetContainerID(obj.ContainerID()) addr.SetContainerID(obj.ContainerID())
addr.SetObjectID(obj.ID()) addr.SetObjectID(obj.ID())
actual = append(actual, addr) actual = append(actual, addr)

View file

@ -7,6 +7,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
storagelog "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/internal/log" storagelog "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/internal/log"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
// PutPrm groups the parameters of Put operation. // PutPrm groups the parameters of Put operation.
@ -69,7 +70,7 @@ func (b *BlobStor) NeedsCompression(obj *object.Object) bool {
} }
// PutRaw saves already marshaled object in BLOB storage. // PutRaw saves already marshaled object in BLOB storage.
func (b *BlobStor) PutRaw(addr *objectSDK.Address, data []byte, compress bool) (*PutRes, error) { func (b *BlobStor) PutRaw(addr *addressSDK.Address, data []byte, compress bool) (*PutRes, error) {
big := b.isBig(data) big := b.isBig(data)
if compress { if compress {

View file

@ -4,14 +4,15 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
type address struct { type address struct {
addr *objectSDK.Address addr *addressSDK.Address
} }
// SetAddress sets the address of the requested object. // SetAddress sets the address of the requested object.
func (a *address) SetAddress(addr *objectSDK.Address) { func (a *address) SetAddress(addr *addressSDK.Address) {
a.addr = addr a.addr = addr
} }

View file

@ -2,12 +2,12 @@ package engine
import ( import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
// DeletePrm groups the parameters of Delete operation. // DeletePrm groups the parameters of Delete operation.
type DeletePrm struct { type DeletePrm struct {
addr []*objectSDK.Address addr []*addressSDK.Address
} }
// DeleteRes groups resulting values of Delete operation. // DeleteRes groups resulting values of Delete operation.
@ -16,7 +16,7 @@ type DeleteRes struct{}
// WithAddresses is a Delete option to set the addresses of the objects to delete. // WithAddresses is a Delete option to set the addresses of the objects to delete.
// //
// Option is required. // Option is required.
func (p *DeletePrm) WithAddresses(addr ...*objectSDK.Address) *DeletePrm { func (p *DeletePrm) WithAddresses(addr ...*addressSDK.Address) *DeletePrm {
if p != nil { if p != nil {
p.addr = append(p.addr, addr...) p.addr = append(p.addr, addr...)
} }

View file

@ -17,6 +17,7 @@ import (
"github.com/nspcc-dev/neofs-sdk-go/checksum" "github.com/nspcc-dev/neofs-sdk-go/checksum"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/nspcc-dev/neofs-sdk-go/owner" "github.com/nspcc-dev/neofs-sdk-go/owner"
ownertest "github.com/nspcc-dev/neofs-sdk-go/owner/test" ownertest "github.com/nspcc-dev/neofs-sdk-go/owner/test"
"github.com/nspcc-dev/neofs-sdk-go/version" "github.com/nspcc-dev/neofs-sdk-go/version"
@ -77,11 +78,11 @@ func testNewShard(t *testing.T, id int) *shard.Shard {
return s return s
} }
func testOID() *objectSDK.ID { func testOID() *oidSDK.ID {
cs := [sha256.Size]byte{} cs := [sha256.Size]byte{}
_, _ = rand.Read(cs[:]) _, _ = rand.Read(cs[:])
id := objectSDK.NewID() id := oidSDK.NewID()
id.SetSHA256(cs) id.SetSHA256(cs)
return id return id

View file

@ -5,10 +5,10 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
func (e *StorageEngine) exists(addr *objectSDK.Address) (bool, error) { func (e *StorageEngine) exists(addr *addressSDK.Address) (bool, error) {
shPrm := new(shard.ExistsPrm).WithAddress(addr) shPrm := new(shard.ExistsPrm).WithAddress(addr)
alreadyRemoved := false alreadyRemoved := false
exists := false exists := false

View file

@ -7,11 +7,12 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/util" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/util"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
// GetPrm groups the parameters of Get operation. // GetPrm groups the parameters of Get operation.
type GetPrm struct { type GetPrm struct {
addr *objectSDK.Address addr *addressSDK.Address
} }
// GetRes groups resulting values of Get operation. // GetRes groups resulting values of Get operation.
@ -22,7 +23,7 @@ type GetRes struct {
// WithAddress is a Get option to set the address of the requested object. // WithAddress is a Get option to set the address of the requested object.
// //
// Option is required. // Option is required.
func (p *GetPrm) WithAddress(addr *objectSDK.Address) *GetPrm { func (p *GetPrm) WithAddress(addr *addressSDK.Address) *GetPrm {
if p != nil { if p != nil {
p.addr = addr p.addr = addr
} }
@ -118,7 +119,7 @@ func (e *StorageEngine) get(prm *GetPrm) (*GetRes, error) {
} }
// Get reads object from local storage by provided address. // Get reads object from local storage by provided address.
func Get(storage *StorageEngine, addr *objectSDK.Address) (*object.Object, error) { func Get(storage *StorageEngine, addr *addressSDK.Address) (*object.Object, error) {
res, err := storage.Get(new(GetPrm). res, err := storage.Get(new(GetPrm).
WithAddress(addr), WithAddress(addr),
) )

View file

@ -7,11 +7,12 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/util" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/util"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
// HeadPrm groups the parameters of Head operation. // HeadPrm groups the parameters of Head operation.
type HeadPrm struct { type HeadPrm struct {
addr *objectSDK.Address addr *addressSDK.Address
raw bool raw bool
} }
@ -23,7 +24,7 @@ type HeadRes struct {
// WithAddress is a Head option to set the address of the requested object. // WithAddress is a Head option to set the address of the requested object.
// //
// Option is required. // Option is required.
func (p *HeadPrm) WithAddress(addr *objectSDK.Address) *HeadPrm { func (p *HeadPrm) WithAddress(addr *addressSDK.Address) *HeadPrm {
if p != nil { if p != nil {
p.addr = addr p.addr = addr
} }
@ -134,7 +135,7 @@ func (e *StorageEngine) head(prm *HeadPrm) (*HeadRes, error) {
} }
// Head reads object header from local storage by provided address. // Head reads object header from local storage by provided address.
func Head(storage *StorageEngine, addr *objectSDK.Address) (*object.Object, error) { func Head(storage *StorageEngine, addr *addressSDK.Address) (*object.Object, error) {
res, err := storage.Head(new(HeadPrm). res, err := storage.Head(new(HeadPrm).
WithAddress(addr), WithAddress(addr),
) )
@ -147,7 +148,7 @@ func Head(storage *StorageEngine, addr *objectSDK.Address) (*object.Object, erro
// HeadRaw reads object header from local storage by provided address and raw // HeadRaw reads object header from local storage by provided address and raw
// flag. // flag.
func HeadRaw(storage *StorageEngine, addr *objectSDK.Address, raw bool) (*object.Object, error) { func HeadRaw(storage *StorageEngine, addr *addressSDK.Address, raw bool) (*object.Object, error) {
res, err := storage.Head(new(HeadPrm). res, err := storage.Head(new(HeadPrm).
WithAddress(addr). WithAddress(addr).
WithRaw(raw), WithRaw(raw),

View file

@ -7,6 +7,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test" cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -19,7 +20,7 @@ func TestHeadRaw(t *testing.T) {
parent := generateRawObjectWithCID(t, cid) parent := generateRawObjectWithCID(t, cid)
addAttribute(parent, "foo", "bar") addAttribute(parent, "foo", "bar")
parentAddr := objectSDK.NewAddress() parentAddr := addressSDK.NewAddress()
parentAddr.SetContainerID(cid) parentAddr.SetContainerID(cid)
parentAddr.SetObjectID(parent.ID()) parentAddr.SetObjectID(parent.ID())

View file

@ -7,12 +7,13 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
// InhumePrm encapsulates parameters for inhume operation. // InhumePrm encapsulates parameters for inhume operation.
type InhumePrm struct { type InhumePrm struct {
tombstone *objectSDK.Address tombstone *addressSDK.Address
addrs []*objectSDK.Address addrs []*addressSDK.Address
} }
// InhumeRes encapsulates results of inhume operation. // InhumeRes encapsulates results of inhume operation.
@ -23,7 +24,7 @@ type InhumeRes struct{}
// //
// tombstone should not be nil, addr should not be empty. // tombstone should not be nil, addr should not be empty.
// Should not be called along with MarkAsGarbage. // Should not be called along with MarkAsGarbage.
func (p *InhumePrm) WithTarget(tombstone *objectSDK.Address, addrs ...*objectSDK.Address) *InhumePrm { func (p *InhumePrm) WithTarget(tombstone *addressSDK.Address, addrs ...*addressSDK.Address) *InhumePrm {
if p != nil { if p != nil {
p.addrs = addrs p.addrs = addrs
p.tombstone = tombstone p.tombstone = tombstone
@ -35,7 +36,7 @@ func (p *InhumePrm) WithTarget(tombstone *objectSDK.Address, addrs ...*objectSDK
// MarkAsGarbage marks object to be physically removed from local storage. // MarkAsGarbage marks object to be physically removed from local storage.
// //
// Should not be called along with WithTarget. // Should not be called along with WithTarget.
func (p *InhumePrm) MarkAsGarbage(addrs ...*objectSDK.Address) *InhumePrm { func (p *InhumePrm) MarkAsGarbage(addrs ...*addressSDK.Address) *InhumePrm {
if p != nil { if p != nil {
p.addrs = addrs p.addrs = addrs
p.tombstone = nil p.tombstone = nil
@ -85,7 +86,7 @@ func (e *StorageEngine) inhume(prm *InhumePrm) (*InhumeRes, error) {
return new(InhumeRes), nil return new(InhumeRes), nil
} }
func (e *StorageEngine) inhumeAddr(addr *objectSDK.Address, prm *shard.InhumePrm, checkExists bool) (ok bool) { func (e *StorageEngine) inhumeAddr(addr *addressSDK.Address, prm *shard.InhumePrm, checkExists bool) (ok bool) {
root := false root := false
e.iterateOverSortedShards(addr, func(_ int, sh hashedShard) (stop bool) { e.iterateOverSortedShards(addr, func(_ int, sh hashedShard) (stop bool) {
@ -133,7 +134,7 @@ func (e *StorageEngine) inhumeAddr(addr *objectSDK.Address, prm *shard.InhumePrm
return return
} }
func (e *StorageEngine) processExpiredTombstones(ctx context.Context, addrs []*objectSDK.Address) { func (e *StorageEngine) processExpiredTombstones(ctx context.Context, addrs []*addressSDK.Address) {
tss := make(map[string]struct{}, len(addrs)) tss := make(map[string]struct{}, len(addrs))
for i := range addrs { for i := range addrs {

View file

@ -4,7 +4,7 @@ import (
"sort" "sort"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
// ErrEndOfListing is returned from object listing with cursor // ErrEndOfListing is returned from object listing with cursor
@ -40,12 +40,12 @@ func (p *ListWithCursorPrm) WithCursor(cursor *Cursor) *ListWithCursorPrm {
// ListWithCursorRes contains values returned from ListWithCursor operation. // ListWithCursorRes contains values returned from ListWithCursor operation.
type ListWithCursorRes struct { type ListWithCursorRes struct {
addrList []*object.Address addrList []*addressSDK.Address
cursor *Cursor cursor *Cursor
} }
// AddressList returns addresses selected by ListWithCursor operation. // AddressList returns addresses selected by ListWithCursor operation.
func (l ListWithCursorRes) AddressList() []*object.Address { func (l ListWithCursorRes) AddressList() []*addressSDK.Address {
return l.addrList return l.addrList
} }
@ -62,7 +62,7 @@ func (l ListWithCursorRes) Cursor() *Cursor {
// Returns ErrEndOfListing if there are no more objects to return or count // Returns ErrEndOfListing if there are no more objects to return or count
// parameter set to zero. // parameter set to zero.
func (e *StorageEngine) ListWithCursor(prm *ListWithCursorPrm) (*ListWithCursorRes, error) { func (e *StorageEngine) ListWithCursor(prm *ListWithCursorPrm) (*ListWithCursorRes, error) {
result := make([]*object.Address, 0, prm.count) result := make([]*addressSDK.Address, 0, prm.count)
// 1. Get available shards and sort them. // 1. Get available shards and sort them.
e.mtx.RLock() e.mtx.RLock()

View file

@ -7,7 +7,7 @@ import (
"testing" "testing"
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test" cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -23,8 +23,8 @@ func TestListWithCursor(t *testing.T) {
const total = 20 const total = 20
expected := make([]*object.Address, 0, total) expected := make([]*addressSDK.Address, 0, total)
got := make([]*object.Address, 0, total) got := make([]*addressSDK.Address, 0, total)
for i := 0; i < total; i++ { for i := 0; i < total; i++ {
containerID := cidtest.ID() containerID := cidtest.ID()
@ -58,7 +58,7 @@ func TestListWithCursor(t *testing.T) {
require.Equal(t, expected, got) require.Equal(t, expected, got)
} }
func sortAddresses(addr []*object.Address) []*object.Address { func sortAddresses(addr []*addressSDK.Address) []*addressSDK.Address {
sort.Slice(addr, func(i, j int) bool { sort.Slice(addr, func(i, j int) bool {
return addr[i].String() < addr[j].String() return addr[i].String() < addr[j].String()
}) })

View file

@ -7,13 +7,14 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/util" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/util"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
// RngPrm groups the parameters of GetRange operation. // RngPrm groups the parameters of GetRange operation.
type RngPrm struct { type RngPrm struct {
off, ln uint64 off, ln uint64
addr *objectSDK.Address addr *addressSDK.Address
} }
// RngRes groups resulting values of GetRange operation. // RngRes groups resulting values of GetRange operation.
@ -24,7 +25,7 @@ type RngRes struct {
// WithAddress is a GetRng option to set the address of the requested object. // WithAddress is a GetRng option to set the address of the requested object.
// //
// Option is required. // Option is required.
func (p *RngPrm) WithAddress(addr *objectSDK.Address) *RngPrm { func (p *RngPrm) WithAddress(addr *addressSDK.Address) *RngPrm {
if p != nil { if p != nil {
p.addr = addr p.addr = addr
} }
@ -139,7 +140,7 @@ func (e *StorageEngine) getRange(prm *RngPrm) (*RngRes, error) {
} }
// GetRange reads object payload range from local storage by provided address. // GetRange reads object payload range from local storage by provided address.
func GetRange(storage *StorageEngine, addr *objectSDK.Address, rng *objectSDK.Range) ([]byte, error) { func GetRange(storage *StorageEngine, addr *addressSDK.Address, rng *objectSDK.Range) ([]byte, error) {
res, err := storage.GetRange(new(RngPrm). res, err := storage.GetRange(new(RngPrm).
WithAddress(addr). WithAddress(addr).
WithPayloadRange(rng), WithPayloadRange(rng),

View file

@ -7,6 +7,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
// SelectPrm groups the parameters of Select operation. // SelectPrm groups the parameters of Select operation.
@ -17,7 +18,7 @@ type SelectPrm struct {
// SelectRes groups resulting values of Select operation. // SelectRes groups resulting values of Select operation.
type SelectRes struct { type SelectRes struct {
addrList []*object.Address addrList []*addressSDK.Address
} }
// WithContainerID is a Select option to set the container id to search in. // WithContainerID is a Select option to set the container id to search in.
@ -39,7 +40,7 @@ func (p *SelectPrm) WithFilters(fs object.SearchFilters) *SelectPrm {
} }
// AddressList returns list of addresses of the selected objects. // AddressList returns list of addresses of the selected objects.
func (r *SelectRes) AddressList() []*object.Address { func (r *SelectRes) AddressList() []*addressSDK.Address {
return r.addrList return r.addrList
} }
@ -62,7 +63,7 @@ func (e *StorageEngine) _select(prm *SelectPrm) (*SelectRes, error) {
defer elapsed(e.metrics.AddSearchDuration)() defer elapsed(e.metrics.AddSearchDuration)()
} }
addrList := make([]*object.Address, 0) addrList := make([]*addressSDK.Address, 0)
uniqueMap := make(map[string]struct{}) uniqueMap := make(map[string]struct{})
var outError error var outError error
@ -119,7 +120,7 @@ func (e *StorageEngine) list(limit uint64) (*SelectRes, error) {
defer elapsed(e.metrics.AddListObjectsDuration)() defer elapsed(e.metrics.AddListObjectsDuration)()
} }
addrList := make([]*object.Address, 0, limit) addrList := make([]*addressSDK.Address, 0, limit)
uniqueMap := make(map[string]struct{}) uniqueMap := make(map[string]struct{})
ln := uint64(0) ln := uint64(0)
@ -151,7 +152,7 @@ func (e *StorageEngine) list(limit uint64) (*SelectRes, error) {
} }
// Select selects objects from local storage using provided filters. // Select selects objects from local storage using provided filters.
func Select(storage *StorageEngine, cid *cid.ID, fs object.SearchFilters) ([]*object.Address, error) { func Select(storage *StorageEngine, cid *cid.ID, fs object.SearchFilters) ([]*addressSDK.Address, error) {
res, err := storage.Select(new(SelectPrm). res, err := storage.Select(new(SelectPrm).
WithContainerID(cid). WithContainerID(cid).
WithFilters(fs), WithFilters(fs),
@ -165,7 +166,7 @@ func Select(storage *StorageEngine, cid *cid.ID, fs object.SearchFilters) ([]*ob
// List returns `limit` available physically storage object addresses in // List returns `limit` available physically storage object addresses in
// engine. If limit is zero, then returns all available object addresses. // engine. If limit is zero, then returns all available object addresses.
func List(storage *StorageEngine, limit uint64) ([]*object.Address, error) { func List(storage *StorageEngine, limit uint64) ([]*addressSDK.Address, error) {
res, err := storage.List(limit) res, err := storage.List(limit)
if err != nil { if err != nil {
return nil, err return nil, err

View file

@ -7,7 +7,7 @@ import (
"github.com/google/uuid" "github.com/google/uuid"
"github.com/nspcc-dev/hrw" "github.com/nspcc-dev/hrw"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"github.com/panjf2000/ants/v2" "github.com/panjf2000/ants/v2"
"go.uber.org/atomic" "go.uber.org/atomic"
) )
@ -99,7 +99,7 @@ func (e *StorageEngine) unsortedShards() []hashedShard {
return shards return shards
} }
func (e *StorageEngine) iterateOverSortedShards(addr *object.Address, handler func(int, hashedShard) (stop bool)) { func (e *StorageEngine) iterateOverSortedShards(addr *addressSDK.Address, handler func(int, hashedShard) (stop bool)) {
for i, sh := range e.sortShardsByWeight(addr) { for i, sh := range e.sortShardsByWeight(addr) {
if handler(i, sh) { if handler(i, sh) {
break break

View file

@ -5,7 +5,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase" meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -20,7 +20,7 @@ func TestReset(t *testing.T) {
addrToInhume := generateAddress() addrToInhume := generateAddress()
assertExists := func(addr *objectSDK.Address, expExists bool, expErr error) { assertExists := func(addr *addressSDK.Address, expExists bool, expErr error) {
exists, err := meta.Exists(db, addr) exists, err := meta.Exists(db, addr)
require.ErrorIs(t, err, expErr) require.ErrorIs(t, err, expErr)
require.Equal(t, expExists, exists) require.Equal(t, expExists, exists)

View file

@ -13,6 +13,8 @@ import (
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test" cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/nspcc-dev/neofs-sdk-go/owner" "github.com/nspcc-dev/neofs-sdk-go/owner"
ownertest "github.com/nspcc-dev/neofs-sdk-go/owner/test" ownertest "github.com/nspcc-dev/neofs-sdk-go/owner/test"
"github.com/nspcc-dev/neofs-sdk-go/version" "github.com/nspcc-dev/neofs-sdk-go/version"
@ -25,7 +27,7 @@ func putBig(db *meta.DB, obj *object.Object) error {
return meta.Put(db, obj, nil) return meta.Put(db, obj, nil)
} }
func testSelect(t *testing.T, db *meta.DB, cid *cid.ID, fs objectSDK.SearchFilters, exp ...*objectSDK.Address) { func testSelect(t *testing.T, db *meta.DB, cid *cid.ID, fs objectSDK.SearchFilters, exp ...*addressSDK.Address) {
res, err := meta.Select(db, cid, fs) res, err := meta.Select(db, cid, fs)
require.NoError(t, err) require.NoError(t, err)
require.Len(t, res, len(exp)) require.Len(t, res, len(exp))
@ -35,11 +37,11 @@ func testSelect(t *testing.T, db *meta.DB, cid *cid.ID, fs objectSDK.SearchFilte
} }
} }
func testOID() *objectSDK.ID { func testOID() *oidSDK.ID {
cs := [sha256.Size]byte{} cs := [sha256.Size]byte{}
_, _ = rand.Read(cs[:]) _, _ = rand.Read(cs[:])
id := objectSDK.NewID() id := oidSDK.NewID()
id.SetSHA256(cs) id.SetSHA256(cs)
return id return id
@ -87,8 +89,8 @@ func generateRawObjectWithCID(t *testing.T, cid *cid.ID) *object.RawObject {
return obj return obj
} }
func generateAddress() *objectSDK.Address { func generateAddress() *addressSDK.Address {
addr := objectSDK.NewAddress() addr := addressSDK.NewAddress()
addr.SetContainerID(cidtest.ID()) addr.SetContainerID(cidtest.ID())
addr.SetObjectID(testOID()) addr.SetObjectID(testOID())

View file

@ -7,12 +7,13 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )
// DeletePrm groups the parameters of Delete operation. // DeletePrm groups the parameters of Delete operation.
type DeletePrm struct { type DeletePrm struct {
addrs []*objectSDK.Address addrs []*addressSDK.Address
} }
// DeleteRes groups resulting values of Delete operation. // DeleteRes groups resulting values of Delete operation.
@ -21,7 +22,7 @@ type DeleteRes struct{}
// WithAddresses is a Delete option to set the addresses of the objects to delete. // WithAddresses is a Delete option to set the addresses of the objects to delete.
// //
// Option is required. // Option is required.
func (p *DeletePrm) WithAddresses(addrs ...*objectSDK.Address) *DeletePrm { func (p *DeletePrm) WithAddresses(addrs ...*addressSDK.Address) *DeletePrm {
if p != nil { if p != nil {
p.addrs = addrs p.addrs = addrs
} }
@ -30,7 +31,7 @@ func (p *DeletePrm) WithAddresses(addrs ...*objectSDK.Address) *DeletePrm {
} }
// Delete removes objects from DB. // Delete removes objects from DB.
func Delete(db *DB, addrs ...*objectSDK.Address) error { func Delete(db *DB, addrs ...*addressSDK.Address) error {
_, err := db.Delete(new(DeletePrm).WithAddresses(addrs...)) _, err := db.Delete(new(DeletePrm).WithAddresses(addrs...))
return err return err
} }
@ -38,7 +39,7 @@ func Delete(db *DB, addrs ...*objectSDK.Address) error {
type referenceNumber struct { type referenceNumber struct {
all, cur int all, cur int
addr *objectSDK.Address addr *addressSDK.Address
obj *object.Object obj *object.Object
} }
@ -52,7 +53,7 @@ func (db *DB) Delete(prm *DeletePrm) (*DeleteRes, error) {
}) })
} }
func (db *DB) deleteGroup(tx *bbolt.Tx, addrs []*objectSDK.Address) error { func (db *DB) deleteGroup(tx *bbolt.Tx, addrs []*addressSDK.Address) error {
refCounter := make(referenceCounter, len(addrs)) refCounter := make(referenceCounter, len(addrs))
for i := range addrs { for i := range addrs {
@ -74,7 +75,7 @@ func (db *DB) deleteGroup(tx *bbolt.Tx, addrs []*objectSDK.Address) error {
return nil return nil
} }
func (db *DB) delete(tx *bbolt.Tx, addr *objectSDK.Address, refCounter referenceCounter) error { func (db *DB) delete(tx *bbolt.Tx, addr *addressSDK.Address, refCounter referenceCounter) error {
// remove record from graveyard // remove record from graveyard
graveyard := tx.Bucket(graveyardBucketName) graveyard := tx.Bucket(graveyardBucketName)
if graveyard != nil { if graveyard != nil {
@ -158,7 +159,7 @@ func (db *DB) deleteObject(
} }
// parentLength returns amount of available children from parentid index. // parentLength returns amount of available children from parentid index.
func parentLength(tx *bbolt.Tx, addr *objectSDK.Address) int { func parentLength(tx *bbolt.Tx, addr *addressSDK.Address) int {
bkt := tx.Bucket(parentBucketName(addr.ContainerID())) bkt := tx.Bucket(parentBucketName(addr.ContainerID()))
if bkt == nil { if bkt == nil {
return 0 return 0

View file

@ -8,12 +8,13 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )
// ExistsPrm groups the parameters of Exists operation. // ExistsPrm groups the parameters of Exists operation.
type ExistsPrm struct { type ExistsPrm struct {
addr *objectSDK.Address addr *addressSDK.Address
} }
// ExistsRes groups resulting values of Exists operation. // ExistsRes groups resulting values of Exists operation.
@ -24,7 +25,7 @@ type ExistsRes struct {
var ErrLackSplitInfo = errors.New("no split info on parent object") var ErrLackSplitInfo = errors.New("no split info on parent object")
// WithAddress is an Exists option to set object checked for existence. // WithAddress is an Exists option to set object checked for existence.
func (p *ExistsPrm) WithAddress(addr *objectSDK.Address) *ExistsPrm { func (p *ExistsPrm) WithAddress(addr *addressSDK.Address) *ExistsPrm {
if p != nil { if p != nil {
p.addr = addr p.addr = addr
} }
@ -38,7 +39,7 @@ func (p *ExistsRes) Exists() bool {
} }
// Exists checks if object is presented in DB. // Exists checks if object is presented in DB.
func Exists(db *DB, addr *objectSDK.Address) (bool, error) { func Exists(db *DB, addr *addressSDK.Address) (bool, error) {
r, err := db.Exists(new(ExistsPrm).WithAddress(addr)) r, err := db.Exists(new(ExistsPrm).WithAddress(addr))
if err != nil { if err != nil {
return false, err return false, err
@ -61,7 +62,7 @@ func (db *DB) Exists(prm *ExistsPrm) (res *ExistsRes, err error) {
return return
} }
func (db *DB) exists(tx *bbolt.Tx, addr *objectSDK.Address) (exists bool, err error) { func (db *DB) exists(tx *bbolt.Tx, addr *addressSDK.Address) (exists bool, err error) {
// check graveyard first // check graveyard first
switch inGraveyard(tx, addr) { switch inGraveyard(tx, addr) {
case 1: case 1:
@ -100,7 +101,7 @@ func (db *DB) exists(tx *bbolt.Tx, addr *objectSDK.Address) (exists bool, err er
// * 0 if object is not in graveyard; // * 0 if object is not in graveyard;
// * 1 if object is in graveyard with GC mark; // * 1 if object is in graveyard with GC mark;
// * 2 if object is in graveyard with tombstone. // * 2 if object is in graveyard with tombstone.
func inGraveyard(tx *bbolt.Tx, addr *objectSDK.Address) uint8 { func inGraveyard(tx *bbolt.Tx, addr *addressSDK.Address) uint8 {
graveyard := tx.Bucket(graveyardBucketName) graveyard := tx.Bucket(graveyardBucketName)
if graveyard == nil { if graveyard == nil {
return 0 return 0

View file

@ -6,12 +6,13 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )
// GetPrm groups the parameters of Get operation. // GetPrm groups the parameters of Get operation.
type GetPrm struct { type GetPrm struct {
addr *objectSDK.Address addr *addressSDK.Address
raw bool raw bool
} }
@ -23,7 +24,7 @@ type GetRes struct {
// WithAddress is a Get option to set the address of the requested object. // WithAddress is a Get option to set the address of the requested object.
// //
// Option is required. // Option is required.
func (p *GetPrm) WithAddress(addr *objectSDK.Address) *GetPrm { func (p *GetPrm) WithAddress(addr *addressSDK.Address) *GetPrm {
if p != nil { if p != nil {
p.addr = addr p.addr = addr
} }
@ -48,7 +49,7 @@ func (r *GetRes) Header() *object.Object {
} }
// Get reads the object from DB. // Get reads the object from DB.
func Get(db *DB, addr *objectSDK.Address) (*object.Object, error) { func Get(db *DB, addr *addressSDK.Address) (*object.Object, error) {
r, err := db.Get(new(GetPrm).WithAddress(addr)) r, err := db.Get(new(GetPrm).WithAddress(addr))
if err != nil { if err != nil {
return nil, err return nil, err
@ -58,7 +59,7 @@ func Get(db *DB, addr *objectSDK.Address) (*object.Object, error) {
} }
// GetRaw reads physically stored object from DB. // GetRaw reads physically stored object from DB.
func GetRaw(db *DB, addr *objectSDK.Address, raw bool) (*object.Object, error) { func GetRaw(db *DB, addr *addressSDK.Address, raw bool) (*object.Object, error) {
r, err := db.Get(new(GetPrm).WithAddress(addr).WithRaw(raw)) r, err := db.Get(new(GetPrm).WithAddress(addr).WithRaw(raw))
if err != nil { if err != nil {
return nil, err return nil, err
@ -80,7 +81,7 @@ func (db *DB) Get(prm *GetPrm) (res *GetRes, err error) {
return return
} }
func (db *DB) get(tx *bbolt.Tx, addr *objectSDK.Address, checkGraveyard, raw bool) (*object.Object, error) { func (db *DB) get(tx *bbolt.Tx, addr *addressSDK.Address, checkGraveyard, raw bool) (*object.Object, error) {
obj := object.New() obj := object.New()
key := objectKey(addr.ObjectID()) key := objectKey(addr.ObjectID())
cid := addr.ContainerID() cid := addr.ContainerID()

View file

@ -5,7 +5,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )
@ -13,7 +13,7 @@ import (
type Grave struct { type Grave struct {
gcMark bool gcMark bool
addr *object.Address addr *addressSDK.Address
} }
// WithGCMark returns true if grave marked for GC to be removed. // WithGCMark returns true if grave marked for GC to be removed.
@ -22,7 +22,7 @@ func (g *Grave) WithGCMark() bool {
} }
// Address returns buried object address. // Address returns buried object address.
func (g *Grave) Address() *object.Address { func (g *Grave) Address() *addressSDK.Address {
return g.addr return g.addr
} }

View file

@ -4,7 +4,7 @@ import (
"testing" "testing"
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase" meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -42,7 +42,7 @@ func TestDB_IterateOverGraveyard(t *testing.T) {
var ( var (
counterAll int counterAll int
buriedTS, buriedGC []*object.Address buriedTS, buriedGC []*addressSDK.Address
) )
err = db.IterateOverGraveyard(func(g *meta.Grave) error { err = db.IterateOverGraveyard(func(g *meta.Grave) error {
@ -60,6 +60,6 @@ func TestDB_IterateOverGraveyard(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, 2, counterAll) require.Equal(t, 2, counterAll)
require.Equal(t, []*object.Address{obj1.Object().Address()}, buriedTS) require.Equal(t, []*addressSDK.Address{obj1.Object().Address()}, buriedTS)
require.Equal(t, []*object.Address{obj2.Object().Address()}, buriedGC) require.Equal(t, []*addressSDK.Address{obj2.Object().Address()}, buriedGC)
} }

View file

@ -6,21 +6,22 @@ import (
"fmt" "fmt"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )
// InhumePrm encapsulates parameters for Inhume operation. // InhumePrm encapsulates parameters for Inhume operation.
type InhumePrm struct { type InhumePrm struct {
tomb *objectSDK.Address tomb *addressSDK.Address
target []*objectSDK.Address target []*addressSDK.Address
} }
// InhumeRes encapsulates results of Inhume operation. // InhumeRes encapsulates results of Inhume operation.
type InhumeRes struct{} type InhumeRes struct{}
// WithAddresses sets list of object addresses that should be inhumed. // WithAddresses sets list of object addresses that should be inhumed.
func (p *InhumePrm) WithAddresses(addrs ...*objectSDK.Address) *InhumePrm { func (p *InhumePrm) WithAddresses(addrs ...*addressSDK.Address) *InhumePrm {
if p != nil { if p != nil {
p.target = addrs p.target = addrs
} }
@ -32,7 +33,7 @@ func (p *InhumePrm) WithAddresses(addrs ...*objectSDK.Address) *InhumePrm {
// //
// addr should not be nil. // addr should not be nil.
// Should not be called along with WithGCMark. // Should not be called along with WithGCMark.
func (p *InhumePrm) WithTombstoneAddress(addr *objectSDK.Address) *InhumePrm { func (p *InhumePrm) WithTombstoneAddress(addr *addressSDK.Address) *InhumePrm {
if p != nil { if p != nil {
p.tomb = addr p.tomb = addr
} }
@ -54,7 +55,7 @@ func (p *InhumePrm) WithGCMark() *InhumePrm {
// Inhume inhumes the object by specified address. // Inhume inhumes the object by specified address.
// //
// tomb should not be nil. // tomb should not be nil.
func Inhume(db *DB, target, tomb *objectSDK.Address) error { func Inhume(db *DB, target, tomb *addressSDK.Address) error {
_, err := db.Inhume(new(InhumePrm). _, err := db.Inhume(new(InhumePrm).
WithAddresses(target). WithAddresses(target).
WithTombstoneAddress(tomb), WithTombstoneAddress(tomb),

View file

@ -8,6 +8,8 @@ import (
objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object" objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )
@ -15,7 +17,7 @@ import (
type ExpiredObject struct { type ExpiredObject struct {
typ object.Type typ object.Type
addr *object.Address addr *addressSDK.Address
} }
// Type returns type of the expired object. // Type returns type of the expired object.
@ -24,7 +26,7 @@ func (e *ExpiredObject) Type() object.Type {
} }
// Address returns address of the expired object. // Address returns address of the expired object.
func (e *ExpiredObject) Address() *object.Address { func (e *ExpiredObject) Address() *addressSDK.Address {
return e.addr return e.addr
} }
@ -67,7 +69,7 @@ func (db *DB) iterateExpired(tx *bbolt.Tx, epoch uint64, h ExpiredObjectHandler)
} }
return bktExpired.ForEach(func(idKey, _ []byte) error { return bktExpired.ForEach(func(idKey, _ []byte) error {
id := object.NewID() id := oidSDK.NewID()
err = id.Parse(string(idKey)) err = id.Parse(string(idKey))
if err != nil { if err != nil {
@ -81,7 +83,7 @@ func (db *DB) iterateExpired(tx *bbolt.Tx, epoch uint64, h ExpiredObjectHandler)
return fmt.Errorf("could not parse container ID of expired bucket: %w", err) return fmt.Errorf("could not parse container ID of expired bucket: %w", err)
} }
addr := object.NewAddress() addr := addressSDK.NewAddress()
addr.SetContainerID(cnrID) addr.SetContainerID(cnrID)
addr.SetObjectID(id) addr.SetObjectID(id)
@ -118,13 +120,13 @@ func objectType(tx *bbolt.Tx, cid *cid.ID, oidBytes []byte) object.Type {
// Returns other errors of h directly. // Returns other errors of h directly.
// //
// Does not modify tss. // Does not modify tss.
func (db *DB) IterateCoveredByTombstones(tss map[string]struct{}, h func(*object.Address) error) error { func (db *DB) IterateCoveredByTombstones(tss map[string]struct{}, h func(*addressSDK.Address) error) error {
return db.boltDB.View(func(tx *bbolt.Tx) error { return db.boltDB.View(func(tx *bbolt.Tx) error {
return db.iterateCoveredByTombstones(tx, tss, h) return db.iterateCoveredByTombstones(tx, tss, h)
}) })
} }
func (db *DB) iterateCoveredByTombstones(tx *bbolt.Tx, tss map[string]struct{}, h func(*object.Address) error) error { func (db *DB) iterateCoveredByTombstones(tx *bbolt.Tx, tss map[string]struct{}, h func(*addressSDK.Address) error) error {
bktGraveyard := tx.Bucket(graveyardBucketName) bktGraveyard := tx.Bucket(graveyardBucketName)
if bktGraveyard == nil { if bktGraveyard == nil {
return nil return nil

View file

@ -7,6 +7,7 @@ import (
objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object" objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object"
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase" meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -15,8 +16,8 @@ func TestDB_IterateExpired(t *testing.T) {
const epoch = 13 const epoch = 13
mAlive := map[object.Type]*object.Address{} mAlive := map[object.Type]*addressSDK.Address{}
mExpired := map[object.Type]*object.Address{} mExpired := map[object.Type]*addressSDK.Address{}
for _, typ := range []object.Type{ for _, typ := range []object.Type{
object.TypeRegular, object.TypeRegular,
@ -45,7 +46,7 @@ func TestDB_IterateExpired(t *testing.T) {
require.Empty(t, mExpired) require.Empty(t, mExpired)
} }
func putWithExpiration(t *testing.T, db *meta.DB, typ object.Type, expiresAt uint64) *object.Address { func putWithExpiration(t *testing.T, db *meta.DB, typ object.Type, expiresAt uint64) *addressSDK.Address {
raw := generateRawObject(t) raw := generateRawObject(t)
raw.SetType(typ) raw.SetType(typ)
addAttribute(raw, objectV2.SysAttributeExpEpoch, strconv.FormatUint(expiresAt, 10)) addAttribute(raw, objectV2.SysAttributeExpEpoch, strconv.FormatUint(expiresAt, 10))
@ -79,13 +80,13 @@ func TestDB_IterateCoveredByTombstones(t *testing.T) {
WithGCMark(), WithGCMark(),
) )
var handled []*object.Address var handled []*addressSDK.Address
tss := map[string]struct{}{ tss := map[string]struct{}{
ts.String(): {}, ts.String(): {},
} }
err = db.IterateCoveredByTombstones(tss, func(addr *object.Address) error { err = db.IterateCoveredByTombstones(tss, func(addr *addressSDK.Address) error {
handled = append(handled, addr) handled = append(handled, addr)
return nil return nil
}) })

View file

@ -5,7 +5,7 @@ import (
"strings" "strings"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )
@ -42,12 +42,12 @@ func (l *ListPrm) WithCursor(cursor *Cursor) *ListPrm {
// ListRes contains values returned from ListWithCursor operation. // ListRes contains values returned from ListWithCursor operation.
type ListRes struct { type ListRes struct {
addrList []*object.Address addrList []*addressSDK.Address
cursor *Cursor cursor *Cursor
} }
// AddressList returns addresses selected by ListWithCursor operation. // AddressList returns addresses selected by ListWithCursor operation.
func (l ListRes) AddressList() []*object.Address { func (l ListRes) AddressList() []*addressSDK.Address {
return l.addrList return l.addrList
} }
@ -62,7 +62,7 @@ func (l ListRes) Cursor() *Cursor {
// //
// Returns ErrEndOfListing if there are no more objects to return or count // Returns ErrEndOfListing if there are no more objects to return or count
// parameter set to zero. // parameter set to zero.
func ListWithCursor(db *DB, count uint32, cursor *Cursor) ([]*object.Address, *Cursor, error) { func ListWithCursor(db *DB, count uint32, cursor *Cursor) ([]*addressSDK.Address, *Cursor, error) {
r, err := db.ListWithCursor(new(ListPrm).WithCount(count).WithCursor(cursor)) r, err := db.ListWithCursor(new(ListPrm).WithCount(count).WithCursor(cursor))
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
@ -87,9 +87,9 @@ func (db *DB) ListWithCursor(prm *ListPrm) (res *ListRes, err error) {
return res, err return res, err
} }
func (db *DB) listWithCursor(tx *bbolt.Tx, count int, cursor *Cursor) ([]*object.Address, *Cursor, error) { func (db *DB) listWithCursor(tx *bbolt.Tx, count int, cursor *Cursor) ([]*addressSDK.Address, *Cursor, error) {
threshold := cursor == nil // threshold is a flag to ignore cursor threshold := cursor == nil // threshold is a flag to ignore cursor
result := make([]*object.Address, 0, count) result := make([]*addressSDK.Address, 0, count)
var bucketName []byte var bucketName []byte
c := tx.Cursor() c := tx.Cursor()
@ -142,11 +142,11 @@ loop:
func selectNFromBucket(tx *bbolt.Tx, func selectNFromBucket(tx *bbolt.Tx,
name []byte, // bucket name name []byte, // bucket name
prefix string, // string of CID, optimization prefix string, // string of CID, optimization
to []*object.Address, // listing result to []*addressSDK.Address, // listing result
limit int, // stop listing at `limit` items in result limit int, // stop listing at `limit` items in result
cursor *Cursor, // start from cursor object cursor *Cursor, // start from cursor object
threshold bool, // ignore cursor and start immediately threshold bool, // ignore cursor and start immediately
) ([]*object.Address, *Cursor) { ) ([]*addressSDK.Address, *Cursor) {
bkt := tx.Bucket(name) bkt := tx.Bucket(name)
if bkt == nil { if bkt == nil {
return to, cursor return to, cursor
@ -171,7 +171,7 @@ func selectNFromBucket(tx *bbolt.Tx,
if count >= limit { if count >= limit {
break break
} }
a := object.NewAddress() a := addressSDK.NewAddress()
if err := a.Parse(prefix + string(k)); err != nil { if err := a.Parse(prefix + string(k)); err != nil {
break break
} }

View file

@ -8,6 +8,7 @@ import (
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase" meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test" cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -19,7 +20,7 @@ func TestLisObjectsWithCursor(t *testing.T) {
total = containers * 4 // regular + ts + sg + child total = containers * 4 // regular + ts + sg + child
) )
expected := make([]*objectSDK.Address, 0, total) expected := make([]*addressSDK.Address, 0, total)
// fill metabase with objects // fill metabase with objects
for i := 0; i < containers; i++ { for i := 0; i < containers; i++ {
@ -72,7 +73,7 @@ func TestLisObjectsWithCursor(t *testing.T) {
t.Run("success with various count", func(t *testing.T) { t.Run("success with various count", func(t *testing.T) {
for countPerReq := 1; countPerReq <= total; countPerReq++ { for countPerReq := 1; countPerReq <= total; countPerReq++ {
got := make([]*objectSDK.Address, 0, total) got := make([]*addressSDK.Address, 0, total)
res, cursor, err := meta.ListWithCursor(db, uint32(countPerReq), nil) res, cursor, err := meta.ListWithCursor(db, uint32(countPerReq), nil)
require.NoError(t, err, "count:%d", countPerReq) require.NoError(t, err, "count:%d", countPerReq)
@ -154,7 +155,7 @@ func TestAddObjectDuringListingWithCursor(t *testing.T) {
} }
func sortAddresses(addr []*objectSDK.Address) []*objectSDK.Address { func sortAddresses(addr []*addressSDK.Address) []*addressSDK.Address {
sort.Slice(addr, func(i, j int) bool { sort.Slice(addr, func(i, j int) bool {
return addr[i].String() < addr[j].String() return addr[i].String() < addr[j].String()
}) })

View file

@ -3,20 +3,20 @@ package meta
import ( import (
"fmt" "fmt"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )
// ToMoveItPrm groups the parameters of ToMoveIt operation. // ToMoveItPrm groups the parameters of ToMoveIt operation.
type ToMoveItPrm struct { type ToMoveItPrm struct {
addr *objectSDK.Address addr *addressSDK.Address
} }
// ToMoveItRes groups resulting values of ToMoveIt operation. // ToMoveItRes groups resulting values of ToMoveIt operation.
type ToMoveItRes struct{} type ToMoveItRes struct{}
// WithAddress sets address of the object to move into another shard. // 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 { if p != nil {
p.addr = addr p.addr = addr
} }
@ -26,14 +26,14 @@ func (p *ToMoveItPrm) WithAddress(addr *objectSDK.Address) *ToMoveItPrm {
// DoNotMovePrm groups the parameters of DoNotMove operation. // DoNotMovePrm groups the parameters of DoNotMove operation.
type DoNotMovePrm struct { type DoNotMovePrm struct {
addr *objectSDK.Address addr *addressSDK.Address
} }
// DoNotMoveRes groups resulting values of DoNotMove operation. // DoNotMoveRes groups resulting values of DoNotMove operation.
type DoNotMoveRes struct{} type DoNotMoveRes struct{}
// WithAddress sets address of the object to prevent moving into another shard. // 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 { if p != nil {
p.addr = addr p.addr = addr
} }
@ -46,16 +46,16 @@ type MovablePrm struct{}
// MovableRes groups resulting values of Movable operation. // MovableRes groups resulting values of Movable operation.
type MovableRes struct { type MovableRes struct {
addrList []*objectSDK.Address addrList []*addressSDK.Address
} }
// AddressList returns resulting addresses of Movable operation. // AddressList returns resulting addresses of Movable operation.
func (p *MovableRes) AddressList() []*objectSDK.Address { func (p *MovableRes) AddressList() []*addressSDK.Address {
return p.addrList return p.addrList
} }
// ToMoveIt marks object to move it into another shard. // 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)) _, err := db.ToMoveIt(new(ToMoveItPrm).WithAddress(addr))
return err 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. // 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)) _, err := db.DoNotMove(new(DoNotMovePrm).WithAddress(addr))
return err return err
} }
@ -96,7 +96,7 @@ func (db *DB) DoNotMove(prm *DoNotMovePrm) (res *DoNotMoveRes, err error) {
} }
// Movable returns all movable objects of DB. // 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)) r, err := db.Movable(new(MovablePrm))
if err != nil { if err != nil {
return nil, err 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 // 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 // more efficient to keep bolt db TX code smaller because it might be
// bottleneck. // bottleneck.
addrs := make([]*objectSDK.Address, 0, len(strAddrs)) addrs := make([]*addressSDK.Address, 0, len(strAddrs))
for i := range strAddrs { for i := range strAddrs {
addr, err := addressFromKey([]byte(strAddrs[i])) addr, err := addressFromKey([]byte(strAddrs[i]))

View file

@ -9,6 +9,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/util" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/util"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )
@ -377,7 +378,7 @@ func decodeList(data []byte) (lst [][]byte, err error) {
// updateBlobovniczaID for existing objects if they were moved from from // updateBlobovniczaID for existing objects if they were moved from from
// one blobovnicza to another. // one blobovnicza to another.
func updateBlobovniczaID(tx *bbolt.Tx, addr *objectSDK.Address, id *blobovnicza.ID) error { func updateBlobovniczaID(tx *bbolt.Tx, addr *addressSDK.Address, id *blobovnicza.ID) error {
bkt, err := tx.CreateBucketIfNotExists(smallBucketName(addr.ContainerID())) bkt, err := tx.CreateBucketIfNotExists(smallBucketName(addr.ContainerID()))
if err != nil { if err != nil {
return err return err
@ -388,7 +389,7 @@ func updateBlobovniczaID(tx *bbolt.Tx, addr *objectSDK.Address, id *blobovnicza.
// updateSpliInfo for existing objects if storage filled with extra information // updateSpliInfo for existing objects if storage filled with extra information
// about last object in split hierarchy or linking object. // about last object in split hierarchy or linking object.
func updateSplitInfo(tx *bbolt.Tx, addr *objectSDK.Address, from *objectSDK.SplitInfo) error { func updateSplitInfo(tx *bbolt.Tx, addr *addressSDK.Address, from *objectSDK.SplitInfo) error {
bkt := tx.Bucket(rootBucketName(addr.ContainerID())) bkt := tx.Bucket(rootBucketName(addr.ContainerID()))
if bkt == nil { if bkt == nil {
// if object doesn't exists and we want to update split info on it // if object doesn't exists and we want to update split info on it

View file

@ -9,6 +9,7 @@ import (
v2object "github.com/nspcc-dev/neofs-api-go/v2/object" v2object "github.com/nspcc-dev/neofs-api-go/v2/object"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -33,7 +34,7 @@ type SelectPrm struct {
// SelectRes groups resulting values of Select operation. // SelectRes groups resulting values of Select operation.
type SelectRes struct { type SelectRes struct {
addrList []*object.Address addrList []*addressSDK.Address
} }
// WithContainerID is a Select option to set the container id to search in. // WithContainerID is a Select option to set the container id to search in.
@ -55,14 +56,14 @@ func (p *SelectPrm) WithFilters(fs object.SearchFilters) *SelectPrm {
} }
// AddressList returns list of addresses of the selected objects. // AddressList returns list of addresses of the selected objects.
func (r *SelectRes) AddressList() []*object.Address { func (r *SelectRes) AddressList() []*addressSDK.Address {
return r.addrList return r.addrList
} }
var ErrMissingContainerID = errors.New("missing container id field") var ErrMissingContainerID = errors.New("missing container id field")
// Select selects the objects from DB with filtering. // Select selects the objects from DB with filtering.
func Select(db *DB, cid *cid.ID, fs object.SearchFilters) ([]*object.Address, error) { func Select(db *DB, cid *cid.ID, fs object.SearchFilters) ([]*addressSDK.Address, error) {
r, err := db.Select(new(SelectPrm).WithFilters(fs).WithContainerID(cid)) r, err := db.Select(new(SelectPrm).WithFilters(fs).WithContainerID(cid))
if err != nil { if err != nil {
return nil, err return nil, err
@ -86,7 +87,7 @@ func (db *DB) Select(prm *SelectPrm) (res *SelectRes, err error) {
}) })
} }
func (db *DB) selectObjects(tx *bbolt.Tx, cid *cid.ID, fs object.SearchFilters) ([]*object.Address, error) { func (db *DB) selectObjects(tx *bbolt.Tx, cid *cid.ID, fs object.SearchFilters) ([]*addressSDK.Address, error) {
if cid == nil { if cid == nil {
return nil, ErrMissingContainerID return nil, ErrMissingContainerID
} }
@ -118,7 +119,7 @@ func (db *DB) selectObjects(tx *bbolt.Tx, cid *cid.ID, fs object.SearchFilters)
} }
} }
res := make([]*object.Address, 0, len(mAddr)) res := make([]*addressSDK.Address, 0, len(mAddr))
for a, ind := range mAddr { for a, ind := range mAddr {
if ind != expLen { if ind != expLen {
@ -490,7 +491,7 @@ func (db *DB) selectObjectID(
} }
// matchSlowFilters return true if object header is matched by all slow filters. // matchSlowFilters return true if object header is matched by all slow filters.
func (db *DB) matchSlowFilters(tx *bbolt.Tx, addr *object.Address, f object.SearchFilters) bool { func (db *DB) matchSlowFilters(tx *bbolt.Tx, addr *addressSDK.Address, f object.SearchFilters) bool {
if len(f) == 0 { if len(f) == 0 {
return true return true
} }

View file

@ -8,6 +8,7 @@ import (
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase" meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test" cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"github.com/nspcc-dev/neofs-sdk-go/version" "github.com/nspcc-dev/neofs-sdk-go/version"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -320,7 +321,7 @@ func TestDB_SelectInhume(t *testing.T) {
raw2.Object().Address(), raw2.Object().Address(),
) )
tombstone := objectSDK.NewAddress() tombstone := addressSDK.NewAddress()
tombstone.SetContainerID(cid) tombstone.SetContainerID(cid)
tombstone.SetObjectID(testOID()) tombstone.SetObjectID(testOID())

View file

@ -3,13 +3,13 @@ package meta
import ( import (
"github.com/nspcc-dev/neo-go/pkg/util/slice" "github.com/nspcc-dev/neo-go/pkg/util/slice"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )
// IsSmallPrm groups the parameters of IsSmall operation. // IsSmallPrm groups the parameters of IsSmall operation.
type IsSmallPrm struct { type IsSmallPrm struct {
addr *objectSDK.Address addr *addressSDK.Address
} }
// IsSmallRes groups resulting values of IsSmall operation. // IsSmallRes groups resulting values of IsSmall operation.
@ -18,7 +18,7 @@ type IsSmallRes struct {
} }
// WithAddress is a IsSmall option to set the object address to check. // WithAddress is a IsSmall option to set the object address to check.
func (p *IsSmallPrm) WithAddress(addr *objectSDK.Address) *IsSmallPrm { func (p *IsSmallPrm) WithAddress(addr *addressSDK.Address) *IsSmallPrm {
if p != nil { if p != nil {
p.addr = addr p.addr = addr
} }
@ -34,7 +34,7 @@ func (r *IsSmallRes) BlobovniczaID() *blobovnicza.ID {
// IsSmall wraps work with DB.IsSmall method with specified // IsSmall wraps work with DB.IsSmall method with specified
// address and other parameters by default. Returns only // address and other parameters by default. Returns only
// the blobovnicza identifier. // the blobovnicza identifier.
func IsSmall(db *DB, addr *objectSDK.Address) (*blobovnicza.ID, error) { func IsSmall(db *DB, addr *addressSDK.Address) (*blobovnicza.ID, error) {
r, err := db.IsSmall(new(IsSmallPrm).WithAddress(addr)) r, err := db.IsSmall(new(IsSmallPrm).WithAddress(addr))
if err != nil { if err != nil {
return nil, err return nil, err
@ -59,7 +59,7 @@ func (db *DB) IsSmall(prm *IsSmallPrm) (res *IsSmallRes, err error) {
return return
} }
func (db *DB) isSmall(tx *bbolt.Tx, addr *objectSDK.Address) (*blobovnicza.ID, error) { func (db *DB) isSmall(tx *bbolt.Tx, addr *addressSDK.Address) (*blobovnicza.ID, error) {
smallBucket := tx.Bucket(smallBucketName(addr.ContainerID())) smallBucket := tx.Bucket(smallBucketName(addr.ContainerID()))
if smallBucket == nil { if smallBucket == nil {
return nil, nil return nil, nil

View file

@ -6,6 +6,8 @@ import (
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )
@ -105,18 +107,18 @@ func splitBucketName(cid *cid.ID) []byte {
} }
// addressKey returns key for K-V tables when key is a whole address. // addressKey returns key for K-V tables when key is a whole address.
func addressKey(addr *object.Address) []byte { func addressKey(addr *addressSDK.Address) []byte {
return []byte(addr.String()) return []byte(addr.String())
} }
// parses object address formed by addressKey. // parses object address formed by addressKey.
func addressFromKey(k []byte) (*object.Address, error) { func addressFromKey(k []byte) (*addressSDK.Address, error) {
a := object.NewAddress() a := addressSDK.NewAddress()
return a, a.Parse(string(k)) return a, a.Parse(string(k))
} }
// objectKey returns key for K-V tables when key is an object id. // objectKey returns key for K-V tables when key is an object id.
func objectKey(oid *object.ID) []byte { func objectKey(oid *oidSDK.ID) []byte {
return []byte(oid.String()) return []byte(oid.String())
} }

View file

@ -9,6 +9,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor"
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase" meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
// Open opens all Shard's components. // Open opens all Shard's components.
@ -91,14 +92,14 @@ func (s *Shard) refillMetabase() error {
tombAddr := obj.Address() tombAddr := obj.Address()
cid := tombAddr.ContainerID() cid := tombAddr.ContainerID()
memberIDs := tombstone.Members() memberIDs := tombstone.Members()
tombMembers := make([]*objectSDK.Address, 0, len(memberIDs)) tombMembers := make([]*addressSDK.Address, 0, len(memberIDs))
for _, id := range memberIDs { for _, id := range memberIDs {
if id == nil { if id == nil {
return errors.New("empty member in tombstone") return errors.New("empty member in tombstone")
} }
a := objectSDK.NewAddress() a := addressSDK.NewAddress()
a.SetContainerID(cid) a.SetContainerID(cid)
a.SetObjectID(id) a.SetObjectID(id)

View file

@ -9,6 +9,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor"
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase" meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
objecttest "github.com/nspcc-dev/neofs-sdk-go/object/test" objecttest "github.com/nspcc-dev/neofs-sdk-go/object/test"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -41,7 +42,7 @@ func TestRefillMetabase(t *testing.T) {
type objAddr struct { type objAddr struct {
obj *object.Object obj *object.Object
addr *objectSDK.Address addr *addressSDK.Address
} }
mObjs := make(map[string]objAddr) mObjs := make(map[string]objAddr)
@ -72,10 +73,10 @@ func TestRefillMetabase(t *testing.T) {
tombObj := tombObjRaw.Object() tombObj := tombObjRaw.Object()
tombMembers := make([]*objectSDK.Address, 0, len(tombstone.Members())) tombMembers := make([]*addressSDK.Address, 0, len(tombstone.Members()))
for _, member := range tombstone.Members() { for _, member := range tombstone.Members() {
a := objectSDK.NewAddress() a := addressSDK.NewAddress()
a.SetObjectID(member) a.SetObjectID(member)
a.SetContainerID(tombObj.ContainerID()) a.SetContainerID(tombObj.ContainerID())
@ -97,7 +98,7 @@ func TestRefillMetabase(t *testing.T) {
var headPrm HeadPrm var headPrm HeadPrm
checkObj := func(addr *objectSDK.Address, expObj *object.Object) { checkObj := func(addr *addressSDK.Address, expObj *object.Object) {
res, err := sh.Head(headPrm.WithAddress(addr)) res, err := sh.Head(headPrm.WithAddress(addr))
if expObj == nil { if expObj == nil {

View file

@ -7,13 +7,13 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor"
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase" meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.uber.org/zap" "go.uber.org/zap"
) )
// DeletePrm groups the parameters of Delete operation. // DeletePrm groups the parameters of Delete operation.
type DeletePrm struct { type DeletePrm struct {
addr []*objectSDK.Address addr []*addressSDK.Address
} }
// DeleteRes groups resulting values of Delete operation. // DeleteRes groups resulting values of Delete operation.
@ -22,7 +22,7 @@ type DeleteRes struct{}
// WithAddresses is a Delete option to set the addresses of the objects to delete. // WithAddresses is a Delete option to set the addresses of the objects to delete.
// //
// Option is required. // Option is required.
func (p *DeletePrm) WithAddresses(addr ...*objectSDK.Address) *DeletePrm { func (p *DeletePrm) WithAddresses(addr ...*addressSDK.Address) *DeletePrm {
if p != nil { if p != nil {
p.addr = append(p.addr, addr...) p.addr = append(p.addr, addr...)
} }
@ -41,7 +41,7 @@ func (s *Shard) Delete(prm *DeletePrm) (*DeleteRes, error) {
delSmallPrm := new(blobstor.DeleteSmallPrm) delSmallPrm := new(blobstor.DeleteSmallPrm)
delBigPrm := new(blobstor.DeleteBigPrm) delBigPrm := new(blobstor.DeleteBigPrm)
smalls := make(map[*objectSDK.Address]*blobovnicza.ID, ln) smalls := make(map[*addressSDK.Address]*blobovnicza.ID, ln)
for i := range prm.addr { for i := range prm.addr {
if s.hasWriteCache() { if s.hasWriteCache() {

View file

@ -18,8 +18,8 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/writecache" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/writecache"
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test" cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
objecttest "github.com/nspcc-dev/neofs-sdk-go/object/test" objecttest "github.com/nspcc-dev/neofs-sdk-go/object/id/test"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -327,7 +327,7 @@ func TestDumpIgnoreErrors(t *testing.T) {
// 2.2. Invalid object in valid blobovnicza. // 2.2. Invalid object in valid blobovnicza.
prm := new(blobovnicza.PutPrm) prm := new(blobovnicza.PutPrm)
prm.SetAddress(objectSDK.NewAddress()) prm.SetAddress(addressSDK.NewAddress())
prm.SetMarshaledObject(corruptedData) prm.SetMarshaledObject(corruptedData)
b := blobovnicza.New(blobovnicza.WithPath(filepath.Join(bTree, "1", "2"))) b := blobovnicza.New(blobovnicza.WithPath(filepath.Join(bTree, "1", "2")))
require.NoError(t, b.Open()) require.NoError(t, b.Open())

View file

@ -2,12 +2,12 @@ package shard
import ( import (
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase" meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
// ExistsPrm groups the parameters of Exists operation. // ExistsPrm groups the parameters of Exists operation.
type ExistsPrm struct { type ExistsPrm struct {
addr *object.Address addr *addressSDK.Address
} }
// ExistsRes groups resulting values of Exists operation. // ExistsRes groups resulting values of Exists operation.
@ -16,7 +16,7 @@ type ExistsRes struct {
} }
// WithAddress is an Exists option to set object checked for existence. // WithAddress is an Exists option to set object checked for existence.
func (p *ExistsPrm) WithAddress(addr *object.Address) *ExistsPrm { func (p *ExistsPrm) WithAddress(addr *addressSDK.Address) *ExistsPrm {
if p != nil { if p != nil {
p.addr = addr p.addr = addr
} }
@ -41,6 +41,6 @@ func (s *Shard) Exists(prm *ExistsPrm) (*ExistsRes, error) {
}, err }, err
} }
func (s *Shard) objectExists(addr *object.Address) (bool, error) { func (s *Shard) objectExists(addr *addressSDK.Address) (bool, error) {
return meta.Exists(s.metaBase, addr) return meta.Exists(s.metaBase, addr)
} }

View file

@ -9,6 +9,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/util" "github.com/nspcc-dev/neofs-node/pkg/util"
"github.com/nspcc-dev/neofs-node/pkg/util/logger" "github.com/nspcc-dev/neofs-node/pkg/util/logger"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -177,7 +178,7 @@ func (s *Shard) removeGarbage() {
return return
} }
buf := make([]*object.Address, 0, s.rmBatchSize) buf := make([]*addressSDK.Address, 0, s.rmBatchSize)
// iterate over metabase graveyard and accumulate // iterate over metabase graveyard and accumulate
// objects with GC mark (no more the s.rmBatchSize objects) // objects with GC mark (no more the s.rmBatchSize objects)
@ -250,8 +251,8 @@ func (s *Shard) collectExpiredTombstones(ctx context.Context, e Event) {
s.expiredTombstonesCallback(ctx, expired) s.expiredTombstonesCallback(ctx, expired)
} }
func (s *Shard) getExpiredObjects(ctx context.Context, epoch uint64, collectTombstones bool) ([]*object.Address, error) { func (s *Shard) getExpiredObjects(ctx context.Context, epoch uint64, collectTombstones bool) ([]*addressSDK.Address, error) {
var expired []*object.Address var expired []*addressSDK.Address
err := s.metaBase.IterateExpired(epoch, func(expiredObject *meta.ExpiredObject) error { err := s.metaBase.IterateExpired(epoch, func(expiredObject *meta.ExpiredObject) error {
select { select {
@ -276,11 +277,11 @@ func (s *Shard) getExpiredObjects(ctx context.Context, epoch uint64, collectTomb
// //
// Does not modify tss. // Does not modify tss.
func (s *Shard) HandleExpiredTombstones(tss map[string]struct{}) { func (s *Shard) HandleExpiredTombstones(tss map[string]struct{}) {
inhume := make([]*object.Address, 0, len(tss)) inhume := make([]*addressSDK.Address, 0, len(tss))
// Collect all objects covered by the tombstones. // Collect all objects covered by the tombstones.
err := s.metaBase.IterateCoveredByTombstones(tss, func(addr *object.Address) error { err := s.metaBase.IterateCoveredByTombstones(tss, func(addr *addressSDK.Address) error {
inhume = append(inhume, addr) inhume = append(inhume, addr)
return nil return nil
}) })
@ -319,7 +320,7 @@ func (s *Shard) HandleExpiredTombstones(tss map[string]struct{}) {
for strAddr := range tss { for strAddr := range tss {
// parse address // parse address
// TODO: make type of map values *object.Address since keys are calculated from addresses // TODO: make type of map values *object.Address since keys are calculated from addresses
addr := object.NewAddress() addr := addressSDK.NewAddress()
err = addr.Parse(strAddr) err = addr.Parse(strAddr)
if err != nil { if err != nil {

View file

@ -8,7 +8,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor"
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase" meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -18,7 +18,7 @@ type storFetcher = func(stor *blobstor.BlobStor, id *blobovnicza.ID) (*object.Ob
// GetPrm groups the parameters of Get operation. // GetPrm groups the parameters of Get operation.
type GetPrm struct { type GetPrm struct {
addr *objectSDK.Address addr *addressSDK.Address
} }
// GetRes groups resulting values of Get operation. // GetRes groups resulting values of Get operation.
@ -29,7 +29,7 @@ type GetRes struct {
// WithAddress is a Get option to set the address of the requested object. // WithAddress is a Get option to set the address of the requested object.
// //
// Option is required. // Option is required.
func (p *GetPrm) WithAddress(addr *objectSDK.Address) *GetPrm { func (p *GetPrm) WithAddress(addr *addressSDK.Address) *GetPrm {
if p != nil { if p != nil {
p.addr = addr p.addr = addr
} }
@ -84,7 +84,7 @@ func (s *Shard) Get(prm *GetPrm) (*GetRes, error) {
} }
// fetchObjectData looks through writeCache and blobStor to find object. // fetchObjectData looks through writeCache and blobStor to find object.
func (s *Shard) fetchObjectData(addr *objectSDK.Address, big, small storFetcher) (*object.Object, error) { func (s *Shard) fetchObjectData(addr *addressSDK.Address, big, small storFetcher) (*object.Object, error) {
var ( var (
err error err error
res *object.Object res *object.Object

View file

@ -6,12 +6,12 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase" meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
// HeadPrm groups the parameters of Head operation. // HeadPrm groups the parameters of Head operation.
type HeadPrm struct { type HeadPrm struct {
addr *objectSDK.Address addr *addressSDK.Address
raw bool raw bool
} }
@ -23,7 +23,7 @@ type HeadRes struct {
// WithAddress is a Head option to set the address of the requested object. // WithAddress is a Head option to set the address of the requested object.
// //
// Option is required. // Option is required.
func (p *HeadPrm) WithAddress(addr *objectSDK.Address) *HeadPrm { func (p *HeadPrm) WithAddress(addr *addressSDK.Address) *HeadPrm {
if p != nil { if p != nil {
p.addr = addr p.addr = addr
} }

View file

@ -2,14 +2,14 @@ package shard
import ( import (
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase" meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.uber.org/zap" "go.uber.org/zap"
) )
// InhumePrm encapsulates parameters for inhume operation. // InhumePrm encapsulates parameters for inhume operation.
type InhumePrm struct { type InhumePrm struct {
target []*objectSDK.Address target []*addressSDK.Address
tombstone *objectSDK.Address tombstone *addressSDK.Address
} }
// InhumeRes encapsulates results of inhume operation. // InhumeRes encapsulates results of inhume operation.
@ -20,7 +20,7 @@ type InhumeRes struct{}
// //
// tombstone should not be nil, addr should not be empty. // tombstone should not be nil, addr should not be empty.
// Should not be called along with MarkAsGarbage. // Should not be called along with MarkAsGarbage.
func (p *InhumePrm) WithTarget(tombstone *objectSDK.Address, addrs ...*objectSDK.Address) *InhumePrm { func (p *InhumePrm) WithTarget(tombstone *addressSDK.Address, addrs ...*addressSDK.Address) *InhumePrm {
if p != nil { if p != nil {
p.target = addrs p.target = addrs
p.tombstone = tombstone p.tombstone = tombstone
@ -32,7 +32,7 @@ func (p *InhumePrm) WithTarget(tombstone *objectSDK.Address, addrs ...*objectSDK
// MarkAsGarbage marks object to be physically removed from shard. // MarkAsGarbage marks object to be physically removed from shard.
// //
// Should not be called along with WithTarget. // Should not be called along with WithTarget.
func (p *InhumePrm) MarkAsGarbage(addr ...*objectSDK.Address) *InhumePrm { func (p *InhumePrm) MarkAsGarbage(addr ...*addressSDK.Address) *InhumePrm {
if p != nil { if p != nil {
p.target = addr p.target = addr
p.tombstone = nil p.tombstone = nil

View file

@ -6,6 +6,7 @@ import (
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase" meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -35,7 +36,7 @@ type ListWithCursorPrm struct {
// ListWithCursorRes contains values returned from ListWithCursor operation. // ListWithCursorRes contains values returned from ListWithCursor operation.
type ListWithCursorRes struct { type ListWithCursorRes struct {
addrList []*object.Address addrList []*addressSDK.Address
cursor *Cursor cursor *Cursor
} }
@ -54,7 +55,7 @@ func (p *ListWithCursorPrm) WithCursor(cursor *Cursor) *ListWithCursorPrm {
} }
// AddressList returns addresses selected by ListWithCursor operation. // AddressList returns addresses selected by ListWithCursor operation.
func (r ListWithCursorRes) AddressList() []*object.Address { func (r ListWithCursorRes) AddressList() []*addressSDK.Address {
return r.addrList return r.addrList
} }
@ -135,7 +136,7 @@ func (s *Shard) ListWithCursor(prm *ListWithCursorPrm) (*ListWithCursorRes, erro
// //
// Returns ErrEndOfListing if there are no more objects to return or count // Returns ErrEndOfListing if there are no more objects to return or count
// parameter set to zero. // parameter set to zero.
func ListWithCursor(s *Shard, count uint32, cursor *Cursor) ([]*object.Address, *Cursor, error) { func ListWithCursor(s *Shard, count uint32, cursor *Cursor) ([]*addressSDK.Address, *Cursor, error) {
prm := new(ListWithCursorPrm).WithCount(count).WithCursor(cursor) prm := new(ListWithCursorPrm).WithCount(count).WithCursor(cursor)
res, err := s.ListWithCursor(prm) res, err := s.ListWithCursor(prm)
if err != nil { if err != nil {

View file

@ -2,13 +2,13 @@ package shard
import ( import (
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase" meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.uber.org/zap" "go.uber.org/zap"
) )
// ToMoveItPrm encapsulates parameters for ToMoveIt operation. // ToMoveItPrm encapsulates parameters for ToMoveIt operation.
type ToMoveItPrm struct { type ToMoveItPrm struct {
addr *objectSDK.Address addr *addressSDK.Address
} }
// ToMoveItRes encapsulates results of ToMoveIt operation. // ToMoveItRes encapsulates results of ToMoveIt operation.
@ -16,7 +16,7 @@ type ToMoveItRes struct{}
// WithAddress sets object address that should be marked to move into another // WithAddress sets object address that should be marked to move into another
// shard. // shard.
func (p *ToMoveItPrm) WithAddress(addr *objectSDK.Address) *ToMoveItPrm { func (p *ToMoveItPrm) WithAddress(addr *addressSDK.Address) *ToMoveItPrm {
if p != nil { if p != nil {
p.addr = addr p.addr = addr
} }

View file

@ -5,6 +5,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
// RngPrm groups the parameters of GetRange operation. // RngPrm groups the parameters of GetRange operation.
@ -13,7 +14,7 @@ type RngPrm struct {
off uint64 off uint64
addr *objectSDK.Address addr *addressSDK.Address
} }
// RngRes groups resulting values of GetRange operation. // RngRes groups resulting values of GetRange operation.
@ -24,7 +25,7 @@ type RngRes struct {
// WithAddress is a Rng option to set the address of the requested object. // WithAddress is a Rng option to set the address of the requested object.
// //
// Option is required. // Option is required.
func (p *RngPrm) WithAddress(addr *objectSDK.Address) *RngPrm { func (p *RngPrm) WithAddress(addr *addressSDK.Address) *RngPrm {
if p != nil { if p != nil {
p.addr = addr p.addr = addr
} }

View file

@ -6,6 +6,7 @@ import (
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase" meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
) )
// SelectPrm groups the parameters of Select operation. // SelectPrm groups the parameters of Select operation.
@ -16,7 +17,7 @@ type SelectPrm struct {
// SelectRes groups resulting values of Select operation. // SelectRes groups resulting values of Select operation.
type SelectRes struct { type SelectRes struct {
addrList []*objectSDK.Address addrList []*addressSDK.Address
} }
// WithContainerID is a Select option to set the container id to search in. // WithContainerID is a Select option to set the container id to search in.
@ -38,7 +39,7 @@ func (p *SelectPrm) WithFilters(fs objectSDK.SearchFilters) *SelectPrm {
} }
// AddressList returns list of addresses of the selected objects. // AddressList returns list of addresses of the selected objects.
func (r *SelectRes) AddressList() []*objectSDK.Address { func (r *SelectRes) AddressList() []*addressSDK.Address {
return r.addrList return r.addrList
} }

View file

@ -10,7 +10,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/writecache" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/writecache"
"github.com/nspcc-dev/neofs-node/pkg/util" "github.com/nspcc-dev/neofs-node/pkg/util"
"github.com/nspcc-dev/neofs-node/pkg/util/logger" "github.com/nspcc-dev/neofs-node/pkg/util/logger"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -31,7 +31,7 @@ type Shard struct {
type Option func(*cfg) type Option func(*cfg)
// ExpiredObjectsCallback is a callback handling list of expired objects. // ExpiredObjectsCallback is a callback handling list of expired objects.
type ExpiredObjectsCallback func(context.Context, []*object.Address) type ExpiredObjectsCallback func(context.Context, []*addressSDK.Address)
type cfg struct { type cfg struct {
m sync.RWMutex m sync.RWMutex

View file

@ -18,6 +18,7 @@ import (
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test" cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/nspcc-dev/neofs-sdk-go/owner" "github.com/nspcc-dev/neofs-sdk-go/owner"
ownertest "github.com/nspcc-dev/neofs-sdk-go/owner/test" ownertest "github.com/nspcc-dev/neofs-sdk-go/owner/test"
"github.com/nspcc-dev/neofs-sdk-go/version" "github.com/nspcc-dev/neofs-sdk-go/version"
@ -122,11 +123,11 @@ func addPayload(obj *object.RawObject, size int) {
obj.SetPayloadSize(uint64(size)) obj.SetPayloadSize(uint64(size))
} }
func generateOID() *objectSDK.ID { func generateOID() *oidSDK.ID {
cs := [sha256.Size]byte{} cs := [sha256.Size]byte{}
_, _ = rand.Read(cs[:]) _, _ = rand.Read(cs[:])
id := objectSDK.NewID() id := oidSDK.NewID()
id.SetSHA256(cs) id.SetSHA256(cs)
return id return id

View file

@ -7,6 +7,7 @@ import (
"github.com/google/uuid" "github.com/google/uuid"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/util" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/util"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -18,8 +19,8 @@ func TestMergeSplitInfo(t *testing.T) {
splitID.SetUUID(uid) splitID.SetUUID(uid)
var rawLinkID, rawLastID [32]byte var rawLinkID, rawLastID [32]byte
linkID := object.NewID() linkID := oidSDK.NewID()
lastID := object.NewID() lastID := oidSDK.NewID()
_, err = rand.Read(rawLinkID[:]) _, err = rand.Read(rawLinkID[:])
require.NoError(t, err) require.NoError(t, err)

View file

@ -6,12 +6,12 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree"
storagelog "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/internal/log" storagelog "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/internal/log"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )
// Delete removes object from write-cache. // Delete removes object from write-cache.
func (c *cache) Delete(addr *objectSDK.Address) error { func (c *cache) Delete(addr *addressSDK.Address) error {
c.modeMtx.RLock() c.modeMtx.RLock()
defer c.modeMtx.RUnlock() defer c.modeMtx.RUnlock()
if c.mode == ModeReadOnly { if c.mode == ModeReadOnly {

View file

@ -10,7 +10,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree"
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase" meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -133,7 +133,7 @@ func (c *cache) flushBigObjects() {
} }
evictNum := 0 evictNum := 0
_ = c.fsTree.Iterate(new(fstree.IterationPrm).WithHandler(func(addr *objectSDK.Address, data []byte) error { _ = c.fsTree.Iterate(new(fstree.IterationPrm).WithHandler(func(addr *addressSDK.Address, data []byte) error {
sAddr := addr.String() sAddr := addr.String()
if _, ok := c.store.flushed.Peek(sAddr); ok { if _, ok := c.store.flushed.Peek(sAddr); ok {

View file

@ -2,12 +2,12 @@ package writecache
import ( import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )
// Get returns object from write-cache. // Get returns object from write-cache.
func (c *cache) Get(addr *objectSDK.Address) (*object.Object, error) { func (c *cache) Get(addr *addressSDK.Address) (*object.Object, error) {
saddr := addr.String() saddr := addr.String()
c.mtx.RLock() c.mtx.RLock()
@ -42,7 +42,7 @@ func (c *cache) Get(addr *objectSDK.Address) (*object.Object, error) {
} }
// Head returns object header from write-cache. // Head returns object header from write-cache.
func (c *cache) Head(addr *objectSDK.Address) (*object.Object, error) { func (c *cache) Head(addr *addressSDK.Address) (*object.Object, error) {
// TODO: easiest to implement solution is presented here, consider more efficient way, e.g.: // TODO: easiest to implement solution is presented here, consider more efficient way, e.g.:
// - provide header as common object.Object to Put, but marked to prevent correlation with full object // - provide header as common object.Object to Put, but marked to prevent correlation with full object
// (all write-cache logic will automatically spread to headers, except flushing) // (all write-cache logic will automatically spread to headers, except flushing)

View file

@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree"
"github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )
@ -53,7 +53,7 @@ func (c *cache) Iterate(prm *IterationPrm) error {
return err return err
} }
return c.fsTree.Iterate(new(fstree.IterationPrm).WithHandler(func(addr *object.Address, data []byte) error { return c.fsTree.Iterate(new(fstree.IterationPrm).WithHandler(func(addr *addressSDK.Address, data []byte) error {
if _, ok := c.flushed.Peek(addr.String()); ok { if _, ok := c.flushed.Peek(addr.String()); ok {
return nil return nil
} }
@ -67,18 +67,18 @@ func (c *cache) Iterate(prm *IterationPrm) error {
// Returns ErrNoDefaultBucket if there is no default bucket in db. // Returns ErrNoDefaultBucket if there is no default bucket in db.
// //
// DB must not be nil and should be opened. // DB must not be nil and should be opened.
func IterateDB(db *bbolt.DB, f func(*object.Address) error) error { func IterateDB(db *bbolt.DB, f func(*addressSDK.Address) error) error {
return db.View(func(tx *bbolt.Tx) error { return db.View(func(tx *bbolt.Tx) error {
b := tx.Bucket(defaultBucket) b := tx.Bucket(defaultBucket)
if b == nil { if b == nil {
return ErrNoDefaultBucket return ErrNoDefaultBucket
} }
var addr *object.Address var addr *addressSDK.Address
return b.ForEach(func(k, v []byte) error { return b.ForEach(func(k, v []byte) error {
if addr == nil { if addr == nil {
addr = object.NewAddress() addr = addressSDK.NewAddress()
} }
err := addr.Parse(string(k)) err := addr.Parse(string(k))

View file

@ -11,7 +11,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree"
storagelog "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/internal/log" storagelog "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/internal/log"
"github.com/nspcc-dev/neofs-node/pkg/util" "github.com/nspcc-dev/neofs-node/pkg/util"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -125,7 +125,7 @@ func (c *cache) deleteFromDisk(keys [][]byte) error {
var lastErr error var lastErr error
for i := range keys { for i := range keys {
addr := objectSDK.NewAddress() addr := addressSDK.NewAddress()
addrStr := string(keys[i]) addrStr := string(keys[i])
if err := addr.Parse(addrStr); err != nil { if err := addr.Parse(addrStr); err != nil {

View file

@ -5,7 +5,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -17,9 +17,9 @@ type Info struct {
// Cache represents write-cache for objects. // Cache represents write-cache for objects.
type Cache interface { type Cache interface {
Get(*objectSDK.Address) (*object.Object, error) Get(*addressSDK.Address) (*object.Object, error)
Head(*objectSDK.Address) (*object.Object, error) Head(*addressSDK.Address) (*object.Object, error)
Delete(*objectSDK.Address) error Delete(*addressSDK.Address) error
Iterate(*IterationPrm) error Iterate(*IterationPrm) error
Put(*object.Object) error Put(*object.Object) error
SetMode(Mode) SetMode(Mode)

View file

@ -11,6 +11,7 @@ import (
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/netmap" "github.com/nspcc-dev/neofs-sdk-go/netmap"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/nspcc-dev/neofs-sdk-go/storagegroup" "github.com/nspcc-dev/neofs-sdk-go/storagegroup"
"go.uber.org/atomic" "go.uber.org/atomic"
"go.uber.org/zap" "go.uber.org/zap"
@ -25,7 +26,7 @@ type Context struct {
report *audit.Report report *audit.Report
sgMembersMtx sync.RWMutex sgMembersMtx sync.RWMutex
sgMembersCache map[int][]*object.ID sgMembersCache map[int][]*oidSDK.ID
placementMtx sync.Mutex placementMtx sync.Mutex
placementCache map[string][]netmap.Nodes placementCache map[string][]netmap.Nodes
@ -56,7 +57,7 @@ type pairMemberInfo struct {
type gamePair struct { type gamePair struct {
n1, n2 *netmap.Node n1, n2 *netmap.Node
id *object.ID id *oidSDK.ID
rn1, rn2 []*object.Range rn1, rn2 []*object.Range
@ -84,14 +85,14 @@ type ContextPrm struct {
// component of communication with container nodes. // component of communication with container nodes.
type ContainerCommunicator interface { type ContainerCommunicator interface {
// Must return storage group structure stored in object from container. // Must return storage group structure stored in object from container.
GetSG(*audit.Task, *object.ID) (*storagegroup.StorageGroup, error) GetSG(*audit.Task, *oidSDK.ID) (*storagegroup.StorageGroup, error)
// Must return object header from the container node. // Must return object header from the container node.
GetHeader(*audit.Task, *netmap.Node, *object.ID, bool) (*object.Object, error) GetHeader(*audit.Task, *netmap.Node, *oidSDK.ID, bool) (*object.Object, error)
// Must return homomorphic Tillich-Zemor hash of payload range of the // Must return homomorphic Tillich-Zemor hash of payload range of the
// object stored in container node. // object stored in container node.
GetRangeHash(*audit.Task, *netmap.Node, *object.ID, *object.Range) ([]byte, error) GetRangeHash(*audit.Task, *netmap.Node, *oidSDK.ID, *object.Range) ([]byte, error)
} }
// NewContext creates, initializes and returns Context. // NewContext creates, initializes and returns Context.
@ -157,7 +158,7 @@ func (c *Context) containerID() *cid.ID {
func (c *Context) init() { func (c *Context) init() {
c.report = audit.NewReport(c.containerID()) c.report = audit.NewReport(c.containerID())
c.sgMembersCache = make(map[int][]*object.ID) c.sgMembersCache = make(map[int][]*oidSDK.ID)
c.placementCache = make(map[string][]netmap.Nodes) c.placementCache = make(map[string][]netmap.Nodes)
@ -199,7 +200,7 @@ func (c *Context) writeReport() {
} }
} }
func (c *Context) buildPlacement(id *object.ID) ([]netmap.Nodes, error) { func (c *Context) buildPlacement(id *oidSDK.ID) ([]netmap.Nodes, error) {
c.placementMtx.Lock() c.placementMtx.Lock()
defer c.placementMtx.Unlock() defer c.placementMtx.Unlock()
@ -223,7 +224,7 @@ func (c *Context) buildPlacement(id *object.ID) ([]netmap.Nodes, error) {
return nn, nil return nn, nil
} }
func (c *Context) objectSize(id *object.ID) uint64 { func (c *Context) objectSize(id *oidSDK.ID) uint64 {
c.headMtx.RLock() c.headMtx.RLock()
defer c.headMtx.RUnlock() defer c.headMtx.RUnlock()
@ -236,7 +237,7 @@ func (c *Context) objectSize(id *object.ID) uint64 {
return 0 return 0
} }
func (c *Context) objectHomoHash(id *object.ID) []byte { func (c *Context) objectHomoHash(id *oidSDK.ID) []byte {
c.headMtx.RLock() c.headMtx.RLock()
defer c.headMtx.RUnlock() defer c.headMtx.RUnlock()
@ -263,7 +264,7 @@ func (c *Context) updateHeadResponses(hdr *object.Object) {
} }
} }
func (c *Context) updateSGInfo(ind int, members []*object.ID) { func (c *Context) updateSGInfo(ind int, members []*oidSDK.ID) {
c.sgMembersMtx.Lock() c.sgMembersMtx.Lock()
defer c.sgMembersMtx.Unlock() defer c.sgMembersMtx.Unlock()

View file

@ -9,6 +9,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/util/rand" "github.com/nspcc-dev/neofs-node/pkg/util/rand"
"github.com/nspcc-dev/neofs-sdk-go/netmap" "github.com/nspcc-dev/neofs-sdk-go/netmap"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/nspcc-dev/tzhash/tz" "github.com/nspcc-dev/tzhash/tz"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -81,7 +82,7 @@ func (c *Context) distributeRanges(p *gamePair) {
} }
} }
func (c *Context) splitPayload(id *object.ID) []uint64 { func (c *Context) splitPayload(id *oidSDK.ID) []uint64 {
var ( var (
prev uint64 prev uint64
size = c.objectSize(id) size = c.objectSize(id)

View file

@ -3,7 +3,7 @@ package auditor
import ( import (
"github.com/nspcc-dev/neofs-sdk-go/client" "github.com/nspcc-dev/neofs-sdk-go/client"
"github.com/nspcc-dev/neofs-sdk-go/netmap" "github.com/nspcc-dev/neofs-sdk-go/netmap"
"github.com/nspcc-dev/neofs-sdk-go/object" oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -27,7 +27,7 @@ func (c *Context) buildCoverage() {
// select random member from another storage group // select random member from another storage group
// and process all placement vectors // and process all placement vectors
c.iterateSGMembersPlacementRand(func(id *object.ID, ind int, nodes netmap.Nodes) bool { c.iterateSGMembersPlacementRand(func(id *oidSDK.ID, ind int, nodes netmap.Nodes) bool {
c.processObjectPlacement(id, nodes, replicas[ind].Count()) c.processObjectPlacement(id, nodes, replicas[ind].Count())
return c.containerCovered() return c.containerCovered()
}) })
@ -38,7 +38,7 @@ func (c *Context) containerCovered() bool {
return c.cnrNodesNum <= len(c.pairedNodes) return c.cnrNodesNum <= len(c.pairedNodes)
} }
func (c *Context) processObjectPlacement(id *object.ID, nodes netmap.Nodes, replicas uint32) { func (c *Context) processObjectPlacement(id *oidSDK.ID, nodes netmap.Nodes, replicas uint32) {
var ( var (
ok uint32 ok uint32
optimal bool optimal bool
@ -102,7 +102,7 @@ func (c *Context) processObjectPlacement(id *object.ID, nodes netmap.Nodes, repl
} }
} }
func (c *Context) composePair(id *object.ID, n1, n2 *netmap.Node) { func (c *Context) composePair(id *oidSDK.ID, n1, n2 *netmap.Node) {
c.pairs = append(c.pairs, gamePair{ c.pairs = append(c.pairs, gamePair{
n1: n1, n1: n1,
n2: n2, n2: n2,
@ -117,10 +117,10 @@ func (c *Context) composePair(id *object.ID, n1, n2 *netmap.Node) {
} }
} }
func (c *Context) iterateSGMembersPlacementRand(f func(*object.ID, int, netmap.Nodes) bool) { func (c *Context) iterateSGMembersPlacementRand(f func(*oidSDK.ID, int, netmap.Nodes) bool) {
// iterate over storage groups members for all storage groups (one by one) // iterate over storage groups members for all storage groups (one by one)
// with randomly shuffled members // with randomly shuffled members
c.iterateSGMembersRand(func(id *object.ID) bool { c.iterateSGMembersRand(func(id *oidSDK.ID) bool {
// build placement vector for the current object // build placement vector for the current object
nn, err := c.buildPlacement(id) nn, err := c.buildPlacement(id)
if err != nil { if err != nil {
@ -142,8 +142,8 @@ func (c *Context) iterateSGMembersPlacementRand(f func(*object.ID, int, netmap.N
}) })
} }
func (c *Context) iterateSGMembersRand(f func(*object.ID) bool) { func (c *Context) iterateSGMembersRand(f func(*oidSDK.ID) bool) {
c.iterateSGInfo(func(members []*object.ID) bool { c.iterateSGInfo(func(members []*oidSDK.ID) bool {
ln := len(members) ln := len(members)
processed := make(map[uint64]struct{}, ln-1) processed := make(map[uint64]struct{}, ln-1)
@ -161,7 +161,7 @@ func (c *Context) iterateSGMembersRand(f func(*object.ID) bool) {
}) })
} }
func (c *Context) iterateSGInfo(f func([]*object.ID) bool) { func (c *Context) iterateSGInfo(f func([]*oidSDK.ID) bool) {
c.sgMembersMtx.RLock() c.sgMembersMtx.RLock()
defer c.sgMembersMtx.RUnlock() defer c.sgMembersMtx.RUnlock()

View file

@ -7,7 +7,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement" "github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement"
"github.com/nspcc-dev/neofs-node/pkg/util/rand" "github.com/nspcc-dev/neofs-node/pkg/util/rand"
"github.com/nspcc-dev/neofs-sdk-go/object" oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/nspcc-dev/tzhash/tz" "github.com/nspcc-dev/tzhash/tz"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -35,7 +35,7 @@ func (c *Context) executePoR() {
c.report.SetPoRCounters(c.porRequests.Load(), c.porRetries.Load()) c.report.SetPoRCounters(c.porRequests.Load(), c.porRetries.Load())
} }
func (c *Context) checkStorageGroupPoR(ind int, sg *object.ID) { func (c *Context) checkStorageGroupPoR(ind int, sg *oidSDK.ID) {
storageGroup, err := c.cnrCom.GetSG(c.task, sg) // get storage group storageGroup, err := c.cnrCom.GetSG(c.task, sg) // get storage group
if err != nil { if err != nil {
c.log.Warn("can't get storage group", c.log.Warn("can't get storage group",

View file

@ -5,7 +5,7 @@ import (
"github.com/nspcc-dev/neofs-sdk-go/audit" "github.com/nspcc-dev/neofs-sdk-go/audit"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/object" oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
) )
// Report tracks the progress of auditing container data. // Report tracks the progress of auditing container data.
@ -48,7 +48,7 @@ func (r *Report) Complete() {
} }
// PassedPoR updates list of passed storage groups. // PassedPoR updates list of passed storage groups.
func (r *Report) PassedPoR(sg *object.ID) { func (r *Report) PassedPoR(sg *oidSDK.ID) {
r.mu.Lock() r.mu.Lock()
defer r.mu.Unlock() defer r.mu.Unlock()
@ -56,7 +56,7 @@ func (r *Report) PassedPoR(sg *object.ID) {
} }
// FailedPoR updates list of failed storage groups. // FailedPoR updates list of failed storage groups.
func (r *Report) FailedPoR(sg *object.ID) { func (r *Report) FailedPoR(sg *oidSDK.ID) {
r.mu.Lock() r.mu.Lock()
defer r.mu.Unlock() defer r.mu.Unlock()

View file

@ -6,7 +6,7 @@ import (
"github.com/nspcc-dev/neofs-sdk-go/container" "github.com/nspcc-dev/neofs-sdk-go/container"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/netmap" "github.com/nspcc-dev/neofs-sdk-go/netmap"
"github.com/nspcc-dev/neofs-sdk-go/object" oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
) )
// Task groups groups the container audit parameters. // Task groups groups the container audit parameters.
@ -23,7 +23,7 @@ type Task struct {
cnrNodes netmap.ContainerNodes cnrNodes netmap.ContainerNodes
sgList []*object.ID sgList []*oidSDK.ID
} }
// WithReporter sets audit report writer. // WithReporter sets audit report writer.
@ -111,7 +111,7 @@ func (t *Task) ContainerNodes() netmap.ContainerNodes {
} }
// WithStorageGroupList sets list of storage groups from container under audit. // WithStorageGroupList sets list of storage groups from container under audit.
func (t *Task) WithStorageGroupList(sgList []*object.ID) *Task { func (t *Task) WithStorageGroupList(sgList []*oidSDK.ID) *Task {
if t != nil { if t != nil {
t.sgList = sgList t.sgList = sgList
} }
@ -120,6 +120,6 @@ func (t *Task) WithStorageGroupList(sgList []*object.ID) *Task {
} }
// StorageGroupList returns list of storage groups from container under audit. // StorageGroupList returns list of storage groups from container under audit.
func (t *Task) StorageGroupList() []*object.ID { func (t *Task) StorageGroupList() []*oidSDK.ID {
return t.sgList return t.sgList
} }

View file

@ -5,13 +5,13 @@ import (
"fmt" "fmt"
"github.com/nspcc-dev/neofs-node/pkg/services/control" "github.com/nspcc-dev/neofs-node/pkg/services/control"
"github.com/nspcc-dev/neofs-sdk-go/object" objectSDKAddress "github.com/nspcc-dev/neofs-sdk-go/object/address"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
) )
// DeletedObjectHandler is a handler of objects to be removed. // DeletedObjectHandler is a handler of objects to be removed.
type DeletedObjectHandler func([]*object.Address) error type DeletedObjectHandler func([]*objectSDKAddress.Address) error
// DropObjects marks objects to be removed from the local node. // DropObjects marks objects to be removed from the local node.
// //
@ -26,10 +26,10 @@ func (s *Server) DropObjects(_ context.Context, req *control.DropObjectsRequest)
} }
binAddrList := req.GetBody().GetAddressList() binAddrList := req.GetBody().GetAddressList()
addrList := make([]*object.Address, 0, len(binAddrList)) addrList := make([]*objectSDKAddress.Address, 0, len(binAddrList))
for i := range binAddrList { for i := range binAddrList {
a := object.NewAddress() a := objectSDKAddress.NewAddress()
err := a.Unmarshal(binAddrList[i]) err := a.Unmarshal(binAddrList[i])
if err != nil { if err != nil {

View file

@ -21,7 +21,8 @@ import (
eaclV2 "github.com/nspcc-dev/neofs-node/pkg/services/object/acl/eacl/v2" eaclV2 "github.com/nspcc-dev/neofs-node/pkg/services/object/acl/eacl/v2"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
eaclSDK "github.com/nspcc-dev/neofs-sdk-go/eacl" eaclSDK "github.com/nspcc-dev/neofs-sdk-go/eacl"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDKAddress "github.com/nspcc-dev/neofs-sdk-go/object/address"
objectSDKID "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/nspcc-dev/neofs-sdk-go/owner" "github.com/nspcc-dev/neofs-sdk-go/owner"
"github.com/nspcc-dev/neofs-sdk-go/util/signature" "github.com/nspcc-dev/neofs-sdk-go/util/signature"
) )
@ -72,7 +73,7 @@ type (
cid *cid.ID cid *cid.ID
oid *objectSDK.ID oid *objectSDKID.ID
senderKey []byte senderKey []byte
@ -517,23 +518,23 @@ func useObjectIDFromSession(req *requestInfo, token *session.SessionToken) {
return return
} }
req.oid = objectSDK.NewIDFromV2( req.oid = objectSDKID.NewIDFromV2(
objCtx.GetAddress().GetObjectID(), objCtx.GetAddress().GetObjectID(),
) )
} }
func getObjectIDFromRequestBody(body interface{}) *objectSDK.ID { func getObjectIDFromRequestBody(body interface{}) *objectSDKID.ID {
switch v := body.(type) { switch v := body.(type) {
default: default:
return nil return nil
case interface { case interface {
GetObjectID() *refs.ObjectID GetObjectID() *refs.ObjectID
}: }:
return objectSDK.NewIDFromV2(v.GetObjectID()) return objectSDKID.NewIDFromV2(v.GetObjectID())
case interface { case interface {
GetAddress() *refs.Address GetAddress() *refs.Address
}: }:
return objectSDK.NewIDFromV2(v.GetAddress().GetObjectID()) return objectSDKID.NewIDFromV2(v.GetAddress().GetObjectID())
} }
} }
@ -632,7 +633,7 @@ func eACLCheck(msg interface{}, reqInfo requestInfo, cfg *eACLCfg) bool {
hdrSrcOpts := make([]eaclV2.Option, 0, 3) hdrSrcOpts := make([]eaclV2.Option, 0, 3)
addr := objectSDK.NewAddress() addr := objectSDKAddress.NewAddress()
addr.SetContainerID(reqInfo.cid) addr.SetContainerID(reqInfo.cid)
addr.SetObjectID(reqInfo.oid) addr.SetObjectID(reqInfo.oid)

View file

@ -13,37 +13,39 @@ import (
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test" cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
eaclSDK "github.com/nspcc-dev/neofs-sdk-go/eacl" eaclSDK "github.com/nspcc-dev/neofs-sdk-go/eacl"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
objectSDKAddress "github.com/nspcc-dev/neofs-sdk-go/object/address"
objectSDKID "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
type testLocalStorage struct { type testLocalStorage struct {
t *testing.T t *testing.T
expAddr *objectSDK.Address expAddr *objectSDKAddress.Address
obj *object.Object obj *object.Object
} }
func (s *testLocalStorage) Head(addr *objectSDK.Address) (*object.Object, error) { func (s *testLocalStorage) Head(addr *objectSDKAddress.Address) (*object.Object, error) {
require.True(s.t, addr.ContainerID().Equal(addr.ContainerID()) && addr.ObjectID().Equal(addr.ObjectID())) require.True(s.t, addr.ContainerID().Equal(addr.ContainerID()) && addr.ObjectID().Equal(addr.ObjectID()))
return s.obj, nil return s.obj, nil
} }
func testID(t *testing.T) *objectSDK.ID { func testID(t *testing.T) *objectSDKID.ID {
cs := [sha256.Size]byte{} cs := [sha256.Size]byte{}
_, err := rand.Read(cs[:]) _, err := rand.Read(cs[:])
require.NoError(t, err) require.NoError(t, err)
id := objectSDK.NewID() id := objectSDKID.NewID()
id.SetSHA256(cs) id.SetSHA256(cs)
return id return id
} }
func testAddress(t *testing.T) *objectSDK.Address { func testAddress(t *testing.T) *objectSDKAddress.Address {
addr := objectSDK.NewAddress() addr := objectSDKAddress.NewAddress()
addr.SetObjectID(testID(t)) addr.SetObjectID(testID(t))
addr.SetContainerID(cidtest.ID()) addr.SetContainerID(cidtest.ID())

View file

@ -10,7 +10,8 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
eaclSDK "github.com/nspcc-dev/neofs-sdk-go/eacl" eaclSDK "github.com/nspcc-dev/neofs-sdk-go/eacl"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object" objectSDKAddress "github.com/nspcc-dev/neofs-sdk-go/object/address"
objectSDKID "github.com/nspcc-dev/neofs-sdk-go/object/id"
sessionSDK "github.com/nspcc-dev/neofs-sdk-go/session" sessionSDK "github.com/nspcc-dev/neofs-sdk-go/session"
) )
@ -25,7 +26,7 @@ type cfg struct {
} }
type ObjectStorage interface { type ObjectStorage interface {
Head(*objectSDK.Address) (*object.Object, error) Head(*objectSDKAddress.Address) (*object.Object, error)
} }
type Request interface { type Request interface {
@ -82,9 +83,9 @@ func requestHeaders(msg xHeaderSource) []eaclSDK.Header {
} }
func (h *headerSource) objectHeaders() ([]eaclSDK.Header, bool) { func (h *headerSource) objectHeaders() ([]eaclSDK.Header, bool) {
var addr *objectSDK.Address var addr *objectSDKAddress.Address
if h.addr != nil { if h.addr != nil {
addr = objectSDK.NewAddressFromV2(h.addr) addr = objectSDKAddress.NewAddressFromV2(h.addr)
} }
switch m := h.msg.(type) { switch m := h.msg.(type) {
@ -100,7 +101,7 @@ func (h *headerSource) objectHeaders() ([]eaclSDK.Header, bool) {
*objectV2.GetRangeRequest, *objectV2.GetRangeRequest,
*objectV2.GetRangeHashRequest, *objectV2.GetRangeHashRequest,
*objectV2.DeleteRequest: *objectV2.DeleteRequest:
return addressHeaders(objectSDK.NewAddressFromV2(h.addr)), true return addressHeaders(objectSDKAddress.NewAddressFromV2(h.addr)), true
case *objectV2.PutRequest: case *objectV2.PutRequest:
if v, ok := req.GetBody().GetObjectPart().(*objectV2.PutObjectPartInit); ok { if v, ok := req.GetBody().GetObjectPart().(*objectV2.PutObjectPartInit); ok {
oV2 := new(objectV2.Object) oV2 := new(objectV2.Object)
@ -108,9 +109,9 @@ func (h *headerSource) objectHeaders() ([]eaclSDK.Header, bool) {
oV2.SetHeader(v.GetHeader()) oV2.SetHeader(v.GetHeader())
if addr == nil { if addr == nil {
addr = objectSDK.NewAddress() addr = objectSDKAddress.NewAddress()
addr.SetContainerID(cid.NewFromV2(v.GetHeader().GetContainerID())) addr.SetContainerID(cid.NewFromV2(v.GetHeader().GetContainerID()))
addr.SetObjectID(objectSDK.NewIDFromV2(v.GetObjectID())) addr.SetObjectID(objectSDKID.NewIDFromV2(v.GetObjectID()))
} }
hs := headersFromObject(object.NewFromV2(oV2), addr) hs := headersFromObject(object.NewFromV2(oV2), addr)
@ -165,7 +166,7 @@ func (h *headerSource) objectHeaders() ([]eaclSDK.Header, bool) {
} }
func (h *headerSource) localObjectHeaders(addrV2 *refs.Address) ([]eaclSDK.Header, bool) { func (h *headerSource) localObjectHeaders(addrV2 *refs.Address) ([]eaclSDK.Header, bool) {
addr := objectSDK.NewAddressFromV2(addrV2) addr := objectSDKAddress.NewAddressFromV2(addrV2)
obj, err := h.storage.Head(addr) obj, err := h.storage.Head(addr)
if err == nil { if err == nil {
@ -182,14 +183,14 @@ func cidHeader(cid *cid.ID) eaclSDK.Header {
} }
} }
func oidHeader(oid *objectSDK.ID) eaclSDK.Header { func oidHeader(oid *objectSDKID.ID) eaclSDK.Header {
return &sysObjHdr{ return &sysObjHdr{
k: acl.FilterObjectID, k: acl.FilterObjectID,
v: idValue(oid), v: idValue(oid),
} }
} }
func addressHeaders(addr *objectSDK.Address) []eaclSDK.Header { func addressHeaders(addr *objectSDKAddress.Address) []eaclSDK.Header {
res := make([]eaclSDK.Header, 1, 2) res := make([]eaclSDK.Header, 1, 2)
res[0] = cidHeader(addr.ContainerID()) res[0] = cidHeader(addr.ContainerID())

Some files were not shown because too many files have changed in this diff Show more