[#30] core/object: Remove redundant Address type

Remove Address type. Makes Address method of the Object to return NeoFS SDK
Address type. Makes local storage to work with NeoFS SDK object address.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-09-16 15:07:23 +03:00 committed by Alex Vanin
parent 8366c146d7
commit 4326ff56a7
4 changed files with 11 additions and 42 deletions

View file

@ -1,30 +0,0 @@
package object
import (
"github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-api-go/v2/refs"
)
type Address struct {
*object.Address
}
// MarshalStableV2 marshals Address to v2 binary format.
func (a *Address) MarshalStableV2() ([]byte, error) {
if a != nil {
return a.ToV2().StableMarshal(nil)
}
return nil, nil
}
// AddressFromV2 converts v2 Address message to Address.
func AddressFromV2(aV2 *refs.Address) *Address {
if aV2 == nil {
return nil
}
return &Address{
Address: object.NewAddressFromV2(aV2),
}
}

View file

@ -25,15 +25,13 @@ func (o *Object) MarshalStableV2() ([]byte, error) {
}
// Address returns address of the object.
func (o *Object) Address() *Address {
func (o *Object) Address() *object.Address {
if o != nil {
aV2 := new(refs.Address)
aV2.SetObjectID(o.GetID().ToV2())
aV2.SetContainerID(o.GetContainerID().ToV2())
return &Address{
Address: object.NewAddressFromV2(aV2),
}
return object.NewAddressFromV2(aV2)
}
return nil