Compare commits
1 commit
master
...
tree-servi
Author | SHA1 | Date | |
---|---|---|---|
|
8f7223a4b1 |
38 changed files with 43 additions and 54 deletions
|
@ -50,7 +50,7 @@ func (d *Decimal) SetPrecision(p uint32) {
|
|||
|
||||
// Marshal marshals Decimal into a protobuf binary form.
|
||||
func (d *Decimal) Marshal() ([]byte, error) {
|
||||
return (*accounting.Decimal)(d).StableMarshal(nil)
|
||||
return (*accounting.Decimal)(d).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshalls protobuf binary representation of Decimal.
|
||||
|
|
|
@ -46,7 +46,7 @@ func (r *Result) ToV2() *audit.DataAuditResult {
|
|||
|
||||
// Marshal marshals Result into a protobuf binary form.
|
||||
func (r *Result) Marshal() ([]byte, error) {
|
||||
return (*audit.DataAuditResult)(r).StableMarshal(nil)
|
||||
return (*audit.DataAuditResult)(r).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of Result.
|
||||
|
|
|
@ -89,7 +89,7 @@ func Equal(cs1, cs2 *Checksum) bool {
|
|||
|
||||
// Marshal marshals Checksum into a protobuf binary form.
|
||||
func (c *Checksum) Marshal() ([]byte, error) {
|
||||
return (*refs.Checksum)(c).StableMarshal(nil)
|
||||
return (*refs.Checksum)(c).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of Checksum.
|
||||
|
|
|
@ -68,7 +68,7 @@ func (a *UsedSpaceAnnouncement) ToV2() *container.UsedSpaceAnnouncement {
|
|||
|
||||
// Marshal marshals UsedSpaceAnnouncement into a protobuf binary form.
|
||||
func (a *UsedSpaceAnnouncement) Marshal() ([]byte, error) {
|
||||
return a.ToV2().StableMarshal(nil)
|
||||
return a.ToV2().StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of UsedSpaceAnnouncement.
|
||||
|
|
|
@ -86,10 +86,7 @@ func NewContainerFromV2(c *container.Container) *Container {
|
|||
// CalculateID calculates container identifier
|
||||
// based on its structure.
|
||||
func CalculateID(c *Container) *cid.ID {
|
||||
data, err := c.ToV2().StableMarshal(nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
data := c.ToV2().StableMarshal(nil)
|
||||
|
||||
id := cid.New()
|
||||
id.SetSHA256(sha256.Sum256(data))
|
||||
|
@ -174,7 +171,7 @@ func (c *Container) SetSignature(sig *signature.Signature) {
|
|||
|
||||
// Marshal marshals Container into a protobuf binary form.
|
||||
func (c *Container) Marshal() ([]byte, error) {
|
||||
return c.v2.StableMarshal(nil)
|
||||
return c.v2.StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of Container.
|
||||
|
|
|
@ -71,7 +71,7 @@ func (id *ID) String() string {
|
|||
|
||||
// Marshal marshals ID into a protobuf binary form.
|
||||
func (id *ID) Marshal() ([]byte, error) {
|
||||
return (*refs.ContainerID)(id).StableMarshal(nil)
|
||||
return (*refs.ContainerID)(id).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of ID.
|
||||
|
|
|
@ -143,7 +143,7 @@ func NewFilterFromV2(filter *v2acl.HeaderFilter) *Filter {
|
|||
|
||||
// Marshal marshals Filter into a protobuf binary form.
|
||||
func (f *Filter) Marshal() ([]byte, error) {
|
||||
return f.ToV2().StableMarshal(nil)
|
||||
return f.ToV2().StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of Filter.
|
||||
|
|
|
@ -236,7 +236,7 @@ func NewRecordFromV2(record *v2acl.Record) *Record {
|
|||
|
||||
// Marshal marshals Record into a protobuf binary form.
|
||||
func (r *Record) Marshal() ([]byte, error) {
|
||||
return r.ToV2().StableMarshal(nil)
|
||||
return r.ToV2().StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of Record.
|
||||
|
|
|
@ -168,7 +168,7 @@ func NewTableFromV2(table *v2acl.Table) *Table {
|
|||
|
||||
// Marshal marshals Table into a protobuf binary form.
|
||||
func (t *Table) Marshal() ([]byte, error) {
|
||||
return t.ToV2().StableMarshal(nil)
|
||||
return t.ToV2().StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of Table.
|
||||
|
|
|
@ -124,7 +124,7 @@ func NewTargetFromV2(target *v2acl.Target) *Target {
|
|||
|
||||
// Marshal marshals Target into a protobuf binary form.
|
||||
func (t *Target) Marshal() ([]byte, error) {
|
||||
return t.ToV2().StableMarshal(nil)
|
||||
return t.ToV2().StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of Target.
|
||||
|
|
2
go.mod
2
go.mod
|
@ -10,7 +10,7 @@ require (
|
|||
github.com/mr-tron/base58 v1.2.0
|
||||
github.com/nspcc-dev/hrw v1.0.9
|
||||
github.com/nspcc-dev/neo-go v0.98.0
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.12.1
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.12.2-0.20220427064503-870c1ffc0a9f
|
||||
github.com/stretchr/testify v1.7.0
|
||||
go.uber.org/zap v1.18.1
|
||||
google.golang.org/grpc v1.41.0
|
||||
|
|
2
go.sum
2
go.sum
|
@ -179,6 +179,8 @@ github.com/nspcc-dev/neo-go v0.98.0/go.mod h1:E3cc1x6RXSXrJb2nDWXTXjnXk3rIqVN8Yd
|
|||
github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211201134523-3604d96f3fe1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs=
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.12.1 h1:PVU2rLlG9S0jDe5eKyaUs4nKo/la+mN5pvz32Gib3qM=
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.12.1/go.mod h1:73j09Xa7I2zQbM3HCvAHnDHPYiiWnEHa1d6Z6RDMBLU=
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.12.2-0.20220427064503-870c1ffc0a9f h1:hGMs65HYSKanUve3ipXHT260HtaO7gn5egQJeAEDvlA=
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.12.2-0.20220427064503-870c1ffc0a9f/go.mod h1:73j09Xa7I2zQbM3HCvAHnDHPYiiWnEHa1d6Z6RDMBLU=
|
||||
github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA=
|
||||
github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw=
|
||||
github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM=
|
||||
|
|
|
@ -254,7 +254,7 @@ func (f *Filter) SetInnerFilters(fs ...Filter) {
|
|||
|
||||
// Marshal marshals Filter into a protobuf binary form.
|
||||
func (f *Filter) Marshal() ([]byte, error) {
|
||||
return (*netmap.Filter)(f).StableMarshal(nil)
|
||||
return (*netmap.Filter)(f).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of Filter.
|
||||
|
|
|
@ -81,7 +81,7 @@ func (i *NetworkInfo) SetNetworkConfig(v *NetworkConfig) {
|
|||
|
||||
// Marshal marshals NetworkInfo into a protobuf binary form.
|
||||
func (i *NetworkInfo) Marshal() ([]byte, error) {
|
||||
return (*netmap.NetworkInfo)(i).StableMarshal(nil)
|
||||
return (*netmap.NetworkInfo)(i).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of NetworkInfo.
|
||||
|
|
|
@ -274,7 +274,7 @@ func (a *NodeAttribute) SetParentKeys(keys ...string) {
|
|||
|
||||
// Marshal marshals NodeAttribute into a protobuf binary form.
|
||||
func (a *NodeAttribute) Marshal() ([]byte, error) {
|
||||
return (*netmap.Attribute)(a).StableMarshal(nil)
|
||||
return (*netmap.Attribute)(a).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of NodeAttribute.
|
||||
|
@ -401,7 +401,7 @@ func (i *NodeInfo) SetState(s NodeState) {
|
|||
|
||||
// Marshal marshals NodeInfo into a protobuf binary form.
|
||||
func (i *NodeInfo) Marshal() ([]byte, error) {
|
||||
return (*netmap.NodeInfo)(i).StableMarshal(nil)
|
||||
return (*netmap.NodeInfo)(i).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of NodeInfo.
|
||||
|
|
|
@ -139,7 +139,7 @@ func (p *PlacementPolicy) SetFilters(fs ...Filter) {
|
|||
|
||||
// Marshal marshals PlacementPolicy into a protobuf binary form.
|
||||
func (p *PlacementPolicy) Marshal() ([]byte, error) {
|
||||
return (*netmap.PlacementPolicy)(p).StableMarshal(nil)
|
||||
return (*netmap.PlacementPolicy)(p).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of PlacementPolicy.
|
||||
|
|
|
@ -52,7 +52,7 @@ func (r *Replica) SetSelector(s string) {
|
|||
|
||||
// Marshal marshals Replica into a protobuf binary form.
|
||||
func (r *Replica) Marshal() ([]byte, error) {
|
||||
return (*netmap.Replica)(r).StableMarshal(nil)
|
||||
return (*netmap.Replica)(r).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of Replica.
|
||||
|
|
|
@ -256,7 +256,7 @@ func (s *Selector) SetFilter(f string) {
|
|||
|
||||
// Marshal marshals Selector into a protobuf binary form.
|
||||
func (s *Selector) Marshal() ([]byte, error) {
|
||||
return (*netmap.Selector)(s).StableMarshal(nil)
|
||||
return (*netmap.Selector)(s).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of Selector.
|
||||
|
|
|
@ -99,7 +99,7 @@ func (a *Address) String() string {
|
|||
|
||||
// Marshal marshals Address into a protobuf binary form.
|
||||
func (a *Address) Marshal() ([]byte, error) {
|
||||
return (*refs.Address)(a).StableMarshal(nil)
|
||||
return (*refs.Address)(a).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of Address.
|
||||
|
|
|
@ -54,7 +54,7 @@ func (a *Attribute) ToV2() *object.Attribute {
|
|||
|
||||
// Marshal marshals Attribute into a protobuf binary form.
|
||||
func (a *Attribute) Marshal() ([]byte, error) {
|
||||
return (*object.Attribute)(a).StableMarshal(nil)
|
||||
return (*object.Attribute)(a).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of Attribute.
|
||||
|
|
|
@ -47,10 +47,7 @@ func VerifyPayloadChecksum(obj *Object) error {
|
|||
|
||||
// CalculateID calculates identifier for the object.
|
||||
func CalculateID(obj *Object) (*oid.ID, error) {
|
||||
data, err := obj.ToV2().GetHeader().StableMarshal(nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
data := obj.ToV2().GetHeader().StableMarshal(nil)
|
||||
|
||||
id := oid.NewID()
|
||||
id.SetSHA256(sha256.Sum256(data))
|
||||
|
|
|
@ -73,7 +73,7 @@ func (id *ID) String() string {
|
|||
|
||||
// Marshal marshals ID into a protobuf binary form.
|
||||
func (id *ID) Marshal() ([]byte, error) {
|
||||
return (*refs.ObjectID)(id).StableMarshal(nil)
|
||||
return (*refs.ObjectID)(id).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of ID.
|
||||
|
|
|
@ -64,12 +64,7 @@ func (x *Lock) WriteMembers(ids []oid.ID) {
|
|||
|
||||
// Marshal encodes the Lock into a NeoFS protocol binary format.
|
||||
func (x Lock) Marshal() []byte {
|
||||
data, err := (*v2object.Lock)(&x).StableMarshal(nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return data
|
||||
return (*v2object.Lock)(&x).StableMarshal(nil)
|
||||
}
|
||||
|
||||
// Unmarshal decodes the Lock from its NeoFS protocol binary representation.
|
||||
|
|
|
@ -494,7 +494,7 @@ func (o *Object) InitRelations() {
|
|||
|
||||
// Marshal marshals object into a protobuf binary form.
|
||||
func (o *Object) Marshal() ([]byte, error) {
|
||||
return (*object.Object)(o).StableMarshal(nil)
|
||||
return (*object.Object)(o).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of object.
|
||||
|
|
|
@ -59,7 +59,7 @@ func (s *SplitInfo) SetLink(v *oid.ID) {
|
|||
}
|
||||
|
||||
func (s *SplitInfo) Marshal() ([]byte, error) {
|
||||
return (*object.SplitInfo)(s).StableMarshal(nil)
|
||||
return (*object.SplitInfo)(s).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
func (s *SplitInfo) Unmarshal(data []byte) error {
|
||||
|
|
|
@ -96,7 +96,7 @@ func (t *Tombstone) SetMembers(v []oid.ID) {
|
|||
|
||||
// Marshal marshals Tombstone into a protobuf binary form.
|
||||
func (t *Tombstone) Marshal() ([]byte, error) {
|
||||
return (*tombstone.Tombstone)(t).StableMarshal(nil)
|
||||
return (*tombstone.Tombstone)(t).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of Tombstone.
|
||||
|
|
|
@ -127,7 +127,7 @@ func valid(rawID []byte) bool {
|
|||
|
||||
// Marshal marshals ID into a protobuf binary form.
|
||||
func (id *ID) Marshal() ([]byte, error) {
|
||||
return (*refs.OwnerID)(id).StableMarshal(nil)
|
||||
return (*refs.OwnerID)(id).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of ID.
|
||||
|
|
|
@ -65,7 +65,7 @@ func (x *PeerID) String() string {
|
|||
|
||||
// Marshal marshals PeerID into a protobuf binary form.
|
||||
func (x *PeerID) Marshal() ([]byte, error) {
|
||||
return (*reputation.PeerID)(x).StableMarshal(nil)
|
||||
return (*reputation.PeerID)(x).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of PeerID.
|
||||
|
|
|
@ -76,7 +76,7 @@ func (x *Trust) Value() float64 {
|
|||
|
||||
// Marshal marshals Trust into a protobuf binary form.
|
||||
func (x *Trust) Marshal() ([]byte, error) {
|
||||
return (*reputation.Trust)(x).StableMarshal(nil)
|
||||
return (*reputation.Trust)(x).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of Trust.
|
||||
|
@ -149,7 +149,7 @@ func (x *PeerToPeerTrust) Trust() *Trust {
|
|||
|
||||
// Marshal marshals PeerToPeerTrust into a protobuf binary form.
|
||||
func (x *PeerToPeerTrust) Marshal() ([]byte, error) {
|
||||
return (*reputation.PeerToPeerTrust)(x).StableMarshal(nil)
|
||||
return (*reputation.PeerToPeerTrust)(x).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of PeerToPeerTrust.
|
||||
|
@ -287,7 +287,7 @@ func (x *GlobalTrust) VerifySignature() error {
|
|||
|
||||
// Marshal marshals GlobalTrust into a protobuf binary form.
|
||||
func (x *GlobalTrust) Marshal() ([]byte, error) {
|
||||
return (*reputation.GlobalTrust)(x).StableMarshal(nil)
|
||||
return (*reputation.GlobalTrust)(x).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of GlobalTrust.
|
||||
|
|
|
@ -116,7 +116,7 @@ func (x *ContainerContext) IsForSetEACL() bool {
|
|||
|
||||
// Marshal marshals ContainerContext into a protobuf binary form.
|
||||
func (x *ContainerContext) Marshal() ([]byte, error) {
|
||||
return x.ToV2().StableMarshal(nil)
|
||||
return x.ToV2().StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of ContainerContext.
|
||||
|
|
|
@ -147,7 +147,7 @@ func (x *ObjectContext) IsForRangeHash() bool {
|
|||
|
||||
// Marshal marshals ObjectContext into a protobuf binary form.
|
||||
func (x *ObjectContext) Marshal() ([]byte, error) {
|
||||
return x.ToV2().StableMarshal(nil)
|
||||
return x.ToV2().StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of ObjectContext.
|
||||
|
|
|
@ -248,8 +248,7 @@ func GetContainerContext(t *Token) *ContainerContext {
|
|||
|
||||
// Marshal marshals Token into a protobuf binary form.
|
||||
func (t *Token) Marshal() ([]byte, error) {
|
||||
return (*session.Token)(t).
|
||||
StableMarshal(nil)
|
||||
return (*session.Token)(t).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of Token.
|
||||
|
|
|
@ -75,7 +75,7 @@ func (s *Signature) ToV2() *refs.Signature {
|
|||
|
||||
// Marshal marshals Signature into a protobuf binary form.
|
||||
func (s *Signature) Marshal() ([]byte, error) {
|
||||
return (*refs.Signature)(s).StableMarshal(nil)
|
||||
return (*refs.Signature)(s).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of Signature.
|
||||
|
|
|
@ -116,7 +116,7 @@ func (sg *StorageGroup) ToV2() *storagegroup.StorageGroup {
|
|||
|
||||
// Marshal marshals StorageGroup into a protobuf binary form.
|
||||
func (sg *StorageGroup) Marshal() ([]byte, error) {
|
||||
return (*storagegroup.StorageGroup)(sg).StableMarshal(nil)
|
||||
return (*storagegroup.StorageGroup)(sg).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of StorageGroup.
|
||||
|
|
|
@ -67,7 +67,7 @@ func (x *ID) String() string {
|
|||
|
||||
// Marshal encodes ID into a binary format of NeoFS API V2 protocol (Protocol Buffers with direct field order).
|
||||
func (x *ID) Marshal() ([]byte, error) {
|
||||
return (*refs.SubnetID)(x).StableMarshal(nil)
|
||||
return (*refs.SubnetID)(x).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal decodes ID from NeoFS API V2 binary format (see Marshal). Must not be called on nil.
|
||||
|
|
|
@ -26,7 +26,7 @@ func (x Info) WriteToV2(msg *subnet.Info) {
|
|||
|
||||
// Marshal encodes Info into a binary format of NeoFS API V2 protocol (Protocol Buffers with direct field order).
|
||||
func (x *Info) Marshal() ([]byte, error) {
|
||||
return (*subnet.Info)(x).StableMarshal(nil)
|
||||
return (*subnet.Info)(x).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal decodes Info from NeoFS API V2 binary format (see Marshal). Must not be called on nil.
|
||||
|
|
|
@ -191,8 +191,7 @@ func (b *BearerToken) Marshal(bs ...[]byte) ([]byte, error) {
|
|||
buf = bs[0]
|
||||
}
|
||||
|
||||
return b.ToV2().
|
||||
StableMarshal(buf)
|
||||
return b.ToV2().StableMarshal(buf), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of BearerToken.
|
||||
|
|
|
@ -70,7 +70,7 @@ func (v *Version) String() string {
|
|||
|
||||
// Marshal marshals Version into a protobuf binary form.
|
||||
func (v *Version) Marshal() ([]byte, error) {
|
||||
return (*refs.Version)(v).StableMarshal(nil)
|
||||
return (*refs.Version)(v).StableMarshal(nil), nil
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals protobuf binary representation of Version.
|
||||
|
|
Loading…
Reference in a new issue