forked from TrueCloudLab/frostfs-sdk-go
[#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:
parent
998bae3f1c
commit
69ffface78
16 changed files with 235 additions and 235 deletions
|
@ -49,7 +49,7 @@ c, _ := client.New(
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 5 * time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 5 * time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
res, err := c.GetBalance(ctx, owner)
|
res, err := c.BalanceGet(ctx, owner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,38 +10,38 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-sdk-go/owner"
|
"github.com/nspcc-dev/neofs-sdk-go/owner"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetBalancePrm groups parameters of GetBalance operation.
|
// PrmBalanceGet groups parameters of BalanceGet operation.
|
||||||
type GetBalancePrm struct {
|
type PrmBalanceGet struct {
|
||||||
ownerSet bool
|
ownerSet bool
|
||||||
ownerID owner.ID
|
ownerID owner.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAccount sets identifier of the NeoFS account for which the balance is requested.
|
// 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.
|
// 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.ownerID = id
|
||||||
x.ownerSet = true
|
x.ownerSet = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBalanceRes groups resulting values of GetBalance operation.
|
// ResBalanceGet groups resulting values of BalanceGet operation.
|
||||||
type GetBalanceRes struct {
|
type ResBalanceGet struct {
|
||||||
statusRes
|
statusRes
|
||||||
|
|
||||||
amount *accounting.Decimal
|
amount *accounting.Decimal
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetBalanceRes) setAmount(v *accounting.Decimal) {
|
func (x *ResBalanceGet) setAmount(v *accounting.Decimal) {
|
||||||
x.amount = v
|
x.amount = v
|
||||||
}
|
}
|
||||||
|
|
||||||
// Amount returns current amount of funds on the NeoFS account as decimal number.
|
// Amount returns current amount of funds on the NeoFS account as decimal number.
|
||||||
//
|
//
|
||||||
// Client doesn't retain value so modification is safe.
|
// Client doesn't retain value so modification is safe.
|
||||||
func (x GetBalanceRes) Amount() *accounting.Decimal {
|
func (x ResBalanceGet) Amount() *accounting.Decimal {
|
||||||
return x.amount
|
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.
|
// 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`,
|
// 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
|
// NeoFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// 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.
|
// Context is required and must not be nil. It is used for network communication.
|
||||||
//
|
//
|
||||||
// Return statuses:
|
// Return statuses:
|
||||||
// - global (see Client docs).
|
// - 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 {
|
switch {
|
||||||
case ctx == nil:
|
case ctx == nil:
|
||||||
panic(panicMsgMissingContext)
|
panic(panicMsgMissingContext)
|
||||||
|
@ -78,7 +78,7 @@ func (c *Client) GetBalance(ctx context.Context, prm GetBalancePrm) (*GetBalance
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cc contextCall
|
cc contextCall
|
||||||
res GetBalanceRes
|
res ResBalanceGet
|
||||||
)
|
)
|
||||||
|
|
||||||
c.initCallContext(&cc)
|
c.initCallContext(&cc)
|
||||||
|
|
|
@ -18,21 +18,21 @@ import (
|
||||||
sigutil "github.com/nspcc-dev/neofs-sdk-go/util/signature"
|
sigutil "github.com/nspcc-dev/neofs-sdk-go/util/signature"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerPutPrm groups parameters of PutContainer operation.
|
// PrmContainerPut groups parameters of ContainerPut operation.
|
||||||
type ContainerPutPrm struct {
|
type PrmContainerPut struct {
|
||||||
cnrSet bool
|
cnrSet bool
|
||||||
cnr container.Container
|
cnr container.Container
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetContainer sets structured information about new NeoFS container.
|
// SetContainer sets structured information about new NeoFS container.
|
||||||
// Required parameter.
|
// Required parameter.
|
||||||
func (x *ContainerPutPrm) SetContainer(cnr container.Container) {
|
func (x *PrmContainerPut) SetContainer(cnr container.Container) {
|
||||||
x.cnr = cnr
|
x.cnr = cnr
|
||||||
x.cnrSet = true
|
x.cnrSet = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerPutRes groups resulting values of PutContainer operation.
|
// ResContainerPut groups resulting values of ContainerPut operation.
|
||||||
type ContainerPutRes struct {
|
type ResContainerPut struct {
|
||||||
statusRes
|
statusRes
|
||||||
|
|
||||||
id *cid.ID
|
id *cid.ID
|
||||||
|
@ -43,15 +43,15 @@ type ContainerPutRes struct {
|
||||||
// asynchronously check if the save was successful).
|
// asynchronously check if the save was successful).
|
||||||
//
|
//
|
||||||
// Client doesn't retain value so modification is safe.
|
// Client doesn't retain value so modification is safe.
|
||||||
func (x ContainerPutRes) ID() *cid.ID {
|
func (x ResContainerPut) ID() *cid.ID {
|
||||||
return x.id
|
return x.id
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ContainerPutRes) setID(id *cid.ID) {
|
func (x *ResContainerPut) setID(id *cid.ID) {
|
||||||
x.id = 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.
|
// 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`.
|
// 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.
|
// Operation is asynchronous and no guaranteed even in the absence of errors.
|
||||||
// The required time is also not predictable.
|
// 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.
|
// Context is required and must not be nil. It is used for network communication.
|
||||||
//
|
//
|
||||||
// Return statuses:
|
// Return statuses:
|
||||||
// - global (see Client docs).
|
// - 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
|
// check parameters
|
||||||
switch {
|
switch {
|
||||||
case ctx == nil:
|
case ctx == nil:
|
||||||
|
@ -111,7 +111,7 @@ func (c *Client) PutContainer(ctx context.Context, prm ContainerPutPrm) (*Contai
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cc contextCall
|
cc contextCall
|
||||||
res ContainerPutRes
|
res ResContainerPut
|
||||||
)
|
)
|
||||||
|
|
||||||
c.initCallContext(&cc)
|
c.initCallContext(&cc)
|
||||||
|
@ -133,21 +133,21 @@ func (c *Client) PutContainer(ctx context.Context, prm ContainerPutPrm) (*Contai
|
||||||
return &res, nil
|
return &res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerGetPrm groups parameters of GetContainer operation.
|
// PrmContainerGet groups parameters of ContainerGet operation.
|
||||||
type ContainerGetPrm struct {
|
type PrmContainerGet struct {
|
||||||
idSet bool
|
idSet bool
|
||||||
id cid.ID
|
id cid.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetContainer sets identifier of the container to be read.
|
// SetContainer sets identifier of the container to be read.
|
||||||
// Required parameter.
|
// Required parameter.
|
||||||
func (x *ContainerGetPrm) SetContainer(id cid.ID) {
|
func (x *PrmContainerGet) SetContainer(id cid.ID) {
|
||||||
x.id = id
|
x.id = id
|
||||||
x.idSet = true
|
x.idSet = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerGetRes groups resulting values of GetContainer operation.
|
// ResContainerGet groups resulting values of ContainerGet operation.
|
||||||
type ContainerGetRes struct {
|
type ResContainerGet struct {
|
||||||
statusRes
|
statusRes
|
||||||
|
|
||||||
cnr *container.Container
|
cnr *container.Container
|
||||||
|
@ -156,15 +156,15 @@ type ContainerGetRes struct {
|
||||||
// Container returns structured information about the requested container.
|
// Container returns structured information about the requested container.
|
||||||
//
|
//
|
||||||
// Client doesn't retain value so modification is safe.
|
// Client doesn't retain value so modification is safe.
|
||||||
func (x ContainerGetRes) Container() *container.Container {
|
func (x ResContainerGet) Container() *container.Container {
|
||||||
return x.cnr
|
return x.cnr
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ContainerGetRes) setContainer(cnr *container.Container) {
|
func (x *ResContainerGet) setContainer(cnr *container.Container) {
|
||||||
x.cnr = cnr
|
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.
|
// 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`.
|
// 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
|
// NeoFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// 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.
|
// Context is required and must not be nil. It is used for network communication.
|
||||||
//
|
//
|
||||||
// Return statuses:
|
// Return statuses:
|
||||||
// - global (see Client docs).
|
// - 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 {
|
switch {
|
||||||
case ctx == nil:
|
case ctx == nil:
|
||||||
panic(panicMsgMissingContext)
|
panic(panicMsgMissingContext)
|
||||||
|
@ -198,7 +198,7 @@ func (c *Client) GetContainer(ctx context.Context, prm ContainerGetPrm) (*Contai
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cc contextCall
|
cc contextCall
|
||||||
res ContainerGetRes
|
res ResContainerGet
|
||||||
)
|
)
|
||||||
|
|
||||||
c.initCallContext(&cc)
|
c.initCallContext(&cc)
|
||||||
|
@ -233,21 +233,21 @@ func (c *Client) GetContainer(ctx context.Context, prm ContainerGetPrm) (*Contai
|
||||||
return &res, nil
|
return &res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerListPrm groups parameters of ListContainers operation.
|
// PrmContainerList groups parameters of ContainerList operation.
|
||||||
type ContainerListPrm struct {
|
type PrmContainerList struct {
|
||||||
ownerSet bool
|
ownerSet bool
|
||||||
ownerID owner.ID
|
ownerID owner.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAccount sets identifier of the NeoFS account to list the containers.
|
// SetAccount sets identifier of the NeoFS account to list the containers.
|
||||||
// Required parameter. Must be a valid ID according to NeoFS API protocol.
|
// 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.ownerID = id
|
||||||
x.ownerSet = true
|
x.ownerSet = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerListRes groups resulting values of ListContainers operation.
|
// ResContainerList groups resulting values of ContainerList operation.
|
||||||
type ContainerListRes struct {
|
type ResContainerList struct {
|
||||||
statusRes
|
statusRes
|
||||||
|
|
||||||
ids []*cid.ID
|
ids []*cid.ID
|
||||||
|
@ -256,15 +256,15 @@ type ContainerListRes struct {
|
||||||
// Containers returns list of identifiers of the account-owned containers.
|
// Containers returns list of identifiers of the account-owned containers.
|
||||||
//
|
//
|
||||||
// Client doesn't retain value so modification is safe.
|
// Client doesn't retain value so modification is safe.
|
||||||
func (x ContainerListRes) Containers() []*cid.ID {
|
func (x ResContainerList) Containers() []*cid.ID {
|
||||||
return x.ids
|
return x.ids
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ContainerListRes) setContainers(ids []*cid.ID) {
|
func (x *ResContainerList) setContainers(ids []*cid.ID) {
|
||||||
x.ids = ids
|
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.
|
// 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`.
|
// 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
|
// NeoFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// 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.
|
// Context is required and must not be nil. It is used for network communication.
|
||||||
//
|
//
|
||||||
// Return statuses:
|
// Return statuses:
|
||||||
// - global (see Client docs).
|
// - 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
|
// check parameters
|
||||||
switch {
|
switch {
|
||||||
case ctx == nil:
|
case ctx == nil:
|
||||||
|
@ -301,7 +301,7 @@ func (c *Client) ListContainers(ctx context.Context, prm ContainerListPrm) (*Con
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cc contextCall
|
cc contextCall
|
||||||
res ContainerListRes
|
res ResContainerList
|
||||||
)
|
)
|
||||||
|
|
||||||
c.initCallContext(&cc)
|
c.initCallContext(&cc)
|
||||||
|
@ -330,8 +330,8 @@ func (c *Client) ListContainers(ctx context.Context, prm ContainerListPrm) (*Con
|
||||||
return &res, nil
|
return &res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerDeletePrm groups parameters of DeleteContainer operation.
|
// PrmContainerDelete groups parameters of ContainerDelete operation.
|
||||||
type ContainerDeletePrm struct {
|
type PrmContainerDelete struct {
|
||||||
prmSession
|
prmSession
|
||||||
|
|
||||||
idSet bool
|
idSet bool
|
||||||
|
@ -340,13 +340,13 @@ type ContainerDeletePrm struct {
|
||||||
|
|
||||||
// SetContainer sets identifier of the NeoFS container to be removed.
|
// SetContainer sets identifier of the NeoFS container to be removed.
|
||||||
// Required parameter.
|
// Required parameter.
|
||||||
func (x *ContainerDeletePrm) SetContainer(id cid.ID) {
|
func (x *PrmContainerDelete) SetContainer(id cid.ID) {
|
||||||
x.id = id
|
x.id = id
|
||||||
x.idSet = true
|
x.idSet = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerDeleteRes groups resulting values of DeleteContainer operation.
|
// ResContainerDelete groups resulting values of ContainerDelete operation.
|
||||||
type ContainerDeleteRes struct {
|
type ResContainerDelete struct {
|
||||||
statusRes
|
statusRes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ func (c delContainerSignWrapper) SignedDataSize() int {
|
||||||
return len(c.body.GetContainerID().GetValue())
|
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.
|
// 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`.
|
// 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).
|
// 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.
|
// 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.).
|
// Reflects all internal errors in second return value (transport problems, response processing, etc.).
|
||||||
//
|
//
|
||||||
// Return statuses:
|
// Return statuses:
|
||||||
// - global (see Client docs).
|
// - 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
|
// check parameters
|
||||||
switch {
|
switch {
|
||||||
case ctx == nil:
|
case ctx == nil:
|
||||||
|
@ -428,7 +428,7 @@ func (c *Client) DeleteContainer(ctx context.Context, prm ContainerDeletePrm) (*
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cc contextCall
|
cc contextCall
|
||||||
res ContainerDeleteRes
|
res ResContainerDelete
|
||||||
)
|
)
|
||||||
|
|
||||||
c.initCallContext(&cc)
|
c.initCallContext(&cc)
|
||||||
|
@ -446,21 +446,21 @@ func (c *Client) DeleteContainer(ctx context.Context, prm ContainerDeletePrm) (*
|
||||||
return &res, nil
|
return &res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// EACLPrm groups parameters of EACL operation.
|
// PrmContainerEACL groups parameters of ContainerEACL operation.
|
||||||
type EACLPrm struct {
|
type PrmContainerEACL struct {
|
||||||
idSet bool
|
idSet bool
|
||||||
id cid.ID
|
id cid.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetContainer sets identifier of the NeoFS container to read the eACL table.
|
// SetContainer sets identifier of the NeoFS container to read the eACL table.
|
||||||
// Required parameter.
|
// Required parameter.
|
||||||
func (x *EACLPrm) SetContainer(id cid.ID) {
|
func (x *PrmContainerEACL) SetContainer(id cid.ID) {
|
||||||
x.id = id
|
x.id = id
|
||||||
x.idSet = true
|
x.idSet = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// EACLRes groups resulting values of EACL operation.
|
// ResContainerEACL groups resulting values of ContainerEACL operation.
|
||||||
type EACLRes struct {
|
type ResContainerEACL struct {
|
||||||
statusRes
|
statusRes
|
||||||
|
|
||||||
table *eacl.Table
|
table *eacl.Table
|
||||||
|
@ -469,15 +469,15 @@ type EACLRes struct {
|
||||||
// Table returns eACL table of the requested container.
|
// Table returns eACL table of the requested container.
|
||||||
//
|
//
|
||||||
// Client doesn't retain value so modification is safe.
|
// Client doesn't retain value so modification is safe.
|
||||||
func (x EACLRes) Table() *eacl.Table {
|
func (x ResContainerEACL) Table() *eacl.Table {
|
||||||
return x.table
|
return x.table
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EACLRes) setTable(table *eacl.Table) {
|
func (x *ResContainerEACL) setTable(table *eacl.Table) {
|
||||||
x.table = 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.
|
// 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`.
|
// 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
|
// NeoFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// 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.
|
// Context is required and must not be nil. It is used for network communication.
|
||||||
//
|
//
|
||||||
// Return statuses:
|
// Return statuses:
|
||||||
// - global (see Client docs).
|
// - 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
|
// check parameters
|
||||||
switch {
|
switch {
|
||||||
case ctx == nil:
|
case ctx == nil:
|
||||||
|
@ -512,7 +512,7 @@ func (c *Client) EACL(ctx context.Context, prm EACLPrm) (*EACLRes, error) {
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cc contextCall
|
cc contextCall
|
||||||
res EACLRes
|
res ResContainerEACL
|
||||||
)
|
)
|
||||||
|
|
||||||
c.initCallContext(&cc)
|
c.initCallContext(&cc)
|
||||||
|
@ -547,25 +547,25 @@ func (c *Client) EACL(ctx context.Context, prm EACLPrm) (*EACLRes, error) {
|
||||||
return &res, nil
|
return &res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEACLPrm groups parameters of SetEACL operation.
|
// PrmContainerSetEACL groups parameters of ContainerSetEACL operation.
|
||||||
type SetEACLPrm struct {
|
type PrmContainerSetEACL struct {
|
||||||
tableSet bool
|
tableSet bool
|
||||||
table eacl.Table
|
table eacl.Table
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTable sets eACL table structure to be set for the container.
|
// SetTable sets eACL table structure to be set for the container.
|
||||||
// Required parameter.
|
// Required parameter.
|
||||||
func (x *SetEACLPrm) SetTable(table eacl.Table) {
|
func (x *PrmContainerSetEACL) SetTable(table eacl.Table) {
|
||||||
x.table = table
|
x.table = table
|
||||||
x.tableSet = true
|
x.tableSet = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEACLRes groups resulting values of SetEACL operation.
|
// ResContainerSetEACL groups resulting values of ContainerSetEACL operation.
|
||||||
type SetEACLRes struct {
|
type ResContainerSetEACL struct {
|
||||||
statusRes
|
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.
|
// 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`.
|
// 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).
|
// 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.
|
// Context is required and must not be nil. It is used for network communication.
|
||||||
//
|
//
|
||||||
// Return statuses:
|
// Return statuses:
|
||||||
// - global (see Client docs).
|
// - 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
|
// check parameters
|
||||||
switch {
|
switch {
|
||||||
case ctx == nil:
|
case ctx == nil:
|
||||||
|
@ -623,7 +623,7 @@ func (c *Client) SetEACL(ctx context.Context, prm SetEACLPrm) (*SetEACLRes, erro
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cc contextCall
|
cc contextCall
|
||||||
res SetEACLRes
|
res ResContainerSetEACL
|
||||||
)
|
)
|
||||||
|
|
||||||
c.initCallContext(&cc)
|
c.initCallContext(&cc)
|
||||||
|
@ -641,8 +641,8 @@ func (c *Client) SetEACL(ctx context.Context, prm SetEACLPrm) (*SetEACLRes, erro
|
||||||
return &res, nil
|
return &res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// AnnounceSpacePrm groups parameters of AnnounceContainerUsedSpace operation.
|
// PrmAnnounceSpace groups parameters of ContainerAnnounceUsedSpace operation.
|
||||||
type AnnounceSpacePrm struct {
|
type PrmAnnounceSpace struct {
|
||||||
announcements []container.UsedSpaceAnnouncement
|
announcements []container.UsedSpaceAnnouncement
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -650,16 +650,16 @@ type AnnounceSpacePrm struct {
|
||||||
// Required parameter. Must not be empty.
|
// Required parameter. Must not be empty.
|
||||||
//
|
//
|
||||||
// Must not be mutated before the end of the operation.
|
// 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
|
x.announcements = announcements
|
||||||
}
|
}
|
||||||
|
|
||||||
// AnnounceSpaceRes groups resulting values of AnnounceContainerUsedSpace operation.
|
// ResAnnounceSpace groups resulting values of ContainerAnnounceUsedSpace operation.
|
||||||
type AnnounceSpaceRes struct {
|
type ResAnnounceSpace struct {
|
||||||
statusRes
|
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.
|
// 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`.
|
// 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.
|
// 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.
|
// Context is required and must not be nil. It is used for network communication.
|
||||||
//
|
//
|
||||||
// Return statuses:
|
// Return statuses:
|
||||||
// - global (see Client docs).
|
// - 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
|
// check parameters
|
||||||
switch {
|
switch {
|
||||||
case ctx == nil:
|
case ctx == nil:
|
||||||
|
@ -705,7 +705,7 @@ func (c *Client) AnnounceContainerUsedSpace(ctx context.Context, prm AnnounceSpa
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cc contextCall
|
cc contextCall
|
||||||
res AnnounceSpaceRes
|
res ResAnnounceSpace
|
||||||
)
|
)
|
||||||
|
|
||||||
c.initCallContext(&cc)
|
c.initCallContext(&cc)
|
||||||
|
|
|
@ -10,14 +10,14 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-sdk-go/version"
|
"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,
|
// At the moment the operation is not parameterized, however,
|
||||||
// the structure is still declared for backward compatibility.
|
// the structure is still declared for backward compatibility.
|
||||||
type EndpointInfoPrm struct{}
|
type PrmEndpointInfo struct{}
|
||||||
|
|
||||||
// EndpointInfoRes group resulting values of EndpointInfo operation.
|
// ResEndpointInfo group resulting values of EndpointInfo operation.
|
||||||
type EndpointInfoRes struct {
|
type ResEndpointInfo struct {
|
||||||
statusRes
|
statusRes
|
||||||
|
|
||||||
version *version.Version
|
version *version.Version
|
||||||
|
@ -28,22 +28,22 @@ type EndpointInfoRes struct {
|
||||||
// LatestVersion returns latest NeoFS API protocol's version in use.
|
// LatestVersion returns latest NeoFS API protocol's version in use.
|
||||||
//
|
//
|
||||||
// Client doesn't retain value so modification is safe.
|
// Client doesn't retain value so modification is safe.
|
||||||
func (x EndpointInfoRes) LatestVersion() *version.Version {
|
func (x ResEndpointInfo) LatestVersion() *version.Version {
|
||||||
return x.version
|
return x.version
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EndpointInfoRes) setLatestVersion(ver *version.Version) {
|
func (x *ResEndpointInfo) setLatestVersion(ver *version.Version) {
|
||||||
x.version = ver
|
x.version = ver
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeInfo returns information about the NeoFS node served on the remote endpoint.
|
// NodeInfo returns information about the NeoFS node served on the remote endpoint.
|
||||||
//
|
//
|
||||||
// Client doesn't retain value so modification is safe.
|
// Client doesn't retain value so modification is safe.
|
||||||
func (x EndpointInfoRes) NodeInfo() *netmap.NodeInfo {
|
func (x ResEndpointInfo) NodeInfo() *netmap.NodeInfo {
|
||||||
return x.ni
|
return x.ni
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EndpointInfoRes) setNodeInfo(info *netmap.NodeInfo) {
|
func (x *ResEndpointInfo) setNodeInfo(info *netmap.NodeInfo) {
|
||||||
x.ni = info
|
x.ni = info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,15 +56,15 @@ func (x *EndpointInfoRes) setNodeInfo(info *netmap.NodeInfo) {
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// NeoFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// 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.
|
// 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.).
|
// Reflects all internal errors in second return value (transport problems, response processing, etc.).
|
||||||
//
|
//
|
||||||
// Return statuses:
|
// Return statuses:
|
||||||
// - global (see Client docs).
|
// - 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
|
// check context
|
||||||
if ctx == nil {
|
if ctx == nil {
|
||||||
panic(panicMsgMissingContext)
|
panic(panicMsgMissingContext)
|
||||||
|
@ -77,7 +77,7 @@ func (c *Client) EndpointInfo(ctx context.Context, _ EndpointInfoPrm) (*Endpoint
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cc contextCall
|
cc contextCall
|
||||||
res EndpointInfoRes
|
res ResEndpointInfo
|
||||||
)
|
)
|
||||||
|
|
||||||
c.initCallContext(&cc)
|
c.initCallContext(&cc)
|
||||||
|
@ -103,14 +103,14 @@ func (c *Client) EndpointInfo(ctx context.Context, _ EndpointInfoPrm) (*Endpoint
|
||||||
return &res, nil
|
return &res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkInfoPrm groups parameters of NetworkInfo operation.
|
// PrmNetworkInfo groups parameters of NetworkInfo operation.
|
||||||
//
|
//
|
||||||
// At the moment the operation is not parameterized, however,
|
// At the moment the operation is not parameterized, however,
|
||||||
// the structure is still declared for backward compatibility.
|
// the structure is still declared for backward compatibility.
|
||||||
type NetworkInfoPrm struct{}
|
type PrmNetworkInfo struct{}
|
||||||
|
|
||||||
// NetworkInfoRes groups resulting values of NetworkInfo operation.
|
// ResNetworkInfo groups resulting values of NetworkInfo operation.
|
||||||
type NetworkInfoRes struct {
|
type ResNetworkInfo struct {
|
||||||
statusRes
|
statusRes
|
||||||
|
|
||||||
info *netmap.NetworkInfo
|
info *netmap.NetworkInfo
|
||||||
|
@ -119,11 +119,11 @@ type NetworkInfoRes struct {
|
||||||
// Info returns structured information about the NeoFS network.
|
// Info returns structured information about the NeoFS network.
|
||||||
//
|
//
|
||||||
// Client doesn't retain value so modification is safe.
|
// Client doesn't retain value so modification is safe.
|
||||||
func (x NetworkInfoRes) Info() *netmap.NetworkInfo {
|
func (x ResNetworkInfo) Info() *netmap.NetworkInfo {
|
||||||
return x.info
|
return x.info
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NetworkInfoRes) setInfo(info *netmap.NetworkInfo) {
|
func (x *ResNetworkInfo) setInfo(info *netmap.NetworkInfo) {
|
||||||
x.info = info
|
x.info = info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,15 +134,15 @@ func (x *NetworkInfoRes) setInfo(info *netmap.NetworkInfo) {
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// NeoFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// 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.
|
// 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.).
|
// Reflects all internal errors in second return value (transport problems, response processing, etc.).
|
||||||
//
|
//
|
||||||
// Return statuses:
|
// Return statuses:
|
||||||
// - global (see Client docs).
|
// - 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
|
// check context
|
||||||
if ctx == nil {
|
if ctx == nil {
|
||||||
panic(panicMsgMissingContext)
|
panic(panicMsgMissingContext)
|
||||||
|
@ -155,7 +155,7 @@ func (c *Client) NetworkInfo(ctx context.Context, _ NetworkInfoPrm) (*NetworkInf
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cc contextCall
|
cc contextCall
|
||||||
res NetworkInfoRes
|
res ResNetworkInfo
|
||||||
)
|
)
|
||||||
|
|
||||||
c.initCallContext(&cc)
|
c.initCallContext(&cc)
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-sdk-go/reputation"
|
"github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AnnounceLocalTrustPrm groups parameters of AnnounceLocalTrust operation.
|
// PrmAnnounceLocalTrust groups parameters of AnnounceLocalTrust operation.
|
||||||
type AnnounceLocalTrustPrm struct {
|
type PrmAnnounceLocalTrust struct {
|
||||||
epoch uint64
|
epoch uint64
|
||||||
|
|
||||||
trusts []reputation.Trust
|
trusts []reputation.Trust
|
||||||
|
@ -18,7 +18,7 @@ type AnnounceLocalTrustPrm struct {
|
||||||
|
|
||||||
// SetEpoch sets number of NeoFS epoch in which the trust was assessed.
|
// SetEpoch sets number of NeoFS epoch in which the trust was assessed.
|
||||||
// Required parameter, must not be zero.
|
// Required parameter, must not be zero.
|
||||||
func (x *AnnounceLocalTrustPrm) SetEpoch(epoch uint64) {
|
func (x *PrmAnnounceLocalTrust) SetEpoch(epoch uint64) {
|
||||||
x.epoch = epoch
|
x.epoch = epoch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,12 +26,12 @@ func (x *AnnounceLocalTrustPrm) SetEpoch(epoch uint64) {
|
||||||
// Required parameter. Must not be empty.
|
// Required parameter. Must not be empty.
|
||||||
//
|
//
|
||||||
// Must not be mutated before the end of the operation.
|
// 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
|
x.trusts = trusts
|
||||||
}
|
}
|
||||||
|
|
||||||
// AnnounceLocalTrustRes groups results of AnnounceLocalTrust operation.
|
// ResAnnounceLocalTrust groups results of AnnounceLocalTrust operation.
|
||||||
type AnnounceLocalTrustRes struct {
|
type ResAnnounceLocalTrust struct {
|
||||||
statusRes
|
statusRes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,12 +43,12 @@ type AnnounceLocalTrustRes struct {
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// NeoFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// 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.
|
// Context is required and must not be nil. It is used for network communication.
|
||||||
//
|
//
|
||||||
// Return statuses:
|
// Return statuses:
|
||||||
// - global (see Client docs).
|
// - 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
|
// check parameters
|
||||||
switch {
|
switch {
|
||||||
case ctx == nil:
|
case ctx == nil:
|
||||||
|
@ -80,7 +80,7 @@ func (c *Client) AnnounceLocalTrust(ctx context.Context, prm AnnounceLocalTrustP
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cc contextCall
|
cc contextCall
|
||||||
res AnnounceLocalTrustRes
|
res ResAnnounceLocalTrust
|
||||||
)
|
)
|
||||||
|
|
||||||
c.initCallContext(&cc)
|
c.initCallContext(&cc)
|
||||||
|
@ -98,8 +98,8 @@ func (c *Client) AnnounceLocalTrust(ctx context.Context, prm AnnounceLocalTrustP
|
||||||
return &res, nil
|
return &res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// AnnounceIntermediateTrustPrm groups parameters of AnnounceIntermediateTrust operation.
|
// PrmAnnounceIntermediateTrust groups parameters of AnnounceIntermediateTrust operation.
|
||||||
type AnnounceIntermediateTrustPrm struct {
|
type PrmAnnounceIntermediateTrust struct {
|
||||||
epoch uint64
|
epoch uint64
|
||||||
|
|
||||||
iter uint32
|
iter uint32
|
||||||
|
@ -110,25 +110,25 @@ type AnnounceIntermediateTrustPrm struct {
|
||||||
|
|
||||||
// SetEpoch sets number of NeoFS epoch with which client's calculation algorithm is initialized.
|
// SetEpoch sets number of NeoFS epoch with which client's calculation algorithm is initialized.
|
||||||
// Required parameter, must not be zero.
|
// Required parameter, must not be zero.
|
||||||
func (x *AnnounceIntermediateTrustPrm) SetEpoch(epoch uint64) {
|
func (x *PrmAnnounceIntermediateTrust) SetEpoch(epoch uint64) {
|
||||||
x.epoch = epoch
|
x.epoch = epoch
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetIteration sets current sequence number of the client's calculation algorithm.
|
// SetIteration sets current sequence number of the client's calculation algorithm.
|
||||||
// By default, corresponds to initial (zero) iteration.
|
// By default, corresponds to initial (zero) iteration.
|
||||||
func (x *AnnounceIntermediateTrustPrm) SetIteration(iter uint32) {
|
func (x *PrmAnnounceIntermediateTrust) SetIteration(iter uint32) {
|
||||||
x.iter = iter
|
x.iter = iter
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCurrentValue sets current global trust value computed at the specified iteration
|
// SetCurrentValue sets current global trust value computed at the specified iteration
|
||||||
// of the client's calculation algorithm. Required parameter.
|
// of the client's calculation algorithm. Required parameter.
|
||||||
func (x *AnnounceIntermediateTrustPrm) SetCurrentValue(trust reputation.PeerToPeerTrust) {
|
func (x *PrmAnnounceIntermediateTrust) SetCurrentValue(trust reputation.PeerToPeerTrust) {
|
||||||
x.trust = trust
|
x.trust = trust
|
||||||
x.trustSet = true
|
x.trustSet = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// AnnounceIntermediateTrustRes groups results of AnnounceIntermediateTrust operation.
|
// ResAnnounceIntermediateTrust groups results of AnnounceIntermediateTrust operation.
|
||||||
type AnnounceIntermediateTrustRes struct {
|
type ResAnnounceIntermediateTrust struct {
|
||||||
statusRes
|
statusRes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,12 +141,12 @@ type AnnounceIntermediateTrustRes struct {
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// NeoFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// 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.
|
// Context is required and must not be nil. It is used for network communication.
|
||||||
//
|
//
|
||||||
// Return statuses:
|
// Return statuses:
|
||||||
// - global (see Client docs).
|
// - 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
|
// check parameters
|
||||||
switch {
|
switch {
|
||||||
case ctx == nil:
|
case ctx == nil:
|
||||||
|
@ -172,7 +172,7 @@ func (c *Client) AnnounceIntermediateTrust(ctx context.Context, prm AnnounceInte
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cc contextCall
|
cc contextCall
|
||||||
res AnnounceIntermediateTrustRes
|
res ResAnnounceIntermediateTrust
|
||||||
)
|
)
|
||||||
|
|
||||||
c.initCallContext(&cc)
|
c.initCallContext(&cc)
|
||||||
|
|
|
@ -9,18 +9,18 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-sdk-go/owner"
|
"github.com/nspcc-dev/neofs-sdk-go/owner"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateSessionPrm groups parameters of CreateSession operation.
|
// PrmSessionCreate groups parameters of SessionCreate operation.
|
||||||
type CreateSessionPrm struct {
|
type PrmSessionCreate struct {
|
||||||
exp uint64
|
exp uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetExp sets number of the last NepFS epoch in the lifetime of the session after which it will be expired.
|
// 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
|
x.exp = exp
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateSessionRes groups resulting values of CreateSession operation.
|
// ResSessionCreate groups resulting values of SessionCreate operation.
|
||||||
type CreateSessionRes struct {
|
type ResSessionCreate struct {
|
||||||
statusRes
|
statusRes
|
||||||
|
|
||||||
id []byte
|
id []byte
|
||||||
|
@ -28,27 +28,27 @@ type CreateSessionRes struct {
|
||||||
sessionKey []byte
|
sessionKey []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CreateSessionRes) setID(id []byte) {
|
func (x *ResSessionCreate) setID(id []byte) {
|
||||||
x.id = id
|
x.id = id
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID returns identifier of the opened session in a binary NeoFS API protocol format.
|
// ID returns identifier of the opened session in a binary NeoFS API protocol format.
|
||||||
//
|
//
|
||||||
// Client doesn't retain value so modification is safe.
|
// Client doesn't retain value so modification is safe.
|
||||||
func (x CreateSessionRes) ID() []byte {
|
func (x ResSessionCreate) ID() []byte {
|
||||||
return x.id
|
return x.id
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CreateSessionRes) setSessionKey(key []byte) {
|
func (x *ResSessionCreate) setSessionKey(key []byte) {
|
||||||
x.sessionKey = key
|
x.sessionKey = key
|
||||||
}
|
}
|
||||||
|
|
||||||
// PublicKey returns public key of the opened session in a binary NeoFS API protocol format.
|
// 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
|
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
|
// The session lifetime coincides with the server lifetime. Results can be written
|
||||||
// to session token which can be later attached to the requests.
|
// 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
|
// NeoFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// 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.
|
// Context is required and must not be nil. It is used for network communication.
|
||||||
//
|
//
|
||||||
// Return statuses:
|
// Return statuses:
|
||||||
// - global (see Client docs).
|
// - 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
|
// check context
|
||||||
if ctx == nil {
|
if ctx == nil {
|
||||||
panic(panicMsgMissingContext)
|
panic(panicMsgMissingContext)
|
||||||
|
@ -85,7 +85,7 @@ func (c *Client) CreateSession(ctx context.Context, prm CreateSessionPrm) (*Crea
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cc contextCall
|
cc contextCall
|
||||||
res CreateSessionRes
|
res ResSessionCreate
|
||||||
)
|
)
|
||||||
|
|
||||||
c.initCallContext(&cc)
|
c.initCallContext(&cc)
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl"
|
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.
|
// Action is compatible with v2 acl.Action enum.
|
||||||
type Action uint32
|
type Action uint32
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Filter defines check conditions if request header is matched or not. Matched
|
// 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.
|
// Filter is compatible with v2 acl.EACLRecord.Filter message.
|
||||||
type Filter struct {
|
type Filter struct {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-sdk-go/version"
|
"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.
|
// object service operation and filters for request headers.
|
||||||
//
|
//
|
||||||
// Record is compatible with v2 acl.EACLRecord message.
|
// Record is compatible with v2 acl.EACLRecord message.
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-sdk-go/version"
|
"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.
|
// Table is compatible with v2 acl.EACLTable message.
|
||||||
type Table struct {
|
type Table struct {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl"
|
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.
|
// and set of public keys.
|
||||||
//
|
//
|
||||||
// Target is compatible with v2 acl.EACLRecord.Target message.
|
// Target is compatible with v2 acl.EACLRecord.Target message.
|
||||||
|
|
|
@ -36,11 +36,11 @@ func (m *MockClient) EXPECT() *MockClientMockRecorder {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateSession mocks base method.
|
// 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()
|
m.ctrl.T.Helper()
|
||||||
varargs := []interface{}{arg0, arg1}
|
varargs := []interface{}{arg0, arg1}
|
||||||
ret := m.ctrl.Call(m, "CreateSession", varargs...)
|
ret := m.ctrl.Call(m, "SessionCreate", varargs...)
|
||||||
ret0, _ := ret[0].(*client0.CreateSessionRes)
|
ret0, _ := ret[0].(*client0.ResSessionCreate)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
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 {
|
func (mr *MockClientMockRecorder) CreateSession(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
varargs := []interface{}{arg0, arg1}
|
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.
|
// 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()
|
m.ctrl.T.Helper()
|
||||||
varargs := []interface{}{arg0, arg1}
|
varargs := []interface{}{arg0, arg1}
|
||||||
ret := m.ctrl.Call(m, "DeleteContainer", varargs...)
|
ret := m.ctrl.Call(m, "ContainerDelete", varargs...)
|
||||||
ret0, _ := ret[0].(*client0.ContainerDeleteRes)
|
ret0, _ := ret[0].(*client0.ResContainerDelete)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
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 {
|
func (mr *MockClientMockRecorder) DeleteContainer(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
varargs := []interface{}{arg0, arg1}
|
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.
|
// ObjectDelete mocks base method.
|
||||||
|
@ -86,11 +86,11 @@ func (mr *MockClientMockRecorder) DeleteObject(arg0, arg1 interface{}, arg2 ...i
|
||||||
}
|
}
|
||||||
|
|
||||||
// EACL mocks base method.
|
// 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()
|
m.ctrl.T.Helper()
|
||||||
varargs := []interface{}{arg0, arg1}
|
varargs := []interface{}{arg0, arg1}
|
||||||
ret := m.ctrl.Call(m, "EACL", varargs...)
|
ret := m.ctrl.Call(m, "ContainerEACL", varargs...)
|
||||||
ret0, _ := ret[0].(*client0.EACLRes)
|
ret0, _ := ret[0].(*client0.ResContainerEACL)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
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 {
|
func (mr *MockClientMockRecorder) EACL(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
varargs := []interface{}{arg0, arg1}
|
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.
|
// 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()
|
m.ctrl.T.Helper()
|
||||||
varargs := []interface{}{arg0, arg1}
|
varargs := []interface{}{arg0, arg1}
|
||||||
ret := m.ctrl.Call(m, "EndpointInfo", varargs...)
|
ret := m.ctrl.Call(m, "EndpointInfo", varargs...)
|
||||||
ret0, _ := ret[0].(*client0.EndpointInfoRes)
|
ret0, _ := ret[0].(*client0.ResEndpointInfo)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
@ -120,11 +120,11 @@ func (mr *MockClientMockRecorder) EndpointInfo(arg0, arg1 interface{}) *gomock.C
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBalance mocks base method.
|
// 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()
|
m.ctrl.T.Helper()
|
||||||
varargs := []interface{}{arg0, arg1}
|
varargs := []interface{}{arg0, arg1}
|
||||||
ret := m.ctrl.Call(m, "GetBalance", varargs...)
|
ret := m.ctrl.Call(m, "BalanceGet", varargs...)
|
||||||
ret0, _ := ret[0].(*client0.GetBalanceRes)
|
ret0, _ := ret[0].(*client0.ResBalanceGet)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
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 {
|
func (mr *MockClientMockRecorder) GetBalance(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
varargs := []interface{}{arg0, arg1}
|
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.
|
// 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()
|
m.ctrl.T.Helper()
|
||||||
varargs := []interface{}{arg0, arg1}
|
varargs := []interface{}{arg0, arg1}
|
||||||
ret := m.ctrl.Call(m, "GetContainer", varargs...)
|
ret := m.ctrl.Call(m, "ContainerGet", varargs...)
|
||||||
ret0, _ := ret[0].(*client0.ContainerGetRes)
|
ret0, _ := ret[0].(*client0.ResContainerGet)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
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 {
|
func (mr *MockClientMockRecorder) GetContainer(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
varargs := []interface{}{arg0, arg1}
|
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.
|
// ObjectGetInitmocks base method.
|
||||||
|
@ -186,11 +186,11 @@ func (mr *MockClientMockRecorder) HeadObject(arg0, arg1 interface{}, arg2 ...int
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListContainers mocks base method.
|
// 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()
|
m.ctrl.T.Helper()
|
||||||
varargs := []interface{}{arg0, arg1}
|
varargs := []interface{}{arg0, arg1}
|
||||||
ret := m.ctrl.Call(m, "ListContainers", varargs...)
|
ret := m.ctrl.Call(m, "ContainerList", varargs...)
|
||||||
ret0, _ := ret[0].(*client0.ContainerListRes)
|
ret0, _ := ret[0].(*client0.ResContainerList)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
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 {
|
func (mr *MockClientMockRecorder) ListContainers(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
varargs := []interface{}{arg0, arg1}
|
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.
|
// 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()
|
m.ctrl.T.Helper()
|
||||||
varargs := []interface{}{arg0, arg1}
|
varargs := []interface{}{arg0, arg1}
|
||||||
ret := m.ctrl.Call(m, "NetworkInfo", varargs...)
|
ret := m.ctrl.Call(m, "NetworkInfo", varargs...)
|
||||||
ret0, _ := ret[0].(*client0.NetworkInfoRes)
|
ret0, _ := ret[0].(*client0.ResNetworkInfo)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
@ -236,11 +236,11 @@ func (mr *MockClientMockRecorder) ObjectRange(arg0, arg1 interface{}, arg2 ...in
|
||||||
}
|
}
|
||||||
|
|
||||||
// PutContainer mocks base method.
|
// 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()
|
m.ctrl.T.Helper()
|
||||||
varargs := []interface{}{arg0, arg1}
|
varargs := []interface{}{arg0, arg1}
|
||||||
ret := m.ctrl.Call(m, "PutContainer", varargs...)
|
ret := m.ctrl.Call(m, "ContainerPut", varargs...)
|
||||||
ret0, _ := ret[0].(*client0.ContainerPutRes)
|
ret0, _ := ret[0].(*client0.ResContainerPut)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
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 {
|
func (mr *MockClientMockRecorder) PutContainer(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
varargs := []interface{}{arg0, arg1}
|
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.
|
// ObjectPutInitmocks base method.
|
||||||
|
@ -285,11 +285,11 @@ func (mr *MockClientMockRecorder) SearchObjects(arg0, arg1 interface{}, arg2 ...
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEACL mocks base method.
|
// 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()
|
m.ctrl.T.Helper()
|
||||||
varargs := []interface{}{arg0, arg1}
|
varargs := []interface{}{arg0, arg1}
|
||||||
ret := m.ctrl.Call(m, "SetEACL", varargs...)
|
ret := m.ctrl.Call(m, "ContainerSetEACL", varargs...)
|
||||||
ret0, _ := ret[0].(*client0.SetEACLRes)
|
ret0, _ := ret[0].(*client0.ResContainerSetEACL)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
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 {
|
func (mr *MockClientMockRecorder) SetEACL(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
varargs := []interface{}{arg0, arg1}
|
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...)
|
||||||
}
|
}
|
||||||
|
|
70
pool/pool.go
70
pool/pool.go
|
@ -31,22 +31,22 @@ import (
|
||||||
|
|
||||||
// Client is a wrapper for client.Client to generate mock.
|
// Client is a wrapper for client.Client to generate mock.
|
||||||
type Client interface {
|
type Client interface {
|
||||||
GetBalance(context.Context, client.GetBalancePrm) (*client.GetBalanceRes, error)
|
BalanceGet(context.Context, client.PrmBalanceGet) (*client.ResBalanceGet, error)
|
||||||
PutContainer(context.Context, client.ContainerPutPrm) (*client.ContainerPutRes, error)
|
ContainerPut(context.Context, client.PrmContainerPut) (*client.ResContainerPut, error)
|
||||||
GetContainer(context.Context, client.ContainerGetPrm) (*client.ContainerGetRes, error)
|
ContainerGet(context.Context, client.PrmContainerGet) (*client.ResContainerGet, error)
|
||||||
ListContainers(context.Context, client.ContainerListPrm) (*client.ContainerListRes, error)
|
ContainerList(context.Context, client.PrmContainerList) (*client.ResContainerList, error)
|
||||||
DeleteContainer(context.Context, client.ContainerDeletePrm) (*client.ContainerDeleteRes, error)
|
ContainerDelete(context.Context, client.PrmContainerDelete) (*client.ResContainerDelete, error)
|
||||||
EACL(context.Context, client.EACLPrm) (*client.EACLRes, error)
|
ContainerEACL(context.Context, client.PrmContainerEACL) (*client.ResContainerEACL, error)
|
||||||
SetEACL(context.Context, client.SetEACLPrm) (*client.SetEACLRes, error)
|
ContainerSetEACL(context.Context, client.PrmContainerSetEACL) (*client.ResContainerSetEACL, error)
|
||||||
EndpointInfo(context.Context, client.EndpointInfoPrm) (*client.EndpointInfoRes, error)
|
EndpointInfo(context.Context, client.PrmEndpointInfo) (*client.ResEndpointInfo, error)
|
||||||
NetworkInfo(context.Context, client.NetworkInfoPrm) (*client.NetworkInfoRes, error)
|
NetworkInfo(context.Context, client.PrmNetworkInfo) (*client.ResNetworkInfo, error)
|
||||||
ObjectPutInit(context.Context, client.PrmObjectPutInit) (*client.ObjectWriter, error)
|
ObjectPutInit(context.Context, client.PrmObjectPutInit) (*client.ObjectWriter, error)
|
||||||
ObjectDelete(context.Context, client.PrmObjectDelete) (*client.ResObjectDelete, error)
|
ObjectDelete(context.Context, client.PrmObjectDelete) (*client.ResObjectDelete, error)
|
||||||
ObjectGetInit(context.Context, client.PrmObjectGet) (*client.ObjectReader, error)
|
ObjectGetInit(context.Context, client.PrmObjectGet) (*client.ObjectReader, error)
|
||||||
ObjectHead(context.Context, client.PrmObjectHead) (*client.ResObjectHead, error)
|
ObjectHead(context.Context, client.PrmObjectHead) (*client.ResObjectHead, error)
|
||||||
ObjectRangeInit(context.Context, client.PrmObjectRange) (*client.ObjectRangeReader, error)
|
ObjectRangeInit(context.Context, client.PrmObjectRange) (*client.ObjectRangeReader, error)
|
||||||
ObjectSearchInit(context.Context, client.PrmObjectSearch) (*client.ObjectListReader, 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.
|
// 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
|
healthyChanged := false
|
||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
|
|
||||||
var prmEndpoint client.EndpointInfoPrm
|
var prmEndpoint client.PrmEndpointInfo
|
||||||
|
|
||||||
for j, cPack := range p.clientPacks {
|
for j, cPack := range p.clientPacks {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
@ -535,22 +535,22 @@ func (p *pool) checkSessionTokenErr(err error, address string) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func createSessionTokenForDuration(ctx context.Context, c Client, dur uint64) (*client.CreateSessionRes, error) {
|
func createSessionTokenForDuration(ctx context.Context, c Client, dur uint64) (*client.ResSessionCreate, error) {
|
||||||
ni, err := c.NetworkInfo(ctx, client.NetworkInfoPrm{})
|
ni, err := c.NetworkInfo(ctx, client.PrmNetworkInfo{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
epoch := ni.Info().CurrentEpoch()
|
epoch := ni.Info().CurrentEpoch()
|
||||||
|
|
||||||
var prm client.CreateSessionPrm
|
var prm client.PrmSessionCreate
|
||||||
if math.MaxUint64-epoch < dur {
|
if math.MaxUint64-epoch < dur {
|
||||||
prm.SetExp(math.MaxUint64)
|
prm.SetExp(math.MaxUint64)
|
||||||
} else {
|
} else {
|
||||||
prm.SetExp(epoch + dur)
|
prm.SetExp(epoch + dur)
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.CreateSession(ctx, prm)
|
return c.SessionCreate(ctx, prm)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *pool) removeSessionTokenAfterThreshold(cfg *callConfig) error {
|
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
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var cliPrm client.ContainerPutPrm
|
var cliPrm client.PrmContainerPut
|
||||||
|
|
||||||
if cnr != nil {
|
if cnr != nil {
|
||||||
cliPrm.SetContainer(*cnr)
|
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 {
|
if p.checkSessionTokenErr(err, cp.address) && !cfg.isRetry {
|
||||||
opts = append(opts, retry())
|
opts = append(opts, retry())
|
||||||
|
@ -1095,13 +1095,13 @@ func (p *pool) GetContainer(ctx context.Context, cid *cid.ID, opts ...CallOption
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var cliPrm client.ContainerGetPrm
|
var cliPrm client.PrmContainerGet
|
||||||
|
|
||||||
if cid != nil {
|
if cid != nil {
|
||||||
cliPrm.SetContainer(*cid)
|
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 {
|
if p.checkSessionTokenErr(err, cp.address) && !cfg.isRetry {
|
||||||
opts = append(opts, retry())
|
opts = append(opts, retry())
|
||||||
|
@ -1122,13 +1122,13 @@ func (p *pool) ListContainers(ctx context.Context, ownerID *owner.ID, opts ...Ca
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var cliPrm client.ContainerListPrm
|
var cliPrm client.PrmContainerList
|
||||||
|
|
||||||
if ownerID != nil {
|
if ownerID != nil {
|
||||||
cliPrm.SetAccount(*ownerID)
|
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 {
|
if p.checkSessionTokenErr(err, cp.address) && !cfg.isRetry {
|
||||||
opts = append(opts, retry())
|
opts = append(opts, retry())
|
||||||
|
@ -1149,7 +1149,7 @@ func (p *pool) DeleteContainer(ctx context.Context, cid *cid.ID, opts ...CallOpt
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var cliPrm client.ContainerDeletePrm
|
var cliPrm client.PrmContainerDelete
|
||||||
|
|
||||||
if cid != nil {
|
if cid != nil {
|
||||||
cliPrm.SetContainer(*cid)
|
cliPrm.SetContainer(*cid)
|
||||||
|
@ -1159,7 +1159,7 @@ func (p *pool) DeleteContainer(ctx context.Context, cid *cid.ID, opts ...CallOpt
|
||||||
cliPrm.SetSessionToken(*cfg.stoken)
|
cliPrm.SetSessionToken(*cfg.stoken)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = cp.client.DeleteContainer(ctx, cliPrm)
|
_, err = cp.client.ContainerDelete(ctx, cliPrm)
|
||||||
|
|
||||||
if p.checkSessionTokenErr(err, cp.address) && !cfg.isRetry {
|
if p.checkSessionTokenErr(err, cp.address) && !cfg.isRetry {
|
||||||
opts = append(opts, retry())
|
opts = append(opts, retry())
|
||||||
|
@ -1178,13 +1178,13 @@ func (p *pool) GetEACL(ctx context.Context, cid *cid.ID, opts ...CallOption) (*e
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var cliPrm client.EACLPrm
|
var cliPrm client.PrmContainerEACL
|
||||||
|
|
||||||
if cid != nil {
|
if cid != nil {
|
||||||
cliPrm.SetContainer(*cid)
|
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 {
|
if p.checkSessionTokenErr(err, cp.address) && !cfg.isRetry {
|
||||||
opts = append(opts, retry())
|
opts = append(opts, retry())
|
||||||
|
@ -1205,13 +1205,13 @@ func (p *pool) SetEACL(ctx context.Context, table *eacl.Table, opts ...CallOptio
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var cliPrm client.SetEACLPrm
|
var cliPrm client.PrmContainerSetEACL
|
||||||
|
|
||||||
if table != nil {
|
if table != nil {
|
||||||
cliPrm.SetTable(*table)
|
cliPrm.SetTable(*table)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = cp.client.SetEACL(ctx, cliPrm)
|
_, err = cp.client.ContainerSetEACL(ctx, cliPrm)
|
||||||
|
|
||||||
if p.checkSessionTokenErr(err, cp.address) && !cfg.isRetry {
|
if p.checkSessionTokenErr(err, cp.address) && !cfg.isRetry {
|
||||||
opts = append(opts, retry())
|
opts = append(opts, retry())
|
||||||
|
@ -1230,13 +1230,13 @@ func (p *pool) Balance(ctx context.Context, o *owner.ID, opts ...CallOption) (*a
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var cliPrm client.GetBalancePrm
|
var cliPrm client.PrmBalanceGet
|
||||||
|
|
||||||
if o != nil {
|
if o != nil {
|
||||||
cliPrm.SetAccount(*o)
|
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
|
if err != nil { // here err already carries both status and client errors
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -1256,7 +1256,7 @@ func (p *pool) WaitForContainerPresence(ctx context.Context, cid *cid.ID, pollPa
|
||||||
wdone := wctx.Done()
|
wdone := wctx.Done()
|
||||||
done := ctx.Done()
|
done := ctx.Done()
|
||||||
|
|
||||||
var cliPrm client.ContainerGetPrm
|
var cliPrm client.PrmContainerGet
|
||||||
|
|
||||||
if cid != nil {
|
if cid != nil {
|
||||||
cliPrm.SetContainer(*cid)
|
cliPrm.SetContainer(*cid)
|
||||||
|
@ -1269,7 +1269,7 @@ func (p *pool) WaitForContainerPresence(ctx context.Context, cid *cid.ID, pollPa
|
||||||
case <-wdone:
|
case <-wdone:
|
||||||
return wctx.Err()
|
return wctx.Err()
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
_, err = conn.GetContainer(ctx, cliPrm)
|
_, err = conn.ContainerGet(ctx, cliPrm)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -1284,13 +1284,13 @@ func (p *pool) Close() {
|
||||||
<-p.closedCh
|
<-p.closedCh
|
||||||
}
|
}
|
||||||
|
|
||||||
// creates new session token from CreateSession call result.
|
// creates new session token from SessionCreate call result.
|
||||||
func (p *pool) newSessionToken(cliRes *client.CreateSessionRes) *session.Token {
|
func (p *pool) newSessionToken(cliRes *client.ResSessionCreate) *session.Token {
|
||||||
return sessionTokenForOwner(p.owner, cliRes)
|
return sessionTokenForOwner(p.owner, cliRes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// creates new session token with specified owner from CreateSession call result.
|
// creates new session token with specified owner from SessionCreate call result.
|
||||||
func sessionTokenForOwner(id *owner.ID, cliRes *client.CreateSessionRes) *session.Token {
|
func sessionTokenForOwner(id *owner.ID, cliRes *client.ResSessionCreate) *session.Token {
|
||||||
st := session.NewToken()
|
st := session.NewToken()
|
||||||
st.SetOwnerID(id)
|
st.SetOwnerID(id)
|
||||||
st.SetID(cliRes.ID())
|
st.SetID(cliRes.ID())
|
||||||
|
|
|
@ -49,8 +49,8 @@ func TestBuildPoolCreateSessionFailed(t *testing.T) {
|
||||||
clientBuilder := func(opts ...client.Option) (Client, error) {
|
clientBuilder := func(opts ...client.Option) (Client, error) {
|
||||||
mockClient := NewMockClient(ctrl)
|
mockClient := NewMockClient(ctrl)
|
||||||
mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("error session")).AnyTimes()
|
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().EndpointInfo(gomock.Any(), gomock.Any()).Return(&client.ResEndpointInfo{}, 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()
|
||||||
return mockClient, nil
|
return mockClient, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,12 +97,12 @@ func TestBuildPoolOneNodeFailed(t *testing.T) {
|
||||||
}).AnyTimes()
|
}).AnyTimes()
|
||||||
|
|
||||||
mockClient.EXPECT().EndpointInfo(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()
|
||||||
|
|
||||||
mockClient2 := NewMockClient(ctrl2)
|
mockClient2 := NewMockClient(ctrl2)
|
||||||
mockClient2.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
|
mockClient2.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
|
||||||
mockClient2.EXPECT().EndpointInfo(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 {
|
if clientCount == 0 {
|
||||||
return mockClient, nil
|
return mockClient, nil
|
||||||
|
@ -157,8 +157,8 @@ func TestOneNode(t *testing.T) {
|
||||||
clientBuilder := func(opts ...client.Option) (Client, error) {
|
clientBuilder := func(opts ...client.Option) (Client, error) {
|
||||||
mockClient := NewMockClient(ctrl)
|
mockClient := NewMockClient(ctrl)
|
||||||
mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(tok, nil)
|
mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(tok, nil)
|
||||||
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&client.EndpointInfoRes{}, nil).AnyTimes()
|
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&client.ResEndpointInfo{}, 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()
|
||||||
return mockClient, nil
|
return mockClient, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,8 +195,8 @@ func TestTwoNodes(t *testing.T) {
|
||||||
tokens = append(tokens, tok)
|
tokens = append(tokens, tok)
|
||||||
return tok, err
|
return tok, err
|
||||||
})
|
})
|
||||||
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&client.EndpointInfoRes{}, nil).AnyTimes()
|
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&client.ResEndpointInfo{}, 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()
|
||||||
return mockClient, nil
|
return mockClient, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ func TestOneOfTwoFailed(t *testing.T) {
|
||||||
return tok, nil
|
return tok, nil
|
||||||
}).AnyTimes()
|
}).AnyTimes()
|
||||||
mockClient.EXPECT().EndpointInfo(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()
|
||||||
|
|
||||||
mockClient2 := NewMockClient(ctrl2)
|
mockClient2 := NewMockClient(ctrl2)
|
||||||
mockClient2.EXPECT().CreateSession(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}, _ ...interface{}) (*session.Token, error) {
|
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)
|
tokens = append(tokens, tok)
|
||||||
return tok, nil
|
return tok, nil
|
||||||
}).AnyTimes()
|
}).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")
|
return nil, fmt.Errorf("error")
|
||||||
}).AnyTimes()
|
}).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")
|
return nil, fmt.Errorf("error")
|
||||||
}).AnyTimes()
|
}).AnyTimes()
|
||||||
|
|
||||||
|
@ -501,9 +501,9 @@ func TestSessionTokenOwner(t *testing.T) {
|
||||||
ctrl := gomock.NewController(t)
|
ctrl := gomock.NewController(t)
|
||||||
clientBuilder := func(opts ...client.Option) (Client, error) {
|
clientBuilder := func(opts ...client.Option) (Client, error) {
|
||||||
mockClient := NewMockClient(ctrl)
|
mockClient := NewMockClient(ctrl)
|
||||||
mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(&client.CreateSessionRes{}, nil).AnyTimes()
|
mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(&client.ResSessionCreate{}, nil).AnyTimes()
|
||||||
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&client.EndpointInfoRes{}, nil).AnyTimes()
|
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&client.ResEndpointInfo{}, 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()
|
||||||
return mockClient, nil
|
return mockClient, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,7 +542,7 @@ func TestWaitPresence(t *testing.T) {
|
||||||
mockClient := NewMockClient(ctrl)
|
mockClient := NewMockClient(ctrl)
|
||||||
mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
|
mockClient.EXPECT().CreateSession(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
|
||||||
mockClient.EXPECT().EndpointInfo(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()
|
mockClient.EXPECT().GetContainer(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
|
||||||
|
|
||||||
cache, err := NewCache()
|
cache, err := NewCache()
|
||||||
|
|
|
@ -48,11 +48,11 @@ type clientMock struct {
|
||||||
err error
|
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
|
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
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import (
|
||||||
var (
|
var (
|
||||||
errNilBearerToken = errors.New("bearer token is not set")
|
errNilBearerToken = errors.New("bearer token is not set")
|
||||||
errNilBearerTokenBody = errors.New("bearer token body 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 {
|
type BearerToken struct {
|
||||||
|
@ -178,7 +178,7 @@ func sanityCheck(b *BearerToken) error {
|
||||||
return errNilBearerTokenEACL
|
return errNilBearerTokenEACL
|
||||||
}
|
}
|
||||||
|
|
||||||
// consider checking EACL sanity there, lifetime correctness, etc.
|
// consider checking ContainerEACL sanity there, lifetime correctness, etc.
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue