forked from TrueCloudLab/frostfs-api-go
[#295] pkg: Remove usage of deprecated elements
Remove usage of deprecated of `container.ID` and `token.SessionToken` code elements. Replace using of custom message generators with the ones provided by packages. Replace string comparison with `Equal` method call. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
89be8d3f5a
commit
65080c8b69
22 changed files with 97 additions and 209 deletions
|
@ -4,7 +4,7 @@ import (
|
|||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/container"
|
||||
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/refs"
|
||||
)
|
||||
|
||||
|
@ -36,14 +36,14 @@ func (a *Address) ToV2() *refs.Address {
|
|||
}
|
||||
|
||||
// ContainerID returns container identifier.
|
||||
func (a *Address) ContainerID() *container.ID {
|
||||
return container.NewIDFromV2(
|
||||
func (a *Address) ContainerID() *cid.ID {
|
||||
return cid.NewFromV2(
|
||||
(*refs.Address)(a).GetContainerID(),
|
||||
)
|
||||
}
|
||||
|
||||
// SetContainerID sets container identifier.
|
||||
func (a *Address) SetContainerID(id *container.ID) {
|
||||
func (a *Address) SetContainerID(id *cid.ID) {
|
||||
(*refs.Address)(a).SetContainerID(id.ToV2())
|
||||
}
|
||||
|
||||
|
@ -64,20 +64,20 @@ func (a *Address) Parse(s string) error {
|
|||
var (
|
||||
err error
|
||||
oid = NewID()
|
||||
cid = container.NewID()
|
||||
id = cid.New()
|
||||
parts = strings.Split(s, addressSeparator)
|
||||
)
|
||||
|
||||
if len(parts) != addressParts {
|
||||
return errInvalidAddressString
|
||||
} else if err = cid.Parse(parts[0]); err != nil {
|
||||
} else if err = id.Parse(parts[0]); err != nil {
|
||||
return err
|
||||
} else if err = oid.Parse(parts[1]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
a.SetObjectID(oid)
|
||||
a.SetContainerID(cid)
|
||||
a.SetContainerID(id)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue