[#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
|
@ -2,9 +2,9 @@ package object
|
|||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg"
|
||||
"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/pkg/owner"
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/token"
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/session"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/refs"
|
||||
)
|
||||
|
@ -108,15 +108,15 @@ func (o *rwObject) setPayloadSize(v uint64) {
|
|||
}
|
||||
|
||||
// ContainerID returns identifier of the related container.
|
||||
func (o *rwObject) ContainerID() *container.ID {
|
||||
return container.NewIDFromV2(
|
||||
func (o *rwObject) ContainerID() *cid.ID {
|
||||
return cid.NewFromV2(
|
||||
(*object.Object)(o).
|
||||
GetHeader().
|
||||
GetContainerID(),
|
||||
)
|
||||
}
|
||||
|
||||
func (o *rwObject) setContainerID(v *container.ID) {
|
||||
func (o *rwObject) setContainerID(v *cid.ID) {
|
||||
o.setHeaderField(func(h *object.Header) {
|
||||
h.SetContainerID(v.ToV2())
|
||||
})
|
||||
|
@ -327,15 +327,15 @@ func (o *rwObject) resetRelations() {
|
|||
|
||||
// SessionToken returns token of the session
|
||||
// within which object was created.
|
||||
func (o *rwObject) SessionToken() *token.SessionToken {
|
||||
return token.NewSessionTokenFromV2(
|
||||
func (o *rwObject) SessionToken() *session.Token {
|
||||
return session.NewTokenFromV2(
|
||||
(*object.Object)(o).
|
||||
GetHeader().
|
||||
GetSessionToken(),
|
||||
)
|
||||
}
|
||||
|
||||
func (o *rwObject) setSessionToken(v *token.SessionToken) {
|
||||
func (o *rwObject) setSessionToken(v *session.Token) {
|
||||
o.setHeaderField(func(h *object.Header) {
|
||||
h.SetSessionToken(v.ToV2())
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue