[#174] Update to latest neofs-api-go changes

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-16 12:43:52 +03:00 committed by Alex Vanin
parent e98b77133c
commit 3de8febe57
47 changed files with 188 additions and 214 deletions

View file

@ -86,15 +86,15 @@ func prettyPrintDecimal(decimal *accounting.Decimal) {
}
if verbose {
fmt.Println("value:", decimal.GetValue())
fmt.Println("precision:", decimal.GetPrecision())
fmt.Println("value:", decimal.Value())
fmt.Println("precision:", decimal.Precision())
} else {
// divider = 10^{precision}; v:365, p:2 => 365 / 10^2 = 3.65
divider := math.Pow(10, float64(decimal.GetPrecision()))
divider := math.Pow(10, float64(decimal.Precision()))
// %0.8f\n for precision 8
format := fmt.Sprintf("%%0.%df\n", decimal.GetPrecision())
format := fmt.Sprintf("%%0.%df\n", decimal.Precision())
fmt.Printf(format, float64(decimal.GetValue())/divider)
fmt.Printf(format, float64(decimal.Value())/divider)
}
}

View file

@ -21,8 +21,6 @@ import (
"github.com/nspcc-dev/neofs-api-go/pkg/netmap"
"github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-api-go/pkg/owner"
v2ACL "github.com/nspcc-dev/neofs-api-go/v2/acl"
grpcACL "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc"
v2container "github.com/nspcc-dev/neofs-api-go/v2/container"
grpccontainer "github.com/nspcc-dev/neofs-api-go/v2/container/grpc"
"github.com/nspcc-dev/neofs-node/pkg/policy"
@ -139,7 +137,7 @@ It will be stored in sidechain when inner ring will accepts it.`,
}
cnr := container.New()
cnr.SetPlacementPolicy(placementPolicy.ToV2())
cnr.SetPlacementPolicy(placementPolicy)
cnr.SetBasicACL(basicACL)
cnr.SetAttributes(attributes)
cnr.SetNonce(nonce[:])
@ -312,7 +310,7 @@ var getContainerInfoCmd = &cobra.Command{
)
if containerJSON {
data, err = v2container.ContainerToJSON(cnr.ToV2())
data, err = cnr.MarshalJSON()
if err != nil {
return fmt.Errorf("can't JSON encode container: %w", err)
}
@ -356,7 +354,7 @@ var getExtendedACLCmd = &cobra.Command{
}
v := eaclTable.Version()
if v.GetMajor() == 0 && v.GetMajor() == 0 {
if v.Major() == 0 && v.Major() == 0 {
fmt.Println("extended ACL table is not set for this container")
return nil
}
@ -369,7 +367,7 @@ var getExtendedACLCmd = &cobra.Command{
var data []byte
if containerJSON {
data, err = v2ACL.TableToJSON(eaclTable.ToV2())
data, err = eaclTable.MarshalJSON()
if err != nil {
return fmt.Errorf("can't enode to JSON: %w", err)
}
@ -533,8 +531,8 @@ func parseContainerPolicy(policyString string) (*netmap.PlacementPolicy, error)
return result, nil
}
result, err = netmap.PlacementPolicyFromJSON([]byte(policyString))
if err == nil {
result = netmap.NewPlacementPolicy()
if err = result.UnmarshalJSON([]byte(policyString)); err == nil {
printVerbose("Parsed JSON encoded policy")
return result, nil
}
@ -542,8 +540,8 @@ func parseContainerPolicy(policyString string) (*netmap.PlacementPolicy, error)
return nil, errors.New("can't parse placement policy")
}
func parseAttributes(attributes []string) ([]*v2container.Attribute, error) {
result := make([]*v2container.Attribute, 0, len(attributes)+2) // name + timestamp attributes
func parseAttributes(attributes []string) ([]*container.Attribute, error) {
result := make([]*container.Attribute, 0, len(attributes)+2) // name + timestamp attributes
for i := range attributes {
kvPair := strings.Split(attributes[i], attributeDelimiter)
@ -551,7 +549,7 @@ func parseAttributes(attributes []string) ([]*v2container.Attribute, error) {
return nil, errors.New("invalid container attribute")
}
parsedAttribute := new(v2container.Attribute)
parsedAttribute := container.NewAttribute()
parsedAttribute.SetKey(kvPair[0])
parsedAttribute.SetValue(kvPair[1])
@ -559,7 +557,7 @@ func parseAttributes(attributes []string) ([]*v2container.Attribute, error) {
}
if !containerNoTimestamp {
timestamp := new(v2container.Attribute)
timestamp := container.NewAttribute()
timestamp.SetKey(container.AttributeTimestamp)
timestamp.SetValue(strconv.FormatInt(time.Now().Unix(), 10))
@ -567,7 +565,7 @@ func parseAttributes(attributes []string) ([]*v2container.Attribute, error) {
}
if containerName != "" {
cnrName := new(v2container.Attribute)
cnrName := container.NewAttribute()
cnrName.SetKey(container.AttributeName)
cnrName.SetValue(containerName)
@ -629,7 +627,7 @@ func prettyPrintContainer(cnr *container.Container, jsonEncoding bool) {
}
if jsonEncoding {
data, err := v2container.ContainerToJSON(cnr.ToV2())
data, err := cnr.MarshalJSON()
if err != nil {
printVerbose("Can't convert container to json: %w", err)
return
@ -647,14 +645,12 @@ func prettyPrintContainer(cnr *container.Container, jsonEncoding bool) {
id := container.CalculateID(cnr)
fmt.Println("container ID:", id)
version := cnr.GetVersion()
fmt.Printf("version: %d.%d\n", version.GetMajor(), version.GetMinor())
version := cnr.Version()
fmt.Printf("version: %d.%d\n", version.Major(), version.Minor())
// todo: return pkg structures instead of v2 structures
ownerID := owner.NewIDFromV2(cnr.GetOwnerID())
fmt.Println("owner ID:", ownerID)
fmt.Println("owner ID:", cnr.OwnerID())
basicACL := cnr.GetBasicACL()
basicACL := cnr.BasicACL()
fmt.Printf("basic ACL: %s", strconv.FormatUint(uint64(basicACL), 16))
switch basicACL {
case acl.PublicBasicRule:
@ -667,27 +663,26 @@ func prettyPrintContainer(cnr *container.Container, jsonEncoding bool) {
fmt.Println()
}
for _, attribute := range cnr.GetAttributes() {
if attribute.GetKey() == container.AttributeTimestamp {
for _, attribute := range cnr.Attributes() {
if attribute.Key() == container.AttributeTimestamp {
fmt.Printf("attribute: %s=%s (%s)\n",
attribute.GetKey(),
attribute.GetValue(),
prettyPrintUnixTime(attribute.GetValue()))
attribute.Key(),
attribute.Value(),
prettyPrintUnixTime(attribute.Value()))
continue
}
fmt.Printf("attribute: %s=%s\n", attribute.GetKey(), attribute.GetValue())
fmt.Printf("attribute: %s=%s\n", attribute.Key(), attribute.Value())
}
nonce, err := uuid.FromBytes(cnr.GetNonce())
nonce, err := uuid.FromBytes(cnr.Nonce())
if err == nil {
fmt.Println("nonce:", nonce)
}
fmt.Println("placement policy:")
cnrPolicy := netmap.NewPlacementPolicyFromV2(cnr.GetPlacementPolicy())
fmt.Println(strings.Join(policy.Encode(cnrPolicy), "\n"))
fmt.Println(strings.Join(policy.Encode(cnr.PlacementPolicy()), "\n"))
}
func parseEACL(eaclPath string) (*eacl.Table, error) {
@ -703,23 +698,17 @@ func parseEACL(eaclPath string) (*eacl.Table, error) {
return nil, fmt.Errorf("can't read file with EACL: %w", err)
}
msg := new(grpcACL.EACLTable)
if proto.Unmarshal(data, msg) == nil {
printVerbose("Parsed binary encoded EACL table")
v2 := v2ACL.TableFromGRPCMessage(msg)
return eacl.NewTableFromV2(v2), nil
}
if v2, err := v2ACL.TableFromJSON(data); err == nil {
table := eacl.NewTable()
if err = table.UnmarshalJSON(data); err == nil {
printVerbose("Parsed JSON encoded EACL table")
return eacl.NewTableFromV2(v2), nil
return table, nil
}
return nil, fmt.Errorf("can't parse EACL table: %w", err)
}
func prettyPrintEACL(table *eacl.Table) {
data, err := v2ACL.TableToJSON(table.ToV2())
data, err := table.MarshalJSON()
if err != nil {
printVerbose("Can't convert container to json: %w", err)
return

View file

@ -81,7 +81,7 @@ var localNodeInfoCmd = &cobra.Command{
func prettyPrintNodeInfo(i *netmap.NodeInfo, jsonEncoding bool) {
if jsonEncoding {
data, err := netmap.NodeInfoToJSON(i)
data, err := i.MarshalJSON()
if err != nil {
printVerbose("Can't convert container to json: %w", err)
return

View file

@ -20,10 +20,7 @@ import (
"github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-api-go/pkg/owner"
"github.com/nspcc-dev/neofs-api-go/pkg/token"
v2ACL "github.com/nspcc-dev/neofs-api-go/v2/acl"
grpcACL "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc"
"github.com/spf13/cobra"
"google.golang.org/protobuf/proto"
)
var (
@ -236,7 +233,7 @@ func deleteObject(cmd *cobra.Command, _ []string) error {
}
cmd.Println("Object removed successfully.")
cmd.Printf(" ID: %s\n CID: %s\n", objAddr.GetObjectID(), objAddr.GetContainerID())
cmd.Printf(" ID: %s\n CID: %s\n", objAddr.ObjectID(), objAddr.ContainerID())
return nil
}
@ -390,9 +387,9 @@ func getObjectHash(cmd *cobra.Command, _ []string) error {
}
switch typ {
case hashSha256:
cmd.Println(hex.EncodeToString(obj.GetPayloadChecksum().GetSum()))
cmd.Println(hex.EncodeToString(obj.PayloadChecksum().Sum()))
case hashTz:
cmd.Println(hex.EncodeToString(obj.GetPayloadHomomorphicHash().GetSum()))
cmd.Println(hex.EncodeToString(obj.PayloadHomomorphicHash().Sum()))
}
return nil
}
@ -592,14 +589,14 @@ func printHeader(cmd *cobra.Command, obj *object.Object, filename string) error
cmd.Printf("[%s] Header successfully saved.", filename)
}
cmd.Printf("ID: %s\n", obj.GetID())
cmd.Printf("CID: %s\n", obj.GetContainerID())
cmd.Printf("Owner: %s\n", obj.GetOwnerID())
cmd.Printf("CreatedAt: %d\n", obj.GetCreationEpoch())
cmd.Printf("Size: %d\n", obj.GetPayloadSize())
cmd.Printf("HomoHash: %s\n", hex.EncodeToString(obj.GetPayloadHomomorphicHash().GetSum()))
cmd.Printf("Checksum: %s\n", hex.EncodeToString(obj.GetPayloadChecksum().GetSum()))
switch obj.GetType() {
cmd.Printf("ID: %s\n", obj.ID())
cmd.Printf("CID: %s\n", obj.ContainerID())
cmd.Printf("Owner: %s\n", obj.OwnerID())
cmd.Printf("CreatedAt: %d\n", obj.CreationEpoch())
cmd.Printf("Size: %d\n", obj.PayloadSize())
cmd.Printf("HomoHash: %s\n", hex.EncodeToString(obj.PayloadHomomorphicHash().Sum()))
cmd.Printf("Checksum: %s\n", hex.EncodeToString(obj.PayloadChecksum().Sum()))
switch obj.Type() {
case object.TypeRegular:
cmd.Println("Type: regular")
case object.TypeTombstone:
@ -611,15 +608,15 @@ func printHeader(cmd *cobra.Command, obj *object.Object, filename string) error
}
cmd.Println("Attributes:")
for _, attr := range obj.GetAttributes() {
if attr.GetKey() == object.AttributeTimestamp {
for _, attr := range obj.Attributes() {
if attr.Key() == object.AttributeTimestamp {
cmd.Printf(" %s=%s (%s)\n",
attr.GetKey(),
attr.GetValue(),
prettyPrintUnixTime(attr.GetValue()))
attr.Key(),
attr.Value(),
prettyPrintUnixTime(attr.Value()))
continue
}
cmd.Printf(" %s=%s\n", attr.GetKey(), attr.GetValue())
cmd.Printf(" %s=%s\n", attr.Key(), attr.Value())
}
return nil
}
@ -650,19 +647,16 @@ func getBearerToken(cmd *cobra.Command, flagname string) (*token.BearerToken, er
return nil, fmt.Errorf("can't read bearer token file: %w", err)
}
v2token, err := v2ACL.BearerTokenFromJSON(data)
if err != nil {
msg := new(grpcACL.BearerToken)
if proto.Unmarshal(data, msg) != nil {
return nil, fmt.Errorf("can't decode beare token: %w", err)
tok := token.NewBearerToken()
if err := tok.UnmarshalJSON(data); err != nil {
if err = tok.Unmarshal(data); err != nil {
return nil, fmt.Errorf("can't decode bearer token: %w", err)
}
v2token = v2ACL.BearerTokenFromGRPCMessage(msg)
printVerbose("Using binary encoded bearer token")
} else {
printVerbose("Using JSON encoded bearer token")
}
return token.NewBearerTokenFromV2(v2token), nil
return tok, nil
}

View file

@ -13,7 +13,6 @@ import (
"github.com/nspcc-dev/neofs-api-go/pkg"
"github.com/nspcc-dev/neofs-api-go/pkg/token"
v2ACL "github.com/nspcc-dev/neofs-api-go/v2/acl"
"github.com/nspcc-dev/neofs-node/pkg/util/keyer"
"github.com/spf13/cobra"
)
@ -108,7 +107,7 @@ func signBearerToken(cmd *cobra.Command, _ []string) error {
var data []byte
if jsonFlag || len(to) == 0 {
data, err = v2ACL.BearerTokenToJSON(btok.ToV2())
data, err = btok.MarshalJSON()
if err != nil {
return fmt.Errorf("can't JSON encode bearer token: %w", err)
}
@ -147,7 +146,7 @@ func convertEACLTable(cmd *cobra.Command, _ []string) error {
var data []byte
if jsonFlag || len(to) == 0 {
data, err = v2ACL.TableToJSON(table.ToV2())
data, err = table.MarshalJSON()
if err != nil {
return fmt.Errorf("can't JSON encode extended ACL table: %w", err)
}

3
go.mod
View file

@ -14,7 +14,7 @@ require (
github.com/multiformats/go-multiaddr-net v0.1.2 // v0.1.1 => v0.1.2
github.com/multiformats/go-multihash v0.0.13 // indirect
github.com/nspcc-dev/neo-go v0.91.1-pre.0.20201030072836-71216865717b
github.com/nspcc-dev/neofs-api-go v1.3.1-0.20201111110701-789474906015
github.com/nspcc-dev/neofs-api-go v1.3.1-0.20201116094437-fe336fd5ba28
github.com/nspcc-dev/neofs-crypto v0.3.0
github.com/nspcc-dev/tzhash v1.4.0
github.com/panjf2000/ants/v2 v2.3.0
@ -36,7 +36,6 @@ require (
golang.org/x/sys v0.0.0-20201024232916-9f70ab9862d5 // indirect
golang.org/x/tools v0.0.0-20200123022218-593de606220b // indirect
google.golang.org/grpc v1.29.1
google.golang.org/protobuf v1.23.0
)
// Used for debug reasons

BIN
go.sum

Binary file not shown.

View file

@ -10,24 +10,24 @@ import (
var errNilPolicy = errors.New("placement policy is nil")
// CheckFormat conducts an initial check of the container data.
// CheckFormat conducts an initial check of the v2 container data.
//
// It is expected that if a container fails this test,
// it will not be inner-ring approved.
func CheckFormat(c *container.Container) error {
if c.GetPlacementPolicy() == nil {
if c.PlacementPolicy() == nil {
return errNilPolicy
}
if err := pkg.IsSupportedVersion(pkg.NewVersionFromV2(c.GetVersion())); err != nil {
if err := pkg.IsSupportedVersion(c.Version()); err != nil {
return errors.Wrap(err, "incorrect version")
}
if len(c.GetOwnerID().GetValue()) != owner.NEO3WalletSize {
if len(c.OwnerID().ToV2().GetValue()) != owner.NEO3WalletSize {
return errors.Wrap(owner.ErrBadID, "incorrect owner identifier")
}
if _, err := uuid.FromBytes(c.GetNonce()); err != nil {
if _, err := uuid.FromBytes(c.Nonce()); err != nil {
return errors.Wrap(err, "incorrect nonce")
}

View file

@ -17,19 +17,19 @@ func TestCheckFormat(t *testing.T) {
require.Error(t, CheckFormat(c))
policy := new(netmap.PlacementPolicy)
c.SetPlacementPolicy(policy.ToV2())
policy := netmap.NewPlacementPolicy()
c.SetPlacementPolicy(policy)
require.Error(t, CheckFormat(c))
c.SetVersion(pkg.SDKVersion().ToV2())
c.SetVersion(pkg.SDKVersion())
require.Error(t, CheckFormat(c))
wallet, err := owner.NEO3WalletFromPublicKey(&test.DecodeKey(-1).PublicKey)
require.NoError(t, err)
c.SetOwnerID(owner.NewIDFromNeo3Wallet(wallet).ToV2())
c.SetOwnerID(owner.NewIDFromNeo3Wallet(wallet))
c.SetNonce(nil)

View file

@ -57,9 +57,9 @@ func NewFormatValidator(opts ...FormatValidatorOption) *FormatValidator {
func (v *FormatValidator) Validate(obj *Object) error {
if obj == nil {
return errNilObject
} else if obj.GetID() == nil {
} else if obj.ID() == nil {
return errNilID
} else if obj.GetContainerID() == nil {
} else if obj.ContainerID() == nil {
return errNilCID
}
@ -77,11 +77,11 @@ func (v *FormatValidator) Validate(obj *Object) error {
}
func (v *FormatValidator) validateSignatureKey(obj *Object) error {
token := obj.GetSessionToken()
key := obj.GetSignature().GetKey()
token := obj.SessionToken()
key := obj.Signature().Key()
if token == nil || !bytes.Equal(token.SessionKey(), key) {
return v.checkOwnerKey(obj.GetOwnerID(), obj.GetSignature().GetKey())
return v.checkOwnerKey(obj.OwnerID(), obj.Signature().Key())
}
// FIXME: perform token verification
@ -123,7 +123,7 @@ func (v *FormatValidator) ValidateContent(t object.Type, payload []byte) error {
addrList := content.GetAddressList()
for _, addr := range addrList {
if addr.GetContainerID() == nil || addr.GetObjectID() == nil {
if addr.ContainerID() == nil || addr.ObjectID() == nil {
return errors.Errorf("(%T) empty address reference in tombstone", v)
}
}

View file

@ -19,8 +19,8 @@ type Object struct {
func (o *Object) Address() *object.Address {
if o != nil {
aV2 := new(refs.Address)
aV2.SetObjectID(o.GetID().ToV2())
aV2.SetContainerID(o.GetContainerID().ToV2())
aV2.SetObjectID(o.ID().ToV2())
aV2.SetContainerID(o.ContainerID().ToV2())
return object.NewAddressFromV2(aV2)
}
@ -56,22 +56,10 @@ func New() *Object {
return NewFromSDK(object.New())
}
// FromBytes restores Object from binary format.
func FromBytes(data []byte) (*Object, error) {
o, err := object.FromBytes(data)
if err != nil {
return nil, err
}
return &Object{
Object: o,
}, nil
}
// GetParent returns parent object.
func (o *Object) GetParent() *Object {
if o != nil {
if par := o.Object.GetParent(); par != nil {
if par := o.Object.Parent(); par != nil {
return &Object{
Object: par,
}

View file

@ -122,7 +122,7 @@ func (c *TombstoneContentV2) StableUnmarshal(data []byte) error {
data = data[ln:]
addr := new(refs.Address)
if err := addr.StableUnmarshal(data[:sz]); err != nil {
if err := addr.Unmarshal(data[:sz]); err != nil {
fmt.Println(err)
return err
}

View file

@ -67,7 +67,9 @@ func (s *Storage) Get(addr *objectSDK.Address) (*object.Object, error) {
return nil, errors.Wrap(err, "could not get object from BLOB storage")
}
return object.FromBytes(objBytes)
obj := object.New()
return obj, obj.Unmarshal(objBytes)
}
func (s *Storage) Head(addr *objectSDK.Address) (*object.Object, error) {

View file

@ -128,7 +128,7 @@ func TestDB_Delete(t *testing.T) {
require.NoError(t, err)
fs := objectSDK.SearchFilters{}
fs.AddObjectContainerIDFilter(objectSDK.MatchStringEqual, o.GetContainerID())
fs.AddObjectContainerIDFilter(objectSDK.MatchStringEqual, o.ContainerID())
testSelect(t, db, fs, o.Address())

View file

@ -34,7 +34,9 @@ func (db *DB) Get(addr *objectSDK.Address) (*object.Object, error) {
var err error
obj, err = object.FromBytes(data)
obj = object.New()
err = obj.Unmarshal(data)
return err
}); err != nil {

View file

@ -94,27 +94,27 @@ func addressKey(addr *objectSDK.Address) []byte {
}
func objectIndices(obj *object.Object, parent bool) []bucketItem {
as := obj.GetAttributes()
as := obj.Attributes()
res := make([]bucketItem, 0, 7+len(as)) // 7 predefined buckets and object attributes
childfreeVal := v2object.BooleanPropertyValueTrue
if len(obj.GetChildren()) > 0 {
if len(obj.Children()) > 0 {
childfreeVal = ""
}
res = append(res,
bucketItem{
key: v2object.FilterHeaderVersion,
val: obj.GetVersion().String(),
val: obj.Version().String(),
},
bucketItem{
key: v2object.FilterHeaderContainerID,
val: obj.GetContainerID().String(),
val: obj.ContainerID().String(),
},
bucketItem{
key: v2object.FilterHeaderOwnerID,
val: obj.GetOwnerID().String(),
val: obj.OwnerID().String(),
},
bucketItem{
key: v2object.FilterPropertyChildfree,
@ -122,12 +122,12 @@ func objectIndices(obj *object.Object, parent bool) []bucketItem {
},
bucketItem{
key: v2object.FilterHeaderParent,
val: obj.GetParentID().String(),
val: obj.ParentID().String(),
},
// TODO: add remaining fields after neofs-api#72
)
if obj.GetType() == objectSDK.TypeRegular && !obj.HasParent() {
if obj.Type() == objectSDK.TypeRegular && !obj.HasParent() {
res = append(res, bucketItem{
key: v2object.FilterPropertyRoot,
})
@ -141,8 +141,8 @@ func objectIndices(obj *object.Object, parent bool) []bucketItem {
for _, a := range as {
res = append(res, bucketItem{
key: a.GetKey(),
val: a.GetValue(),
key: a.Key(),
val: a.Value(),
})
}

View file

@ -100,15 +100,15 @@ func TestMismatchAfterMatch(t *testing.T) {
require.NoError(t, db.Put(obj))
a := obj.GetAttributes()[0]
a := obj.Attributes()[0]
fs := objectSDK.SearchFilters{}
// 1st - mismatching filter
fs.AddFilter(a.GetKey(), a.GetValue()+"1", objectSDK.MatchStringEqual)
fs.AddFilter(a.Key(), a.Value()+"1", objectSDK.MatchStringEqual)
// 2nd - matching filter
fs.AddFilter(a.GetKey(), a.GetValue(), objectSDK.MatchStringEqual)
fs.AddFilter(a.Key(), a.Value(), objectSDK.MatchStringEqual)
testSelect(t, db, fs)
}
@ -120,7 +120,7 @@ func addCommonAttribute(objs ...*object.Object) *objectSDK.Attribute {
for _, o := range objs {
object.NewRawFromObject(o).SetAttributes(
append(o.GetAttributes(), aCommon)...,
append(o.Attributes(), aCommon)...,
)
}
@ -143,7 +143,7 @@ func TestSelectRemoved(t *testing.T) {
require.NoError(t, db.Put(obj2))
fs := objectSDK.SearchFilters{}
fs.AddFilter(a.GetKey(), a.GetValue(), objectSDK.MatchStringEqual)
fs.AddFilter(a.Key(), a.Value(), objectSDK.MatchStringEqual)
testSelect(t, db, fs, obj1.Address(), obj2.Address())
@ -165,7 +165,7 @@ func TestMissingObjectAttribute(t *testing.T) {
// add object w/o attribute
obj2 := generateObject(t, testPrm{})
a1 := obj1.GetAttributes()[0]
a1 := obj1.Attributes()[0]
// add common attribute
aCommon := addCommonAttribute(obj1, obj2)
@ -177,10 +177,10 @@ func TestMissingObjectAttribute(t *testing.T) {
fs := objectSDK.SearchFilters{}
// 1st filter by common attribute
fs.AddFilter(aCommon.GetKey(), aCommon.GetValue(), objectSDK.MatchStringEqual)
fs.AddFilter(aCommon.Key(), aCommon.Value(), objectSDK.MatchStringEqual)
// next filter by attribute from 1st object only
fs.AddFilter(a1.GetKey(), a1.GetValue(), objectSDK.MatchStringEqual)
fs.AddFilter(a1.Key(), a1.Value(), objectSDK.MatchStringEqual)
testSelect(t, db, fs, obj1.Address())
}

View file

@ -399,7 +399,7 @@ func (b Service) findRequestInfo(
// fetch actual container
cnr, err := b.containers.Get(cid)
if err != nil || cnr.GetOwnerID() == nil {
if err != nil || cnr.OwnerID() == nil {
return info, ErrUnknownContainer
}
@ -417,10 +417,10 @@ func (b Service) findRequestInfo(
verb := sourceVerbOfRequest(req, op)
// todo: check verb sanity, if it was generated correctly. Do we need it ?
info.basicACL = basicACLHelper(cnr.GetBasicACL())
info.basicACL = basicACLHelper(cnr.BasicACL())
info.requestRole = role
info.operation = verb
info.owner = owner.NewIDFromV2(cnr.GetOwnerID())
info.owner = cnr.OwnerID()
info.cid = cid
// it is assumed that at the moment the key will be valid,

View file

@ -62,7 +62,7 @@ func (c SenderClassifier) Classify(
// todo: get owner from neofs.id if present
// if request owner is the same as container owner, return RoleUser
if bytes.Equal(cnr.GetOwnerID().GetValue(), ownerID.ToV2().GetValue()) {
if bytes.Equal(cnr.OwnerID().ToV2().GetValue(), ownerID.ToV2().GetValue()) {
return acl.RoleUser, ownerKeyInBytes, nil
}
@ -101,7 +101,7 @@ func requestOwner(req metaWithToken) (*owner.ID, *ecdsa.PublicKey, error) {
return nil, nil, errors.Wrap(ErrMalformedRequest, "nil at body signature")
}
key := crypto.UnmarshalPublicKey(bodySignature.GetKey())
key := crypto.UnmarshalPublicKey(bodySignature.Key())
neo3wallet, err := owner.NEO3WalletFromPublicKey(key)
if err != nil {
return nil, nil, errors.Wrap(err, "can't create neo3 wallet")
@ -174,7 +174,7 @@ func lookupKeyInContainer(
owner, cid []byte,
cnr *container.Container) (bool, error) {
cnrNodes, err := nm.GetContainerNodes(netmap.NewPlacementPolicyFromV2(cnr.GetPlacementPolicy()), cid)
cnrNodes, err := nm.GetContainerNodes(cnr.PlacementPolicy(), cid)
if err != nil {
return false, err
}

View file

@ -18,8 +18,8 @@ type Storage interface {
// Header is an interface of string key-value header.
type Header interface {
GetKey() string
GetValue() string
Key() string
Value() string
}
// TypedHeaderSource is the interface that wraps

View file

@ -40,7 +40,7 @@ func (s *testEACLStorage) GetEACL(id *container.ID) (*eacl.Table, error) {
}
func (s *testLocalStorage) Head(addr *objectSDK.Address) (*object.Object, error) {
require.True(s.t, addr.GetContainerID().Equal(addr.GetContainerID()) && addr.GetObjectID().Equal(addr.GetObjectID()))
require.True(s.t, addr.ContainerID().Equal(addr.ContainerID()) && addr.ObjectID().Equal(addr.ObjectID()))
return s.obj, nil
}
@ -139,7 +139,7 @@ func TestHeadRequest(t *testing.T) {
obj: obj.Object(),
}
cid := addr.GetContainerID()
cid := addr.ContainerID()
unit := new(eacl2.ValidationUnit).
WithContainerID(cid).
WithOperation(eacl.OperationHead).

View file

@ -3,6 +3,7 @@ package v2
import (
"fmt"
"github.com/nspcc-dev/neofs-api-go/pkg"
eaclSDK "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl"
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object"
@ -71,7 +72,7 @@ func requestHeaders(msg xHeaderSource) []eacl.Header {
res := make([]eacl.Header, 0, len(xHdrs))
for i := range xHdrs {
res = append(res, xHdrs[i])
res = append(res, pkg.NewXHeaderFromV2(xHdrs[i]))
}
return res

View file

@ -15,11 +15,11 @@ type sysObjHdr struct {
k, v string
}
func (s *sysObjHdr) GetKey() string {
func (s *sysObjHdr) Key() string {
return s.k
}
func (s *sysObjHdr) GetValue() string {
func (s *sysObjHdr) Value() string {
return s.v
}
@ -48,27 +48,27 @@ func headersFromObject(obj *object.Object) []eacl.Header {
// container ID
&sysObjHdr{
k: acl.FilterObjectContainerID,
v: cidValue(obj.GetContainerID()),
v: cidValue(obj.ContainerID()),
},
// owner ID
&sysObjHdr{
k: acl.FilterObjectOwnerID,
v: ownerIDValue(obj.GetOwnerID()),
v: ownerIDValue(obj.OwnerID()),
},
// creation epoch
&sysObjHdr{
k: acl.FilterObjectCreationEpoch,
v: u64Value(obj.GetCreationEpoch()),
v: u64Value(obj.CreationEpoch()),
},
// payload size
&sysObjHdr{
k: acl.FilterObjectPayloadLength,
v: u64Value(obj.GetPayloadSize()),
v: u64Value(obj.PayloadSize()),
},
// TODO: add others fields after neofs-api#84
)
attrs := obj.GetAttributes()
attrs := obj.Attributes()
hs := make([]eacl.Header, 0, len(attrs))
for i := range attrs {

View file

@ -124,7 +124,7 @@ func matchFilters(hdrSrc TypedHeaderSource, filters []eacl.Filter) int {
}
// check header name
if header.GetKey() != filter.Key() {
if header.Key() != filter.Key() {
continue
}
@ -172,10 +172,10 @@ func targetMatches(unit *ValidationUnit, record eacl.Record) bool {
// Maps match type to corresponding function.
var mMatchFns = map[eacl.Match]func(Header, eacl.Filter) bool{
eacl.MatchStringEqual: func(header Header, filter eacl.Filter) bool {
return header.GetValue() == filter.Value()
return header.Value() == filter.Value()
},
eacl.MatchStringNotEqual: func(header Header, filter eacl.Filter) bool {
return header.GetValue() != filter.Value()
return header.Value() != filter.Value()
},
}

View file

@ -84,7 +84,7 @@ func (s *Service) Delete(ctx context.Context, prm *Prm) (*Response, error) {
// content address storage (CAS) and one tombstone for several split
// objects.
if err := r.Init(new(putsvc.PutInitPrm).
WithObject(newTombstone(ownerID, prm.addr.GetContainerID())).
WithObject(newTombstone(ownerID, prm.addr.ContainerID())).
WithCommonPrm(prm.common).
WithTraverseOption(placement.WithoutSuccessTracking()), // broadcast tombstone, maybe one
); err != nil {
@ -108,9 +108,9 @@ func (s *Service) getRelations(ctx context.Context, prm *Prm) ([]*objectSDK.Addr
var res []*objectSDK.Address
if linking, err := s.hdrLinking.HeadRelation(ctx, prm.addr, prm.common); err != nil {
cid := prm.addr.GetContainerID()
cid := prm.addr.ContainerID()
for prev := prm.addr.GetObjectID(); prev != nil; {
for prev := prm.addr.ObjectID(); prev != nil; {
addr := objectSDK.NewAddress()
addr.SetObjectID(prev)
addr.SetContainerID(cid)
@ -124,12 +124,12 @@ func (s *Service) getRelations(ctx context.Context, prm *Prm) ([]*objectSDK.Addr
}
hdr := headResult.Header()
id := hdr.GetID()
prev = hdr.GetPreviousID()
id := hdr.ID()
prev = hdr.PreviousID()
if rightChild := headResult.RightChild(); rightChild != nil {
id = rightChild.GetID()
prev = rightChild.GetPreviousID()
id = rightChild.ID()
prev = rightChild.PreviousID()
}
addr.SetObjectID(id)
@ -137,20 +137,20 @@ func (s *Service) getRelations(ctx context.Context, prm *Prm) ([]*objectSDK.Addr
res = append(res, addr)
}
} else {
childList := linking.GetChildren()
childList := linking.Children()
res = make([]*objectSDK.Address, 0, len(childList)+2) // 1 for parent, 1 for linking
for i := range childList {
addr := objectSDK.NewAddress()
addr.SetObjectID(childList[i])
addr.SetContainerID(prm.addr.GetContainerID())
addr.SetContainerID(prm.addr.ContainerID())
res = append(res, addr)
}
addr := objectSDK.NewAddress()
addr.SetObjectID(linking.GetID())
addr.SetContainerID(prm.addr.GetContainerID())
addr.SetObjectID(linking.ID())
addr.SetContainerID(prm.addr.ContainerID())
res = append(res, addr)
}

View file

@ -37,7 +37,7 @@ func (h *distributedHeader) prepare(ctx context.Context, prm *Prm) error {
}
// get container to store the object
cnr, err := h.cnrSrc.Get(prm.addr.GetContainerID())
cnr, err := h.cnrSrc.Get(prm.addr.ContainerID())
if err != nil {
return errors.Wrapf(err, "(%T) could not get container by ID", h)
}
@ -54,7 +54,7 @@ func (h *distributedHeader) prepare(ctx context.Context, prm *Prm) error {
placement.SuccessAfter(1),
// set identifier of the processing object
placement.ForObject(prm.addr.GetObjectID()),
placement.ForObject(prm.addr.ObjectID()),
)
// create placement builder from network map

View file

@ -29,7 +29,7 @@ func (h *RelationHeader) HeadRelation(ctx context.Context, addr *objectSDK.Addre
}
a := objectSDK.NewAddress()
a.SetContainerID(addr.GetContainerID())
a.SetContainerID(addr.ContainerID())
a.SetObjectID(id)
r, err := h.svc.Head(ctx, new(Prm).

View file

@ -75,7 +75,7 @@ func (s *Service) Head(ctx context.Context, prm *Prm) (*Response, error) {
}
addr := objectSDK.NewAddress()
addr.SetContainerID(prm.addr.GetContainerID())
addr.SetContainerID(prm.addr.ContainerID())
addr.SetObjectID(rightChildID)
r, err = s.Head(ctx, new(Prm).WithAddress(addr).WithCommonPrm(prm.common))

View file

@ -41,7 +41,7 @@ func (t *distributedTarget) Write(p []byte) (n int, err error) {
func (t *distributedTarget) Close() (*transformer.AccessIdentifiers, error) {
traverser, err := placement.NewTraverser(
append(t.traverseOpts, placement.ForObject(t.obj.GetID()))...,
append(t.traverseOpts, placement.ForObject(t.obj.ID()))...,
)
if err != nil {
return nil, errors.Wrapf(err, "(%T) could not create object placement traverser", t)
@ -59,7 +59,7 @@ func (t *distributedTarget) Close() (*transformer.AccessIdentifiers, error) {
payload = append(payload, t.chunks[i]...)
}
if err := t.fmt.ValidateContent(t.obj.GetType(), payload); err != nil {
if err := t.fmt.ValidateContent(t.obj.Type(), payload); err != nil {
return nil, errors.Wrapf(err, "(%T) could not validate payload content", t)
}
@ -108,5 +108,5 @@ loop:
}
return new(transformer.AccessIdentifiers).
WithSelfID(t.obj.GetID()), nil
WithSelfID(t.obj.ID()), nil
}

View file

@ -18,7 +18,7 @@ type localTarget struct {
func (t *localTarget) WriteHeader(obj *object.RawObject) error {
t.obj = obj
t.payload = make([]byte, 0, obj.GetPayloadSize())
t.payload = make([]byte, 0, obj.PayloadSize())
return nil
}
@ -35,5 +35,5 @@ func (t *localTarget) Close() (*transformer.AccessIdentifiers, error) {
}
return new(transformer.AccessIdentifiers).
WithSelfID(t.obj.GetID()), nil
WithSelfID(t.obj.ID()), nil
}

View file

@ -96,7 +96,7 @@ func (p *Streamer) preparePrm(prm *PutInitPrm) error {
}
// get container to store the object
cnr, err := p.cnrSrc.Get(prm.hdr.GetContainerID())
cnr, err := p.cnrSrc.Get(prm.hdr.ContainerID())
if err != nil {
return errors.Wrapf(err, "(%T) could not get container by ID", p)
}
@ -107,7 +107,7 @@ func (p *Streamer) preparePrm(prm *PutInitPrm) error {
placement.ForContainer(cnr),
// set identifier of the processing object
placement.ForObject(prm.hdr.GetID()),
placement.ForObject(prm.hdr.ID()),
)
// create placement builder from network map

View file

@ -23,8 +23,8 @@ type validatingTarget struct {
}
func (t *validatingTarget) WriteHeader(obj *object.RawObject) error {
cs := obj.GetPayloadChecksum()
switch typ := cs.GetType(); typ {
cs := obj.PayloadChecksum()
switch typ := cs.Type(); typ {
default:
return errors.Errorf("(%T) unsupported payload checksum type %v", t, typ)
case pkg.ChecksumSHA256:
@ -33,7 +33,7 @@ func (t *validatingTarget) WriteHeader(obj *object.RawObject) error {
t.hash = tz.New()
}
t.checksum = cs.GetSum()
t.checksum = cs.Sum()
if err := t.fmt.Validate(obj.Object()); err != nil {
return errors.Wrapf(err, "(%T) coult not validate object format", t)

View file

@ -35,14 +35,14 @@ type rangeChain struct {
func newRangeTraverser(originSize uint64, rightElement *object.Object, rngSeek *objectSDK.Range) *rangeTraverser {
right := &rangeChain{
bounds: &rangeBounds{
left: originSize - rightElement.GetPayloadSize(),
left: originSize - rightElement.PayloadSize(),
right: originSize,
},
id: rightElement.GetID(),
id: rightElement.ID(),
}
left := &rangeChain{
id: rightElement.GetPreviousID(),
id: rightElement.PreviousID(),
}
left.next, right.prev = right, left
@ -83,12 +83,12 @@ func min(a, b uint64) uint64 {
}
func (c *rangeTraverser) pushHeader(obj *object.Object) {
id := obj.GetID()
id := obj.ID()
if !id.Equal(c.chain.prev.id) {
panic(fmt.Sprintf("(%T) unexpected identifier in header", c))
}
sz := obj.GetPayloadSize()
sz := obj.PayloadSize()
c.chain.prev.bounds = &rangeBounds{
left: c.chain.bounds.left - sz,
@ -97,7 +97,7 @@ func (c *rangeTraverser) pushHeader(obj *object.Object) {
c.chain = c.chain.prev
if prev := obj.GetPreviousID(); prev != nil {
if prev := obj.PreviousID(); prev != nil {
c.chain.prev = &rangeChain{
next: c.chain,
id: prev,

View file

@ -22,7 +22,7 @@ func (l *localRangeWriter) WriteTo(w io.Writer) (int64, error) {
return 0, errors.Wrapf(err, "(%T) could not get object from local storage", l)
}
payload := obj.GetPayload()
payload := obj.Payload()
left := l.rng.GetOffset()
right := left + l.rng.GetLength()

View file

@ -66,7 +66,7 @@ func (s *Service) GetRange(ctx context.Context, prm *Prm) (*Result, error) {
origin := headResult.Header()
originSize := origin.GetPayloadSize()
originSize := origin.PayloadSize()
if prm.full {
prm.rng = new(object.Range)
@ -101,7 +101,7 @@ func (s *Service) GetRange(ctx context.Context, prm *Prm) (*Result, error) {
func (s *Service) fillTraverser(ctx context.Context, prm *Prm, traverser *objutil.RangeTraverser) error {
addr := object.NewAddress()
addr.SetContainerID(prm.addr.GetContainerID())
addr.SetContainerID(prm.addr.ContainerID())
for {
nextID, nextRng := traverser.Next()

View file

@ -81,7 +81,7 @@ func (p *streamer) switchToObject(id *object.ID) error {
}
// get container to read payload range
cnr, err := p.cnrSrc.Get(p.prm.addr.GetContainerID())
cnr, err := p.cnrSrc.Get(p.prm.addr.ContainerID())
if err != nil {
return errors.Wrapf(err, "(%T) could not get container by ID", p)
}
@ -124,7 +124,7 @@ func (p *streamer) start() {
defer close(p.ch)
objAddr := object.NewAddress()
objAddr.SetContainerID(p.prm.addr.GetContainerID())
objAddr.SetContainerID(p.prm.addr.ContainerID())
loop:
for {

View file

@ -35,7 +35,7 @@ func (h *distributedHasher) prepare(ctx context.Context, prm *Prm) error {
}
// get container to read the object
cnr, err := h.cnrSrc.Get(prm.addr.GetContainerID())
cnr, err := h.cnrSrc.Get(prm.addr.ContainerID())
if err != nil {
return errors.Wrapf(err, "(%T) could not get container by ID", h)
}
@ -52,7 +52,7 @@ func (h *distributedHasher) prepare(ctx context.Context, prm *Prm) error {
placement.SuccessAfter(1),
// set identifier of the processing object
placement.ForObject(prm.addr.GetObjectID()),
placement.ForObject(prm.addr.ObjectID()),
)
// create placement builder from network map

View file

@ -23,7 +23,7 @@ func (h *localHasher) hashRange(ctx context.Context, prm *Prm, handler func([][]
return errors.Wrapf(err, "(%T) could not get object from local storage", h)
}
payload := obj.GetPayload()
payload := obj.Payload()
hashes := make([][]byte, 0, len(prm.rngs))
var hasher hash.Hash

View file

@ -72,7 +72,7 @@ func (s *Service) GetRangeHash(ctx context.Context, prm *Prm) (*Response, error)
origin := headResult.Header()
originSize := origin.GetPayloadSize()
originSize := origin.PayloadSize()
var minLeft, maxRight uint64
for i := range prm.rngs {
@ -106,7 +106,7 @@ func (s *Service) GetRangeHash(ctx context.Context, prm *Prm) (*Response, error)
func (s *Service) getHashes(ctx context.Context, prm *Prm, traverser *objutil.RangeTraverser) (*Response, error) {
addr := object.NewAddress()
addr.SetContainerID(prm.addr.GetContainerID())
addr.SetContainerID(prm.addr.ContainerID())
resp := &Response{
hashes: make([][]byte, 0, len(prm.rngs)),

View file

@ -30,7 +30,7 @@ func (s *localStream) stream(ctx context.Context, ch chan<- []*objectSDK.ID) err
idList := make([]*objectSDK.ID, 0, len(addrList))
for i := range addrList {
idList = append(idList, addrList[i].GetObjectID())
idList = append(idList, addrList[i].ObjectID())
}
select {

View file

@ -21,7 +21,7 @@ var ErrRelationNotFound = errors.New("relation not found")
func (s *RelationSearcher) SearchRelation(ctx context.Context, addr *object.Address, prm *util.CommonPrm) (*object.ID, error) {
streamer, err := s.svc.Search(ctx, new(Prm).
WithContainerID(addr.GetContainerID()).WithCommonPrm(prm).
WithContainerID(addr.ContainerID()).WithCommonPrm(prm).
WithSearchQuery(s.queryGenerator(addr)),
)
if err != nil {
@ -65,7 +65,7 @@ func NewRightChildSearcher(svc *Service) *RelationSearcher {
return &RelationSearcher{
svc: svc,
queryGenerator: func(addr *object.Address) query.Query {
return queryV1.NewRightChildQuery(addr.GetObjectID())
return queryV1.NewRightChildQuery(addr.ObjectID())
},
}
}
@ -74,7 +74,7 @@ func NewLinkingSearcher(svc *Service) *RelationSearcher {
return &RelationSearcher{
svc: svc,
queryGenerator: func(addr *object.Address) query.Query {
return queryV1.NewLinkingQuery(addr.GetObjectID())
return queryV1.NewLinkingQuery(addr.ObjectID())
},
}
}

View file

@ -29,14 +29,14 @@ type rangeChain struct {
func NewRangeTraverser(originSize uint64, rightElement *object.Object, rngSeek *objectSDK.Range) *RangeTraverser {
right := &rangeChain{
bounds: &rangeBounds{
left: originSize - rightElement.GetPayloadSize(),
left: originSize - rightElement.PayloadSize(),
right: originSize,
},
id: rightElement.GetID(),
id: rightElement.ID(),
}
left := &rangeChain{
id: rightElement.GetPreviousID(),
id: rightElement.PreviousID(),
}
left.next, right.prev = right, left
@ -75,12 +75,12 @@ func min(a, b uint64) uint64 {
}
func (c *RangeTraverser) PushHeader(obj *object.Object) {
id := obj.GetID()
id := obj.ID()
if !id.Equal(c.chain.prev.id) {
panic(fmt.Sprintf("(%T) unexpected identifier in header", c))
}
sz := obj.GetPayloadSize()
sz := obj.PayloadSize()
c.chain.prev.bounds = &rangeBounds{
left: c.chain.bounds.left - sz,
@ -89,7 +89,7 @@ func (c *RangeTraverser) PushHeader(obj *object.Object) {
c.chain = c.chain.prev
if prev := obj.GetPreviousID(); prev != nil {
if prev := obj.PreviousID(); prev != nil {
c.chain.prev = &rangeChain{
next: c.chain,
id: prev,

View file

@ -116,8 +116,8 @@ func (gc *GC) Run(ctx context.Context) {
)
} else {
gc.log.Info("object removed",
zap.String("CID", stringifyCID(addr.GetContainerID())),
zap.String("ID", stringifyID(addr.GetObjectID())),
zap.String("CID", stringifyCID(addr.ContainerID())),
zap.String("ID", stringifyID(addr.ObjectID())),
)
}
}

View file

@ -181,7 +181,7 @@ func UseBuilder(b Builder) Option {
// ForContainer is a traversal container setting option.
func ForContainer(cnr *container.Container) Option {
return func(c *cfg) {
c.policy = netmap.NewPlacementPolicyFromV2(cnr.GetPlacementPolicy())
c.policy = cnr.PlacementPolicy()
c.addr.SetContainerID(container.CalculateID(cnr))
}
}

View file

@ -71,7 +71,7 @@ func (f *formatter) Close() (*AccessIdentifiers, error) {
var parID *objectSDK.ID
if par := f.obj.GetParent(); par != nil {
if par := f.obj.Parent(); par != nil {
rawPar := objectSDK.NewRawFromV2(par.ToV2())
rawPar.SetSessionToken(f.prm.SessionToken)
@ -81,7 +81,7 @@ func (f *formatter) Close() (*AccessIdentifiers, error) {
return nil, errors.Wrap(err, "could not finalize parent object")
}
parID = rawPar.GetID()
parID = rawPar.ID()
f.obj.SetParent(rawPar.Object())
}
@ -99,6 +99,6 @@ func (f *formatter) Close() (*AccessIdentifiers, error) {
}
return new(AccessIdentifiers).
WithSelfID(f.obj.GetID()).
WithSelfID(f.obj.ID()).
WithParentID(parID), nil
}

View file

@ -90,10 +90,10 @@ func (s *payloadSizeLimiter) initialize() {
func fromObject(obj *object.RawObject) *object.RawObject {
res := object.NewRaw()
res.SetContainerID(obj.GetContainerID())
res.SetOwnerID(obj.GetOwnerID())
res.SetAttributes(obj.GetAttributes()...)
res.SetType(obj.GetType())
res.SetContainerID(obj.ContainerID())
res.SetOwnerID(obj.OwnerID())
res.SetAttributes(obj.Attributes()...)
res.SetType(obj.Type())
return res
}
@ -207,7 +207,7 @@ func writeHashes(hashers []*payloadChecksumHasher) {
}
func (s *payloadSizeLimiter) initializeLinking() {
id := s.current.GetParentID()
id := s.current.ParentID()
s.current = fromObject(s.current)
s.current.SetParentID(id)

View file

@ -13,7 +13,7 @@ import (
)
func (p *Policer) processObject(ctx context.Context, addr *object.Address) {
cnr, err := p.cnrSrc.Get(addr.GetContainerID())
cnr, err := p.cnrSrc.Get(addr.ContainerID())
if err != nil {
p.log.Error("could not get container",
zap.String("error", err.Error()),
@ -22,7 +22,7 @@ func (p *Policer) processObject(ctx context.Context, addr *object.Address) {
return
}
policy := netmap.NewPlacementPolicyFromV2(cnr.GetPlacementPolicy())
policy := cnr.PlacementPolicy()
nn, err := p.placementBuilder.BuildPlacement(addr, policy)
if err != nil {