[#131] client: Name all methods and types the same way

Inherit name format of object operations in all other ones.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-02-17 19:10:49 +03:00 committed by LeL
parent 998bae3f1c
commit 69ffface78
16 changed files with 235 additions and 235 deletions

View file

@ -49,7 +49,7 @@ c, _ := client.New(
ctx, cancel := context.WithTimeout(context.Background(), 5 * time.Second)
defer cancel()
res, err := c.GetBalance(ctx, owner)
res, err := c.BalanceGet(ctx, owner)
if err != nil {
return
}

View file

@ -10,38 +10,38 @@ import (
"github.com/nspcc-dev/neofs-sdk-go/owner"
)
// GetBalancePrm groups parameters of GetBalance operation.
type GetBalancePrm struct {
// PrmBalanceGet groups parameters of BalanceGet operation.
type PrmBalanceGet struct {
ownerSet bool
ownerID owner.ID
}
// SetAccount sets identifier of the NeoFS account for which the balance is requested.
// Required parameter. Must be a valid ID according to NeoFS API protocol.
func (x *GetBalancePrm) SetAccount(id owner.ID) {
func (x *PrmBalanceGet) SetAccount(id owner.ID) {
x.ownerID = id
x.ownerSet = true
}
// GetBalanceRes groups resulting values of GetBalance operation.
type GetBalanceRes struct {
// ResBalanceGet groups resulting values of BalanceGet operation.
type ResBalanceGet struct {
statusRes
amount *accounting.Decimal
}
func (x *GetBalanceRes) setAmount(v *accounting.Decimal) {
func (x *ResBalanceGet) setAmount(v *accounting.Decimal) {
x.amount = v
}
// Amount returns current amount of funds on the NeoFS account as decimal number.
//
// Client doesn't retain value so modification is safe.
func (x GetBalanceRes) Amount() *accounting.Decimal {
func (x ResBalanceGet) Amount() *accounting.Decimal {
return x.amount
}
// GetBalance requests current balance of the NeoFS account.
// BalanceGet requests current balance of the NeoFS account.
//
// Exactly one return value is non-nil. By default, server status is returned in res structure.
// Any client's internal or transport errors are returned as `error`,
@ -49,12 +49,12 @@ func (x GetBalanceRes) Amount() *accounting.Decimal {
// NeoFS status codes are returned as `error`, otherwise, are included
// in the returned result structure.
//
// Immediately panics if parameters are set incorrectly (see GetBalancePrm docs).
// Immediately panics if parameters are set incorrectly (see PrmBalanceGet docs).
// Context is required and must not be nil. It is used for network communication.
//
// Return statuses:
// - global (see Client docs).
func (c *Client) GetBalance(ctx context.Context, prm GetBalancePrm) (*GetBalanceRes, error) {
func (c *Client) BalanceGet(ctx context.Context, prm PrmBalanceGet) (*ResBalanceGet, error) {
switch {
case ctx == nil:
panic(panicMsgMissingContext)
@ -78,7 +78,7 @@ func (c *Client) GetBalance(ctx context.Context, prm GetBalancePrm) (*GetBalance
var (
cc contextCall
res GetBalanceRes
res ResBalanceGet
)
c.initCallContext(&cc)

View file

@ -18,21 +18,21 @@ import (
sigutil "github.com/nspcc-dev/neofs-sdk-go/util/signature"
)
// ContainerPutPrm groups parameters of PutContainer operation.
type ContainerPutPrm struct {
// PrmContainerPut groups parameters of ContainerPut operation.
type PrmContainerPut struct {
cnrSet bool
cnr container.Container
}
// SetContainer sets structured information about new NeoFS container.
// Required parameter.
func (x *ContainerPutPrm) SetContainer(cnr container.Container) {
func (x *PrmContainerPut) SetContainer(cnr container.Container) {
x.cnr = cnr
x.cnrSet = true
}
// ContainerPutRes groups resulting values of PutContainer operation.
type ContainerPutRes struct {
// ResContainerPut groups resulting values of ContainerPut operation.
type ResContainerPut struct {
statusRes
id *cid.ID
@ -43,15 +43,15 @@ type ContainerPutRes struct {
// asynchronously check if the save was successful).
//
// Client doesn't retain value so modification is safe.
func (x ContainerPutRes) ID() *cid.ID {
func (x ResContainerPut) ID() *cid.ID {
return x.id
}
func (x *ContainerPutRes) setID(id *cid.ID) {
func (x *ResContainerPut) setID(id *cid.ID) {
x.id = id
}
// PutContainer sends request to save container in NeoFS.
// ContainerPut sends request to save container in NeoFS.
//
// Exactly one return value is non-nil. By default, server status is returned in res structure.
// Any client's internal or transport errors are returned as `error`.
@ -62,14 +62,14 @@ func (x *ContainerPutRes) setID(id *cid.ID) {
// Operation is asynchronous and no guaranteed even in the absence of errors.
// The required time is also not predictable.
//
// Success can be verified by reading by identifier (see ContainerPutRes.ID).
// Success can be verified by reading by identifier (see ResContainerPut.ID).
//
// Immediately panics if parameters are set incorrectly (see ContainerPutPrm docs).
// Immediately panics if parameters are set incorrectly (see PrmContainerPut docs).
// Context is required and must not be nil. It is used for network communication.
//
// Return statuses:
// - global (see Client docs).
func (c *Client) PutContainer(ctx context.Context, prm ContainerPutPrm) (*ContainerPutRes, error) {
func (c *Client) ContainerPut(ctx context.Context, prm PrmContainerPut) (*ResContainerPut, error) {
// check parameters
switch {
case ctx == nil:
@ -111,7 +111,7 @@ func (c *Client) PutContainer(ctx context.Context, prm ContainerPutPrm) (*Contai
var (
cc contextCall
res ContainerPutRes
res ResContainerPut
)
c.initCallContext(&cc)
@ -133,21 +133,21 @@ func (c *Client) PutContainer(ctx context.Context, prm ContainerPutPrm) (*Contai
return &res, nil
}
// ContainerGetPrm groups parameters of GetContainer operation.
type ContainerGetPrm struct {
// PrmContainerGet groups parameters of ContainerGet operation.
type PrmContainerGet struct {
idSet bool
id cid.ID
}
// SetContainer sets identifier of the container to be read.
// Required parameter.
func (x *ContainerGetPrm) SetContainer(id cid.ID) {
func (x *PrmContainerGet) SetContainer(id cid.ID) {
x.id = id
x.idSet = true
}
// ContainerGetRes groups resulting values of GetContainer operation.
type ContainerGetRes struct {
// ResContainerGet groups resulting values of ContainerGet operation.
type ResContainerGet struct {
statusRes
cnr *container.Container
@ -156,15 +156,15 @@ type ContainerGetRes struct {
// Container returns structured information about the requested container.
//
// Client doesn't retain value so modification is safe.
func (x ContainerGetRes) Container() *container.Container {
func (x ResContainerGet) Container() *container.Container {
return x.cnr
}
func (x *ContainerGetRes) setContainer(cnr *container.Container) {
func (x *ResContainerGet) setContainer(cnr *container.Container) {
x.cnr = cnr
}
// GetContainer reads NeoFS container by ID.
// ContainerGet reads NeoFS container by ID.
//
// Exactly one return value is non-nil. By default, server status is returned in res structure.
// Any client's internal or transport errors are returned as `error`.
@ -172,12 +172,12 @@ func (x *ContainerGetRes) setContainer(cnr *container.Container) {
// NeoFS status codes are returned as `error`, otherwise, are included
// in the returned result structure.
//
// Immediately panics if parameters are set incorrectly (see ContainerGetPrm docs).
// Immediately panics if parameters are set incorrectly (see PrmContainerGet docs).
// Context is required and must not be nil. It is used for network communication.
//
// Return statuses:
// - global (see Client docs).
func (c *Client) GetContainer(ctx context.Context, prm ContainerGetPrm) (*ContainerGetRes, error) {
func (c *Client) ContainerGet(ctx context.Context, prm PrmContainerGet) (*ResContainerGet, error) {
switch {
case ctx == nil:
panic(panicMsgMissingContext)
@ -198,7 +198,7 @@ func (c *Client) GetContainer(ctx context.Context, prm ContainerGetPrm) (*Contai
var (
cc contextCall
res ContainerGetRes
res ResContainerGet
)
c.initCallContext(&cc)
@ -233,21 +233,21 @@ func (c *Client) GetContainer(ctx context.Context, prm ContainerGetPrm) (*Contai
return &res, nil
}
// ContainerListPrm groups parameters of ListContainers operation.
type ContainerListPrm struct {
// PrmContainerList groups parameters of ContainerList operation.
type PrmContainerList struct {
ownerSet bool
ownerID owner.ID
}
// SetAccount sets identifier of the NeoFS account to list the containers.
// Required parameter. Must be a valid ID according to NeoFS API protocol.
func (x *ContainerListPrm) SetAccount(id owner.ID) {
func (x *PrmContainerList) SetAccount(id owner.ID) {
x.ownerID = id
x.ownerSet = true
}
// ContainerListRes groups resulting values of ListContainers operation.
type ContainerListRes struct {
// ResContainerList groups resulting values of ContainerList operation.
type ResContainerList struct {
statusRes
ids []*cid.ID
@ -256,15 +256,15 @@ type ContainerListRes struct {
// Containers returns list of identifiers of the account-owned containers.
//
// Client doesn't retain value so modification is safe.
func (x ContainerListRes) Containers() []*cid.ID {
func (x ResContainerList) Containers() []*cid.ID {
return x.ids
}
func (x *ContainerListRes) setContainers(ids []*cid.ID) {
func (x *ResContainerList) setContainers(ids []*cid.ID) {
x.ids = ids
}
// ListContainers requests identifiers of the account-owned containers.
// ContainerList requests identifiers of the account-owned containers.
//
// Exactly one return value is non-nil. By default, server status is returned in res structure.
// Any client's internal or transport errors are returned as `error`.
@ -272,12 +272,12 @@ func (x *ContainerListRes) setContainers(ids []*cid.ID) {
// NeoFS status codes are returned as `error`, otherwise, are included
// in the returned result structure.
//
// Immediately panics if parameters are set incorrectly (see ContainerListPrm docs).
// Immediately panics if parameters are set incorrectly (see PrmContainerList docs).
// Context is required and must not be nil. It is used for network communication.
//
// Return statuses:
// - global (see Client docs).
func (c *Client) ListContainers(ctx context.Context, prm ContainerListPrm) (*ContainerListRes, error) {
func (c *Client) ContainerList(ctx context.Context, prm PrmContainerList) (*ResContainerList, error) {
// check parameters
switch {
case ctx == nil:
@ -301,7 +301,7 @@ func (c *Client) ListContainers(ctx context.Context, prm ContainerListPrm) (*Con
var (
cc contextCall
res ContainerListRes
res ResContainerList
)
c.initCallContext(&cc)
@ -330,8 +330,8 @@ func (c *Client) ListContainers(ctx context.Context, prm ContainerListPrm) (*Con
return &res, nil
}
// ContainerDeletePrm groups parameters of DeleteContainer operation.
type ContainerDeletePrm struct {
// PrmContainerDelete groups parameters of ContainerDelete operation.
type PrmContainerDelete struct {
prmSession
idSet bool
@ -340,13 +340,13 @@ type ContainerDeletePrm struct {
// SetContainer sets identifier of the NeoFS container to be removed.
// Required parameter.
func (x *ContainerDeletePrm) SetContainer(id cid.ID) {
func (x *PrmContainerDelete) SetContainer(id cid.ID) {
x.id = id
x.idSet = true
}
// ContainerDeleteRes groups resulting values of DeleteContainer operation.
type ContainerDeleteRes struct {
// ResContainerDelete groups resulting values of ContainerDelete operation.
type ResContainerDelete struct {
statusRes
}
@ -363,7 +363,7 @@ func (c delContainerSignWrapper) SignedDataSize() int {
return len(c.body.GetContainerID().GetValue())
}
// DeleteContainer sends request to remove the NeoFS container.
// ContainerDelete sends request to remove the NeoFS container.
//
// Exactly one return value is non-nil. By default, server status is returned in res structure.
// Any client's internal or transport errors are returned as `error`.
@ -376,15 +376,15 @@ func (c delContainerSignWrapper) SignedDataSize() int {
//
// Success can be verified by reading by identifier (see GetContainer).
//
// Immediately panics if parameters are set incorrectly (see ContainerDeletePrm docs).
// Immediately panics if parameters are set incorrectly (see PrmContainerDelete docs).
// Context is required and must not be nil. It is used for network communication.
//
// Exactly one return value is non-nil. Server status return is returned in ContainerDeleteRes.
// Exactly one return value is non-nil. Server status return is returned in ResContainerDelete.
// Reflects all internal errors in second return value (transport problems, response processing, etc.).
//
// Return statuses:
// - global (see Client docs).
func (c *Client) DeleteContainer(ctx context.Context, prm ContainerDeletePrm) (*ContainerDeleteRes, error) {
func (c *Client) ContainerDelete(ctx context.Context, prm PrmContainerDelete) (*ResContainerDelete, error) {
// check parameters
switch {
case ctx == nil:
@ -428,7 +428,7 @@ func (c *Client) DeleteContainer(ctx context.Context, prm ContainerDeletePrm) (*
var (
cc contextCall
res ContainerDeleteRes
res ResContainerDelete
)
c.initCallContext(&cc)
@ -446,21 +446,21 @@ func (c *Client) DeleteContainer(ctx context.Context, prm ContainerDeletePrm) (*
return &res, nil
}
// EACLPrm groups parameters of EACL operation.
type EACLPrm struct {
// PrmContainerEACL groups parameters of ContainerEACL operation.
type PrmContainerEACL struct {
idSet bool
id cid.ID
}
// SetContainer sets identifier of the NeoFS container to read the eACL table.
// Required parameter.
func (x *EACLPrm) SetContainer(id cid.ID) {
func (x *PrmContainerEACL) SetContainer(id cid.ID) {
x.id = id
x.idSet = true
}
// EACLRes groups resulting values of EACL operation.
type EACLRes struct {
// ResContainerEACL groups resulting values of ContainerEACL operation.
type ResContainerEACL struct {
statusRes
table *eacl.Table
@ -469,15 +469,15 @@ type EACLRes struct {
// Table returns eACL table of the requested container.
//
// Client doesn't retain value so modification is safe.
func (x EACLRes) Table() *eacl.Table {
func (x ResContainerEACL) Table() *eacl.Table {
return x.table
}
func (x *EACLRes) setTable(table *eacl.Table) {
func (x *ResContainerEACL) setTable(table *eacl.Table) {
x.table = table
}
// EACL reads eACL table of the NeoFS container.
// ContainerEACL reads eACL table of the NeoFS container.
//
// Exactly one return value is non-nil. By default, server status is returned in res structure.
// Any client's internal or transport errors are returned as `error`.
@ -485,12 +485,12 @@ func (x *EACLRes) setTable(table *eacl.Table) {
// NeoFS status codes are returned as `error`, otherwise, are included
// in the returned result structure.
//
// Immediately panics if parameters are set incorrectly (see EACLPrm docs).
// Immediately panics if parameters are set incorrectly (see PrmContainerEACL docs).
// Context is required and must not be nil. It is used for network communication.
//
// Return statuses:
// - global (see Client docs).
func (c *Client) EACL(ctx context.Context, prm EACLPrm) (*EACLRes, error) {
func (c *Client) ContainerEACL(ctx context.Context, prm PrmContainerEACL) (*ResContainerEACL, error) {
// check parameters
switch {
case ctx == nil:
@ -512,7 +512,7 @@ func (c *Client) EACL(ctx context.Context, prm EACLPrm) (*EACLRes, error) {
var (
cc contextCall
res EACLRes
res ResContainerEACL
)
c.initCallContext(&cc)
@ -547,25 +547,25 @@ func (c *Client) EACL(ctx context.Context, prm EACLPrm) (*EACLRes, error) {
return &res, nil
}
// SetEACLPrm groups parameters of SetEACL operation.
type SetEACLPrm struct {
// PrmContainerSetEACL groups parameters of ContainerSetEACL operation.
type PrmContainerSetEACL struct {
tableSet bool
table eacl.Table
}
// SetTable sets eACL table structure to be set for the container.
// Required parameter.
func (x *SetEACLPrm) SetTable(table eacl.Table) {
func (x *PrmContainerSetEACL) SetTable(table eacl.Table) {
x.table = table
x.tableSet = true
}
// SetEACLRes groups resulting values of SetEACL operation.
type SetEACLRes struct {
// ResContainerSetEACL groups resulting values of ContainerSetEACL operation.
type ResContainerSetEACL struct {
statusRes
}
// SetEACL sends request to update eACL table of the NeoFS container.
// ContainerSetEACL sends request to update eACL table of the NeoFS container.
//
// Exactly one return value is non-nil. By default, server status is returned in res structure.
// Any client's internal or transport errors are returned as `error`.
@ -578,12 +578,12 @@ type SetEACLRes struct {
//
// Success can be verified by reading by identifier (see EACL).
//
// Immediately panics if parameters are set incorrectly (see SetEACLPrm docs).
// Immediately panics if parameters are set incorrectly (see PrmContainerSetEACL docs).
// Context is required and must not be nil. It is used for network communication.
//
// Return statuses:
// - global (see Client docs).
func (c *Client) SetEACL(ctx context.Context, prm SetEACLPrm) (*SetEACLRes, error) {
func (c *Client) ContainerSetEACL(ctx context.Context, prm PrmContainerSetEACL) (*ResContainerSetEACL, error) {
// check parameters
switch {
case ctx == nil:
@ -623,7 +623,7 @@ func (c *Client) SetEACL(ctx context.Context, prm SetEACLPrm) (*SetEACLRes, erro
var (
cc contextCall
res SetEACLRes
res ResContainerSetEACL
)
c.initCallContext(&cc)
@ -641,8 +641,8 @@ func (c *Client) SetEACL(ctx context.Context, prm SetEACLPrm) (*SetEACLRes, erro
return &res, nil
}
// AnnounceSpacePrm groups parameters of AnnounceContainerUsedSpace operation.
type AnnounceSpacePrm struct {
// PrmAnnounceSpace groups parameters of ContainerAnnounceUsedSpace operation.
type PrmAnnounceSpace struct {
announcements []container.UsedSpaceAnnouncement
}
@ -650,16 +650,16 @@ type AnnounceSpacePrm struct {
// Required parameter. Must not be empty.
//
// Must not be mutated before the end of the operation.
func (x *AnnounceSpacePrm) SetValues(announcements []container.UsedSpaceAnnouncement) {
func (x *PrmAnnounceSpace) SetValues(announcements []container.UsedSpaceAnnouncement) {
x.announcements = announcements
}
// AnnounceSpaceRes groups resulting values of AnnounceContainerUsedSpace operation.
type AnnounceSpaceRes struct {
// ResAnnounceSpace groups resulting values of ContainerAnnounceUsedSpace operation.
type ResAnnounceSpace struct {
statusRes
}
// AnnounceContainerUsedSpace sends request to announce volume of the space used for the container objects.
// ContainerAnnounceUsedSpace sends request to announce volume of the space used for the container objects.
//
// Exactly one return value is non-nil. By default, server status is returned in res structure.
// Any client's internal or transport errors are returned as `error`.
@ -672,12 +672,12 @@ type AnnounceSpaceRes struct {
//
// At this moment success can not be checked.
//
// Immediately panics if parameters are set incorrectly (see AnnounceSpacePrm docs).
// Immediately panics if parameters are set incorrectly (see PrmAnnounceSpace docs).
// Context is required and must not be nil. It is used for network communication.
//
// Return statuses:
// - global (see Client docs).
func (c *Client) AnnounceContainerUsedSpace(ctx context.Context, prm AnnounceSpacePrm) (*AnnounceSpaceRes, error) {
func (c *Client) ContainerAnnounceUsedSpace(ctx context.Context, prm PrmAnnounceSpace) (*ResAnnounceSpace, error) {
// check parameters
switch {
case ctx == nil:
@ -705,7 +705,7 @@ func (c *Client) AnnounceContainerUsedSpace(ctx context.Context, prm AnnounceSpa
var (
cc contextCall
res AnnounceSpaceRes
res ResAnnounceSpace
)
c.initCallContext(&cc)

View file

@ -10,14 +10,14 @@ import (
"github.com/nspcc-dev/neofs-sdk-go/version"
)
// EndpointInfoPrm groups parameters of EndpointInfo operation.
// PrmEndpointInfo groups parameters of EndpointInfo operation.
//
// At the moment the operation is not parameterized, however,
// the structure is still declared for backward compatibility.
type EndpointInfoPrm struct{}
type PrmEndpointInfo struct{}
// EndpointInfoRes group resulting values of EndpointInfo operation.
type EndpointInfoRes struct {
// ResEndpointInfo group resulting values of EndpointInfo operation.
type ResEndpointInfo struct {
statusRes
version *version.Version
@ -28,22 +28,22 @@ type EndpointInfoRes struct {
// LatestVersion returns latest NeoFS API protocol's version in use.
//
// Client doesn't retain value so modification is safe.
func (x EndpointInfoRes) LatestVersion() *version.Version {
func (x ResEndpointInfo) LatestVersion() *version.Version {
return x.version
}
func (x *EndpointInfoRes) setLatestVersion(ver *version.Version) {
func (x *ResEndpointInfo) setLatestVersion(ver *version.Version) {
x.version = ver
}
// NodeInfo returns information about the NeoFS node served on the remote endpoint.
//
// Client doesn't retain value so modification is safe.
func (x EndpointInfoRes) NodeInfo() *netmap.NodeInfo {
func (x ResEndpointInfo) NodeInfo() *netmap.NodeInfo {
return x.ni
}
func (x *EndpointInfoRes) setNodeInfo(info *netmap.NodeInfo) {
func (x *ResEndpointInfo) setNodeInfo(info *netmap.NodeInfo) {
x.ni = info
}
@ -56,15 +56,15 @@ func (x *EndpointInfoRes) setNodeInfo(info *netmap.NodeInfo) {
// NeoFS status codes are returned as `error`, otherwise, are included
// in the returned result structure.
//
// Immediately panics if parameters are set incorrectly (see EndpointInfoPrm docs).
// Immediately panics if parameters are set incorrectly (see PrmEndpointInfo docs).
// Context is required and must not be nil. It is used for network communication.
//
// Exactly one return value is non-nil. Server status return is returned in EndpointInfoRes.
// Exactly one return value is non-nil. Server status return is returned in ResEndpointInfo.
// Reflects all internal errors in second return value (transport problems, response processing, etc.).
//
// Return statuses:
// - global (see Client docs).
func (c *Client) EndpointInfo(ctx context.Context, _ EndpointInfoPrm) (*EndpointInfoRes, error) {
func (c *Client) EndpointInfo(ctx context.Context, _ PrmEndpointInfo) (*ResEndpointInfo, error) {
// check context
if ctx == nil {
panic(panicMsgMissingContext)
@ -77,7 +77,7 @@ func (c *Client) EndpointInfo(ctx context.Context, _ EndpointInfoPrm) (*Endpoint
var (
cc contextCall
res EndpointInfoRes
res ResEndpointInfo
)
c.initCallContext(&cc)
@ -103,14 +103,14 @@ func (c *Client) EndpointInfo(ctx context.Context, _ EndpointInfoPrm) (*Endpoint
return &res, nil
}
// NetworkInfoPrm groups parameters of NetworkInfo operation.
// PrmNetworkInfo groups parameters of NetworkInfo operation.
//
// At the moment the operation is not parameterized, however,
// the structure is still declared for backward compatibility.
type NetworkInfoPrm struct{}
type PrmNetworkInfo struct{}
// NetworkInfoRes groups resulting values of NetworkInfo operation.
type NetworkInfoRes struct {
// ResNetworkInfo groups resulting values of NetworkInfo operation.
type ResNetworkInfo struct {
statusRes
info *netmap.NetworkInfo
@ -119,11 +119,11 @@ type NetworkInfoRes struct {
// Info returns structured information about the NeoFS network.
//
// Client doesn't retain value so modification is safe.
func (x NetworkInfoRes) Info() *netmap.NetworkInfo {
func (x ResNetworkInfo) Info() *netmap.NetworkInfo {
return x.info
}
func (x *NetworkInfoRes) setInfo(info *netmap.NetworkInfo) {
func (x *ResNetworkInfo) setInfo(info *netmap.NetworkInfo) {
x.info = info
}
@ -134,15 +134,15 @@ func (x *NetworkInfoRes) setInfo(info *netmap.NetworkInfo) {
// NeoFS status codes are returned as `error`, otherwise, are included
// in the returned result structure.
//
// Immediately panics if parameters are set incorrectly (see NetworkInfoPrm docs).
// Immediately panics if parameters are set incorrectly (see PrmNetworkInfo docs).
// Context is required and must not be nil. It is used for network communication.
//
// Exactly one return value is non-nil. Server status return is returned in NetworkInfoRes.
// Exactly one return value is non-nil. Server status return is returned in ResNetworkInfo.
// Reflects all internal errors in second return value (transport problems, response processing, etc.).
//
// Return statuses:
// - global (see Client docs).
func (c *Client) NetworkInfo(ctx context.Context, _ NetworkInfoPrm) (*NetworkInfoRes, error) {
func (c *Client) NetworkInfo(ctx context.Context, _ PrmNetworkInfo) (*ResNetworkInfo, error) {
// check context
if ctx == nil {
panic(panicMsgMissingContext)
@ -155,7 +155,7 @@ func (c *Client) NetworkInfo(ctx context.Context, _ NetworkInfoPrm) (*NetworkInf
var (
cc contextCall
res NetworkInfoRes
res ResNetworkInfo
)
c.initCallContext(&cc)

View file

@ -9,8 +9,8 @@ import (
"github.com/nspcc-dev/neofs-sdk-go/reputation"
)
// AnnounceLocalTrustPrm groups parameters of AnnounceLocalTrust operation.
type AnnounceLocalTrustPrm struct {
// PrmAnnounceLocalTrust groups parameters of AnnounceLocalTrust operation.
type PrmAnnounceLocalTrust struct {
epoch uint64
trusts []reputation.Trust
@ -18,7 +18,7 @@ type AnnounceLocalTrustPrm struct {
// SetEpoch sets number of NeoFS epoch in which the trust was assessed.
// Required parameter, must not be zero.
func (x *AnnounceLocalTrustPrm) SetEpoch(epoch uint64) {
func (x *PrmAnnounceLocalTrust) SetEpoch(epoch uint64) {
x.epoch = epoch
}
@ -26,12 +26,12 @@ func (x *AnnounceLocalTrustPrm) SetEpoch(epoch uint64) {
// Required parameter. Must not be empty.
//
// Must not be mutated before the end of the operation.
func (x *AnnounceLocalTrustPrm) SetValues(trusts []reputation.Trust) {
func (x *PrmAnnounceLocalTrust) SetValues(trusts []reputation.Trust) {
x.trusts = trusts
}
// AnnounceLocalTrustRes groups results of AnnounceLocalTrust operation.
type AnnounceLocalTrustRes struct {
// ResAnnounceLocalTrust groups results of AnnounceLocalTrust operation.
type ResAnnounceLocalTrust struct {
statusRes
}
@ -43,12 +43,12 @@ type AnnounceLocalTrustRes struct {
// NeoFS status codes are returned as `error`, otherwise, are included
// in the returned result structure.
//
// Immediately panics if parameters are set incorrectly (see AnnounceLocalTrustPrm docs).
// Immediately panics if parameters are set incorrectly (see PrmAnnounceLocalTrust docs).
// Context is required and must not be nil. It is used for network communication.
//
// Return statuses:
// - global (see Client docs).
func (c *Client) AnnounceLocalTrust(ctx context.Context, prm AnnounceLocalTrustPrm) (*AnnounceLocalTrustRes, error) {
func (c *Client) AnnounceLocalTrust(ctx context.Context, prm PrmAnnounceLocalTrust) (*ResAnnounceLocalTrust, error) {
// check parameters
switch {
case ctx == nil:
@ -80,7 +80,7 @@ func (c *Client) AnnounceLocalTrust(ctx context.Context, prm AnnounceLocalTrustP
var (
cc contextCall
res AnnounceLocalTrustRes
res ResAnnounceLocalTrust
)
c.initCallContext(&cc)
@ -98,8 +98,8 @@ func (c *Client) AnnounceLocalTrust(ctx context.Context, prm AnnounceLocalTrustP
return &res, nil
}
// AnnounceIntermediateTrustPrm groups parameters of AnnounceIntermediateTrust operation.
type AnnounceIntermediateTrustPrm struct {
// PrmAnnounceIntermediateTrust groups parameters of AnnounceIntermediateTrust operation.
type PrmAnnounceIntermediateTrust struct {
epoch uint64
iter uint32
@ -110,25 +110,25 @@ type AnnounceIntermediateTrustPrm struct {
// SetEpoch sets number of NeoFS epoch with which client's calculation algorithm is initialized.
// Required parameter, must not be zero.
func (x *AnnounceIntermediateTrustPrm) SetEpoch(epoch uint64) {
func (x *PrmAnnounceIntermediateTrust) SetEpoch(epoch uint64) {
x.epoch = epoch
}
// SetIteration sets current sequence number of the client's calculation algorithm.
// By default, corresponds to initial (zero) iteration.
func (x *AnnounceIntermediateTrustPrm) SetIteration(iter uint32) {
func (x *PrmAnnounceIntermediateTrust) SetIteration(iter uint32) {
x.iter = iter
}
// SetCurrentValue sets current global trust value computed at the specified iteration
//of the client's calculation algorithm. Required parameter.
func (x *AnnounceIntermediateTrustPrm) SetCurrentValue(trust reputation.PeerToPeerTrust) {
// of the client's calculation algorithm. Required parameter.
func (x *PrmAnnounceIntermediateTrust) SetCurrentValue(trust reputation.PeerToPeerTrust) {
x.trust = trust
x.trustSet = true
}
// AnnounceIntermediateTrustRes groups results of AnnounceIntermediateTrust operation.
type AnnounceIntermediateTrustRes struct {
// ResAnnounceIntermediateTrust groups results of AnnounceIntermediateTrust operation.
type ResAnnounceIntermediateTrust struct {
statusRes
}
@ -141,12 +141,12 @@ type AnnounceIntermediateTrustRes struct {
// NeoFS status codes are returned as `error`, otherwise, are included
// in the returned result structure.
//
// Immediately panics if parameters are set incorrectly (see AnnounceIntermediateTrustPrm docs).
// Immediately panics if parameters are set incorrectly (see PrmAnnounceIntermediateTrust docs).
// Context is required and must not be nil. It is used for network communication.
//
// Return statuses:
// - global (see Client docs).
func (c *Client) AnnounceIntermediateTrust(ctx context.Context, prm AnnounceIntermediateTrustPrm) (*AnnounceIntermediateTrustRes, error) {
func (c *Client) AnnounceIntermediateTrust(ctx context.Context, prm PrmAnnounceIntermediateTrust) (*ResAnnounceIntermediateTrust, error) {
// check parameters
switch {
case ctx == nil:
@ -172,7 +172,7 @@ func (c *Client) AnnounceIntermediateTrust(ctx context.Context, prm AnnounceInte
var (
cc contextCall
res AnnounceIntermediateTrustRes
res ResAnnounceIntermediateTrust
)
c.initCallContext(&cc)

View file

@ -9,18 +9,18 @@ import (
"github.com/nspcc-dev/neofs-sdk-go/owner"
)
// CreateSessionPrm groups parameters of CreateSession operation.
type CreateSessionPrm struct {
// PrmSessionCreate groups parameters of SessionCreate operation.
type PrmSessionCreate struct {
exp uint64
}
// SetExp sets number of the last NepFS epoch in the lifetime of the session after which it will be expired.
func (x *CreateSessionPrm) SetExp(exp uint64) {
func (x *PrmSessionCreate) SetExp(exp uint64) {
x.exp = exp
}
// CreateSessionRes groups resulting values of CreateSession operation.
type CreateSessionRes struct {
// ResSessionCreate groups resulting values of SessionCreate operation.
type ResSessionCreate struct {
statusRes
id []byte
@ -28,27 +28,27 @@ type CreateSessionRes struct {
sessionKey []byte
}
func (x *CreateSessionRes) setID(id []byte) {
func (x *ResSessionCreate) setID(id []byte) {
x.id = id
}
// ID returns identifier of the opened session in a binary NeoFS API protocol format.
//
// Client doesn't retain value so modification is safe.
func (x CreateSessionRes) ID() []byte {
func (x ResSessionCreate) ID() []byte {
return x.id
}
func (x *CreateSessionRes) setSessionKey(key []byte) {
func (x *ResSessionCreate) setSessionKey(key []byte) {
x.sessionKey = key
}
// PublicKey returns public key of the opened session in a binary NeoFS API protocol format.
func (x CreateSessionRes) PublicKey() []byte {
func (x ResSessionCreate) PublicKey() []byte {
return x.sessionKey
}
// CreateSession opens a session with the node server on the remote endpoint.
// SessionCreate opens a session with the node server on the remote endpoint.
// The session lifetime coincides with the server lifetime. Results can be written
// to session token which can be later attached to the requests.
//
@ -58,12 +58,12 @@ func (x CreateSessionRes) PublicKey() []byte {
// NeoFS status codes are returned as `error`, otherwise, are included
// in the returned result structure.
//
// Immediately panics if parameters are set incorrectly (see CreateSessionPrm docs).
// Immediately panics if parameters are set incorrectly (see PrmSessionCreate docs).
// Context is required and must not be nil. It is used for network communication.
//
// Return statuses:
// - global (see Client docs).
func (c *Client) CreateSession(ctx context.Context, prm CreateSessionPrm) (*CreateSessionRes, error) {
func (c *Client) SessionCreate(ctx context.Context, prm PrmSessionCreate) (*ResSessionCreate, error) {
// check context
if ctx == nil {
panic(panicMsgMissingContext)
@ -85,7 +85,7 @@ func (c *Client) CreateSession(ctx context.Context, prm CreateSessionPrm) (*Crea
var (
cc contextCall
res CreateSessionRes
res ResSessionCreate
)
c.initCallContext(&cc)

View file

@ -4,7 +4,7 @@ import (
v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl"
)
// Action taken if EACL record matched request.
// Action taken if ContainerEACL record matched request.
// Action is compatible with v2 acl.Action enum.
type Action uint32

View file

@ -8,7 +8,7 @@ import (
)
// Filter defines check conditions if request header is matched or not. Matched
// header means that request should be processed according to EACL action.
// header means that request should be processed according to ContainerEACL action.
//
// Filter is compatible with v2 acl.EACLRecord.Filter message.
type Filter struct {

View file

@ -13,7 +13,7 @@ import (
"github.com/nspcc-dev/neofs-sdk-go/version"
)
// Record of the EACL rule, that defines EACL action, targets for this action,
// Record of the ContainerEACL rule, that defines ContainerEACL action, targets for this action,
// object service operation and filters for request headers.
//
// Record is compatible with v2 acl.EACLRecord message.

View file

@ -10,7 +10,7 @@ import (
"github.com/nspcc-dev/neofs-sdk-go/version"
)
// Table is a group of EACL records for single container.
// Table is a group of ContainerEACL records for single container.
//
// Table is compatible with v2 acl.EACLTable message.
type Table struct {

View file

@ -7,7 +7,7 @@ import (
v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl"
)
// Target is a group of request senders to match EACL. Defined by role enum
// Target is a group of request senders to match ContainerEACL. Defined by role enum
// and set of public keys.
//
// Target is compatible with v2 acl.EACLRecord.Target message.

View file

@ -36,11 +36,11 @@ func (m *MockClient) EXPECT() *MockClientMockRecorder {
}
// CreateSession mocks base method.
func (m *MockClient) CreateSession(arg0 context.Context, arg1 client0.CreateSessionPrm) (*client0.CreateSessionRes, error) {
func (m *MockClient) SessionCreate(arg0 context.Context, arg1 client0.PrmSessionCreate) (*client0.ResSessionCreate, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
ret := m.ctrl.Call(m, "CreateSession", varargs...)
ret0, _ := ret[0].(*client0.CreateSessionRes)
ret := m.ctrl.Call(m, "SessionCreate", varargs...)
ret0, _ := ret[0].(*client0.ResSessionCreate)
ret1, _ := ret[1].(error)
return ret0, ret1
}
@ -49,15 +49,15 @@ func (m *MockClient) CreateSession(arg0 context.Context, arg1 client0.CreateSess
func (mr *MockClientMockRecorder) CreateSession(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateSession", reflect.TypeOf((*MockClient)(nil).CreateSession), varargs...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SessionCreate", reflect.TypeOf((*MockClient)(nil).SessionCreate), varargs...)
}
// DeleteContainer mocks base method.
func (m *MockClient) DeleteContainer(arg0 context.Context, arg1 client0.ContainerDeletePrm) (*client0.ContainerDeleteRes, error) {
func (m *MockClient) ContainerDelete(arg0 context.Context, arg1 client0.PrmContainerDelete) (*client0.ResContainerDelete, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
ret := m.ctrl.Call(m, "DeleteContainer", varargs...)
ret0, _ := ret[0].(*client0.ContainerDeleteRes)
ret := m.ctrl.Call(m, "ContainerDelete", varargs...)
ret0, _ := ret[0].(*client0.ResContainerDelete)
ret1, _ := ret[1].(error)
return ret0, ret1
}
@ -66,7 +66,7 @@ func (m *MockClient) DeleteContainer(arg0 context.Context, arg1 client0.Containe
func (mr *MockClientMockRecorder) DeleteContainer(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteContainer", reflect.TypeOf((*MockClient)(nil).DeleteContainer), varargs...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerDelete", reflect.TypeOf((*MockClient)(nil).ContainerDelete), varargs...)
}
// ObjectDelete mocks base method.
@ -86,11 +86,11 @@ func (mr *MockClientMockRecorder) DeleteObject(arg0, arg1 interface{}, arg2 ...i
}
// EACL mocks base method.
func (m *MockClient) EACL(arg0 context.Context, arg1 client0.EACLPrm) (*client0.EACLRes, error) {
func (m *MockClient) ContainerEACL(arg0 context.Context, arg1 client0.PrmContainerEACL) (*client0.ResContainerEACL, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
ret := m.ctrl.Call(m, "EACL", varargs...)
ret0, _ := ret[0].(*client0.EACLRes)
ret := m.ctrl.Call(m, "ContainerEACL", varargs...)
ret0, _ := ret[0].(*client0.ResContainerEACL)
ret1, _ := ret[1].(error)
return ret0, ret1
}
@ -99,15 +99,15 @@ func (m *MockClient) EACL(arg0 context.Context, arg1 client0.EACLPrm) (*client0.
func (mr *MockClientMockRecorder) EACL(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EACL", reflect.TypeOf((*MockClient)(nil).EACL), varargs...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerEACL", reflect.TypeOf((*MockClient)(nil).ContainerEACL), varargs...)
}
// EndpointInfo mocks base method.
func (m *MockClient) EndpointInfo(arg0 context.Context, arg1 client0.EndpointInfoPrm) (*client0.EndpointInfoRes, error) {
func (m *MockClient) EndpointInfo(arg0 context.Context, arg1 client0.PrmEndpointInfo) (*client0.ResEndpointInfo, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
ret := m.ctrl.Call(m, "EndpointInfo", varargs...)
ret0, _ := ret[0].(*client0.EndpointInfoRes)
ret0, _ := ret[0].(*client0.ResEndpointInfo)
ret1, _ := ret[1].(error)
return ret0, ret1
}
@ -120,11 +120,11 @@ func (mr *MockClientMockRecorder) EndpointInfo(arg0, arg1 interface{}) *gomock.C
}
// GetBalance mocks base method.
func (m *MockClient) GetBalance(arg0 context.Context, arg1 client0.GetBalancePrm) (*client0.GetBalanceRes, error) {
func (m *MockClient) BalanceGet(arg0 context.Context, arg1 client0.PrmBalanceGet) (*client0.ResBalanceGet, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
ret := m.ctrl.Call(m, "GetBalance", varargs...)
ret0, _ := ret[0].(*client0.GetBalanceRes)
ret := m.ctrl.Call(m, "BalanceGet", varargs...)
ret0, _ := ret[0].(*client0.ResBalanceGet)
ret1, _ := ret[1].(error)
return ret0, ret1
}
@ -133,15 +133,15 @@ func (m *MockClient) GetBalance(arg0 context.Context, arg1 client0.GetBalancePrm
func (mr *MockClientMockRecorder) GetBalance(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBalance", reflect.TypeOf((*MockClient)(nil).GetBalance), varargs...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BalanceGet", reflect.TypeOf((*MockClient)(nil).BalanceGet), varargs...)
}
// GetContainer mocks base method.
func (m *MockClient) GetContainer(arg0 context.Context, arg1 client0.ContainerGetPrm) (*client0.ContainerGetRes, error) {
func (m *MockClient) ContainerGet(arg0 context.Context, arg1 client0.PrmContainerGet) (*client0.ResContainerGet, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
ret := m.ctrl.Call(m, "GetContainer", varargs...)
ret0, _ := ret[0].(*client0.ContainerGetRes)
ret := m.ctrl.Call(m, "ContainerGet", varargs...)
ret0, _ := ret[0].(*client0.ResContainerGet)
ret1, _ := ret[1].(error)
return ret0, ret1
}
@ -150,7 +150,7 @@ func (m *MockClient) GetContainer(arg0 context.Context, arg1 client0.ContainerGe
func (mr *MockClientMockRecorder) GetContainer(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContainer", reflect.TypeOf((*MockClient)(nil).GetContainer), varargs...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerGet", reflect.TypeOf((*MockClient)(nil).ContainerGet), varargs...)
}
// ObjectGetInitmocks base method.
@ -186,11 +186,11 @@ func (mr *MockClientMockRecorder) HeadObject(arg0, arg1 interface{}, arg2 ...int
}
// ListContainers mocks base method.
func (m *MockClient) ListContainers(arg0 context.Context, arg1 client0.ContainerListPrm) (*client0.ContainerListRes, error) {
func (m *MockClient) ContainerList(arg0 context.Context, arg1 client0.PrmContainerList) (*client0.ResContainerList, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
ret := m.ctrl.Call(m, "ListContainers", varargs...)
ret0, _ := ret[0].(*client0.ContainerListRes)
ret := m.ctrl.Call(m, "ContainerList", varargs...)
ret0, _ := ret[0].(*client0.ResContainerList)
ret1, _ := ret[1].(error)
return ret0, ret1
}
@ -199,15 +199,15 @@ func (m *MockClient) ListContainers(arg0 context.Context, arg1 client0.Container
func (mr *MockClientMockRecorder) ListContainers(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListContainers", reflect.TypeOf((*MockClient)(nil).ListContainers), varargs...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerList", reflect.TypeOf((*MockClient)(nil).ContainerList), varargs...)
}
// NetworkInfo mocks base method.
func (m *MockClient) NetworkInfo(arg0 context.Context, arg1 client0.NetworkInfoPrm) (*client0.NetworkInfoRes, error) {
func (m *MockClient) NetworkInfo(arg0 context.Context, arg1 client0.PrmNetworkInfo) (*client0.ResNetworkInfo, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
ret := m.ctrl.Call(m, "NetworkInfo", varargs...)
ret0, _ := ret[0].(*client0.NetworkInfoRes)
ret0, _ := ret[0].(*client0.ResNetworkInfo)
ret1, _ := ret[1].(error)
return ret0, ret1
}
@ -236,11 +236,11 @@ func (mr *MockClientMockRecorder) ObjectRange(arg0, arg1 interface{}, arg2 ...in
}
// PutContainer mocks base method.
func (m *MockClient) PutContainer(arg0 context.Context, arg1 client0.ContainerPutPrm) (*client0.ContainerPutRes, error) {
func (m *MockClient) ContainerPut(arg0 context.Context, arg1 client0.PrmContainerPut) (*client0.ResContainerPut, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
ret := m.ctrl.Call(m, "PutContainer", varargs...)
ret0, _ := ret[0].(*client0.ContainerPutRes)
ret := m.ctrl.Call(m, "ContainerPut", varargs...)
ret0, _ := ret[0].(*client0.ResContainerPut)
ret1, _ := ret[1].(error)
return ret0, ret1
}
@ -249,7 +249,7 @@ func (m *MockClient) PutContainer(arg0 context.Context, arg1 client0.ContainerPu
func (mr *MockClientMockRecorder) PutContainer(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutContainer", reflect.TypeOf((*MockClient)(nil).PutContainer), varargs...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerPut", reflect.TypeOf((*MockClient)(nil).ContainerPut), varargs...)
}
// ObjectPutInitmocks base method.
@ -285,11 +285,11 @@ func (mr *MockClientMockRecorder) SearchObjects(arg0, arg1 interface{}, arg2 ...
}
// SetEACL mocks base method.
func (m *MockClient) SetEACL(arg0 context.Context, arg1 client0.SetEACLPrm) (*client0.SetEACLRes, error) {
func (m *MockClient) ContainerSetEACL(arg0 context.Context, arg1 client0.PrmContainerSetEACL) (*client0.ResContainerSetEACL, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
ret := m.ctrl.Call(m, "SetEACL", varargs...)
ret0, _ := ret[0].(*client0.SetEACLRes)
ret := m.ctrl.Call(m, "ContainerSetEACL", varargs...)
ret0, _ := ret[0].(*client0.ResContainerSetEACL)
ret1, _ := ret[1].(error)
return ret0, ret1
}
@ -298,5 +298,5 @@ func (m *MockClient) SetEACL(arg0 context.Context, arg1 client0.SetEACLPrm) (*cl
func (mr *MockClientMockRecorder) SetEACL(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetEACL", reflect.TypeOf((*MockClient)(nil).SetEACL), varargs...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerSetEACL", reflect.TypeOf((*MockClient)(nil).ContainerSetEACL), varargs...)
}

View file

@ -31,22 +31,22 @@ import (
// Client is a wrapper for client.Client to generate mock.
type Client interface {
GetBalance(context.Context, client.GetBalancePrm) (*client.GetBalanceRes, error)
PutContainer(context.Context, client.ContainerPutPrm) (*client.ContainerPutRes, error)
GetContainer(context.Context, client.ContainerGetPrm) (*client.ContainerGetRes, error)
ListContainers(context.Context, client.ContainerListPrm) (*client.ContainerListRes, error)
DeleteContainer(context.Context, client.ContainerDeletePrm) (*client.ContainerDeleteRes, error)
EACL(context.Context, client.EACLPrm) (*client.EACLRes, error)
SetEACL(context.Context, client.SetEACLPrm) (*client.SetEACLRes, error)
EndpointInfo(context.Context, client.EndpointInfoPrm) (*client.EndpointInfoRes, error)
NetworkInfo(context.Context, client.NetworkInfoPrm) (*client.NetworkInfoRes, error)
BalanceGet(context.Context, client.PrmBalanceGet) (*client.ResBalanceGet, error)
ContainerPut(context.Context, client.PrmContainerPut) (*client.ResContainerPut, error)
ContainerGet(context.Context, client.PrmContainerGet) (*client.ResContainerGet, error)
ContainerList(context.Context, client.PrmContainerList) (*client.ResContainerList, error)
ContainerDelete(context.Context, client.PrmContainerDelete) (*client.ResContainerDelete, error)
ContainerEACL(context.Context, client.PrmContainerEACL) (*client.ResContainerEACL, error)
ContainerSetEACL(context.Context, client.PrmContainerSetEACL) (*client.ResContainerSetEACL, error)
EndpointInfo(context.Context, client.PrmEndpointInfo) (*client.ResEndpointInfo, error)
NetworkInfo(context.Context, client.PrmNetworkInfo) (*client.ResNetworkInfo, error)
ObjectPutInit(context.Context, client.PrmObjectPutInit) (*client.ObjectWriter, error)
ObjectDelete(context.Context, client.PrmObjectDelete) (*client.ResObjectDelete, error)
ObjectGetInit(context.Context, client.PrmObjectGet) (*client.ObjectReader, error)
ObjectHead(context.Context, client.PrmObjectHead) (*client.ResObjectHead, error)
ObjectRangeInit(context.Context, client.PrmObjectRange) (*client.ObjectRangeReader, error)
ObjectSearchInit(context.Context, client.PrmObjectSearch) (*client.ObjectListReader, error)
CreateSession(context.Context, client.CreateSessionPrm) (*client.CreateSessionRes, error)
SessionCreate(context.Context, client.PrmSessionCreate) (*client.ResSessionCreate, error)
}
// BuilderOptions contains options used to build connection pool.
@ -368,7 +368,7 @@ func updateInnerNodesHealth(ctx context.Context, pool *pool, i int, options *Bui
healthyChanged := false
wg := sync.WaitGroup{}
var prmEndpoint client.EndpointInfoPrm
var prmEndpoint client.PrmEndpointInfo
for j, cPack := range p.clientPacks {
wg.Add(1)
@ -535,22 +535,22 @@ func (p *pool) checkSessionTokenErr(err error, address string) bool {
return false
}
func createSessionTokenForDuration(ctx context.Context, c Client, dur uint64) (*client.CreateSessionRes, error) {
ni, err := c.NetworkInfo(ctx, client.NetworkInfoPrm{})
func createSessionTokenForDuration(ctx context.Context, c Client, dur uint64) (*client.ResSessionCreate, error) {
ni, err := c.NetworkInfo(ctx, client.PrmNetworkInfo{})
if err != nil {
return nil, err
}
epoch := ni.Info().CurrentEpoch()
var prm client.CreateSessionPrm
var prm client.PrmSessionCreate
if math.MaxUint64-epoch < dur {
prm.SetExp(math.MaxUint64)
} else {
prm.SetExp(epoch + dur)
}
return c.CreateSession(ctx, prm)
return c.SessionCreate(ctx, prm)
}
func (p *pool) removeSessionTokenAfterThreshold(cfg *callConfig) error {
@ -1068,13 +1068,13 @@ func (p *pool) PutContainer(ctx context.Context, cnr *container.Container, opts
return nil, err
}
var cliPrm client.ContainerPutPrm
var cliPrm client.PrmContainerPut
if cnr != nil {
cliPrm.SetContainer(*cnr)
}
res, err := cp.client.PutContainer(ctx, cliPrm)
res, err := cp.client.ContainerPut(ctx, cliPrm)
if p.checkSessionTokenErr(err, cp.address) && !cfg.isRetry {
opts = append(opts, retry())
@ -1095,13 +1095,13 @@ func (p *pool) GetContainer(ctx context.Context, cid *cid.ID, opts ...CallOption
return nil, err
}
var cliPrm client.ContainerGetPrm
var cliPrm client.PrmContainerGet
if cid != nil {
cliPrm.SetContainer(*cid)
}
res, err := cp.client.GetContainer(ctx, cliPrm)
res, err := cp.client.ContainerGet(ctx, cliPrm)
if p.checkSessionTokenErr(err, cp.address) && !cfg.isRetry {
opts = append(opts, retry())
@ -1122,13 +1122,13 @@ func (p *pool) ListContainers(ctx context.Context, ownerID *owner.ID, opts ...Ca
return nil, err
}
var cliPrm client.ContainerListPrm
var cliPrm client.PrmContainerList
if ownerID != nil {
cliPrm.SetAccount(*ownerID)
}
res, err := cp.client.ListContainers(ctx, cliPrm)
res, err := cp.client.ContainerList(ctx, cliPrm)
if p.checkSessionTokenErr(err, cp.address) && !cfg.isRetry {
opts = append(opts, retry())
@ -1149,7 +1149,7 @@ func (p *pool) DeleteContainer(ctx context.Context, cid *cid.ID, opts ...CallOpt
return err
}
var cliPrm client.ContainerDeletePrm
var cliPrm client.PrmContainerDelete
if cid != nil {
cliPrm.SetContainer(*cid)
@ -1159,7 +1159,7 @@ func (p *pool) DeleteContainer(ctx context.Context, cid *cid.ID, opts ...CallOpt
cliPrm.SetSessionToken(*cfg.stoken)
}
_, err = cp.client.DeleteContainer(ctx, cliPrm)
_, err = cp.client.ContainerDelete(ctx, cliPrm)
if p.checkSessionTokenErr(err, cp.address) && !cfg.isRetry {
opts = append(opts, retry())
@ -1178,13 +1178,13 @@ func (p *pool) GetEACL(ctx context.Context, cid *cid.ID, opts ...CallOption) (*e
return nil, err
}
var cliPrm client.EACLPrm
var cliPrm client.PrmContainerEACL
if cid != nil {
cliPrm.SetContainer(*cid)
}
res, err := cp.client.EACL(ctx, cliPrm)
res, err := cp.client.ContainerEACL(ctx, cliPrm)
if p.checkSessionTokenErr(err, cp.address) && !cfg.isRetry {
opts = append(opts, retry())
@ -1205,13 +1205,13 @@ func (p *pool) SetEACL(ctx context.Context, table *eacl.Table, opts ...CallOptio
return err
}
var cliPrm client.SetEACLPrm
var cliPrm client.PrmContainerSetEACL
if table != nil {
cliPrm.SetTable(*table)
}
_, err = cp.client.SetEACL(ctx, cliPrm)
_, err = cp.client.ContainerSetEACL(ctx, cliPrm)
if p.checkSessionTokenErr(err, cp.address) && !cfg.isRetry {
opts = append(opts, retry())
@ -1230,13 +1230,13 @@ func (p *pool) Balance(ctx context.Context, o *owner.ID, opts ...CallOption) (*a
return nil, err
}
var cliPrm client.GetBalancePrm
var cliPrm client.PrmBalanceGet
if o != nil {
cliPrm.SetAccount(*o)
}
res, err := cp.client.GetBalance(ctx, cliPrm)
res, err := cp.client.BalanceGet(ctx, cliPrm)
if err != nil { // here err already carries both status and client errors
return nil, err
}
@ -1256,7 +1256,7 @@ func (p *pool) WaitForContainerPresence(ctx context.Context, cid *cid.ID, pollPa
wdone := wctx.Done()
done := ctx.Done()
var cliPrm client.ContainerGetPrm
var cliPrm client.PrmContainerGet
if cid != nil {
cliPrm.SetContainer(*cid)
@ -1269,7 +1269,7 @@ func (p *pool) WaitForContainerPresence(ctx context.Context, cid *cid.ID, pollPa
case <-wdone:
return wctx.Err()
case <-ticker.C:
_, err = conn.GetContainer(ctx, cliPrm)
_, err = conn.ContainerGet(ctx, cliPrm)
if err == nil {
return nil
}
@ -1284,13 +1284,13 @@ func (p *pool) Close() {
<-p.closedCh
}
// creates new session token from CreateSession call result.
func (p *pool) newSessionToken(cliRes *client.CreateSessionRes) *session.Token {
// creates new session token from SessionCreate call result.
func (p *pool) newSessionToken(cliRes *client.ResSessionCreate) *session.Token {
return sessionTokenForOwner(p.owner, cliRes)
}
// creates new session token with specified owner from CreateSession call result.
func sessionTokenForOwner(id *owner.ID, cliRes *client.CreateSessionRes) *session.Token {
// creates new session token with specified owner from SessionCreate call result.
func sessionTokenForOwner(id *owner.ID, cliRes *client.ResSessionCreate) *session.Token {
st := session.NewToken()
st.SetOwnerID(id)
st.SetID(cliRes.ID())

View file

@ -49,8 +49,8 @@ func TestBuildPoolCreateSessionFailed(t *testing.T) {
clientBuilder := func(opts ...client.Option) (Client, error) {
mockClient := NewMockClient(ctrl)
mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("error session")).AnyTimes()
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&client.EndpointInfoRes{}, nil).AnyTimes()
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&client.NetworkInfoRes{}, nil).AnyTimes()
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&client.ResEndpointInfo{}, nil).AnyTimes()
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&client.ResNetworkInfo{}, nil).AnyTimes()
return mockClient, nil
}
@ -97,12 +97,12 @@ func TestBuildPoolOneNodeFailed(t *testing.T) {
}).AnyTimes()
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&client.NetworkInfoRes{}, nil).AnyTimes()
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&client.ResNetworkInfo{}, nil).AnyTimes()
mockClient2 := NewMockClient(ctrl2)
mockClient2.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
mockClient2.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&client.NetworkInfoRes{}, nil).AnyTimes()
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&client.ResNetworkInfo{}, nil).AnyTimes()
if clientCount == 0 {
return mockClient, nil
@ -157,8 +157,8 @@ func TestOneNode(t *testing.T) {
clientBuilder := func(opts ...client.Option) (Client, error) {
mockClient := NewMockClient(ctrl)
mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(tok, nil)
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&client.EndpointInfoRes{}, nil).AnyTimes()
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&client.NetworkInfoRes{}, nil).AnyTimes()
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&client.ResEndpointInfo{}, nil).AnyTimes()
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&client.ResNetworkInfo{}, nil).AnyTimes()
return mockClient, nil
}
@ -195,8 +195,8 @@ func TestTwoNodes(t *testing.T) {
tokens = append(tokens, tok)
return tok, err
})
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&client.EndpointInfoRes{}, nil).AnyTimes()
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&client.NetworkInfoRes{}, nil).AnyTimes()
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&client.ResEndpointInfo{}, nil).AnyTimes()
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&client.ResNetworkInfo{}, nil).AnyTimes()
return mockClient, nil
}
@ -235,7 +235,7 @@ func TestOneOfTwoFailed(t *testing.T) {
return tok, nil
}).AnyTimes()
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&client.NetworkInfoRes{}, nil).AnyTimes()
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&client.ResNetworkInfo{}, nil).AnyTimes()
mockClient2 := NewMockClient(ctrl2)
mockClient2.EXPECT().CreateSession(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}, _ ...interface{}) (*session.Token, error) {
@ -243,10 +243,10 @@ func TestOneOfTwoFailed(t *testing.T) {
tokens = append(tokens, tok)
return tok, nil
}).AnyTimes()
mockClient2.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).DoAndReturn(func(_ interface{}, _ ...interface{}) (*client.EndpointInfoRes, error) {
mockClient2.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).DoAndReturn(func(_ interface{}, _ ...interface{}) (*client.ResEndpointInfo, error) {
return nil, fmt.Errorf("error")
}).AnyTimes()
mockClient2.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).DoAndReturn(func(_ interface{}, _ ...interface{}) (*client.NetworkInfoRes, error) {
mockClient2.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).DoAndReturn(func(_ interface{}, _ ...interface{}) (*client.ResNetworkInfo, error) {
return nil, fmt.Errorf("error")
}).AnyTimes()
@ -501,9 +501,9 @@ func TestSessionTokenOwner(t *testing.T) {
ctrl := gomock.NewController(t)
clientBuilder := func(opts ...client.Option) (Client, error) {
mockClient := NewMockClient(ctrl)
mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(&client.CreateSessionRes{}, nil).AnyTimes()
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&client.EndpointInfoRes{}, nil).AnyTimes()
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&client.NetworkInfoRes{}, nil).AnyTimes()
mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(&client.ResSessionCreate{}, nil).AnyTimes()
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&client.ResEndpointInfo{}, nil).AnyTimes()
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&client.ResNetworkInfo{}, nil).AnyTimes()
return mockClient, nil
}
@ -542,7 +542,7 @@ func TestWaitPresence(t *testing.T) {
mockClient := NewMockClient(ctrl)
mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&client.NetworkInfoRes{}, nil).AnyTimes()
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&client.ResNetworkInfo{}, nil).AnyTimes()
mockClient.EXPECT().GetContainer(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
cache, err := NewCache()

View file

@ -48,11 +48,11 @@ type clientMock struct {
err error
}
func (c *clientMock) EndpointInfo(context.Context, client.EndpointInfoPrm) (*client.EndpointInfoRes, error) {
func (c *clientMock) EndpointInfo(context.Context, client.PrmEndpointInfo) (*client.ResEndpointInfo, error) {
return nil, nil
}
func (c *clientMock) NetworkInfo(context.Context, client.NetworkInfoPrm) (*client.NetworkInfoRes, error) {
func (c *clientMock) NetworkInfo(context.Context, client.PrmNetworkInfo) (*client.ResNetworkInfo, error) {
return nil, nil
}

View file

@ -18,7 +18,7 @@ import (
var (
errNilBearerToken = errors.New("bearer token is not set")
errNilBearerTokenBody = errors.New("bearer token body is not set")
errNilBearerTokenEACL = errors.New("bearer token EACL table is not set")
errNilBearerTokenEACL = errors.New("bearer token ContainerEACL table is not set")
)
type BearerToken struct {
@ -178,7 +178,7 @@ func sanityCheck(b *BearerToken) error {
return errNilBearerTokenEACL
}
// consider checking EACL sanity there, lifetime correctness, etc.
// consider checking ContainerEACL sanity there, lifetime correctness, etc.
return nil
}