forked from TrueCloudLab/frostfs-sdk-go
[#111] client: Drop client.Client
interface
Return structure instead. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
66d71cde30
commit
cb42437e5c
11 changed files with 29 additions and 131 deletions
|
@ -12,12 +12,6 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-sdk-go/owner"
|
"github.com/nspcc-dev/neofs-sdk-go/owner"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Accounting contains methods related to balance querying.
|
|
||||||
type Accounting interface {
|
|
||||||
// GetBalance returns balance of provided account.
|
|
||||||
GetBalance(context.Context, *owner.ID, ...CallOption) (*BalanceOfRes, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type BalanceOfRes struct {
|
type BalanceOfRes struct {
|
||||||
statusRes
|
statusRes
|
||||||
|
|
||||||
|
@ -32,7 +26,7 @@ func (x BalanceOfRes) Amount() *accounting.Decimal {
|
||||||
return x.amount
|
return x.amount
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientImpl) GetBalance(ctx context.Context, owner *owner.ID, opts ...CallOption) (*BalanceOfRes, error) {
|
func (c *Client) GetBalance(ctx context.Context, owner *owner.ID, opts ...CallOption) (*BalanceOfRes, error) {
|
||||||
// apply all available options
|
// apply all available options
|
||||||
callOptions := c.defaultCallOptions()
|
callOptions := c.defaultCallOptions()
|
||||||
|
|
||||||
|
|
|
@ -1,44 +1,23 @@
|
||||||
package client
|
package client
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-api-go/v2/rpc/client"
|
"github.com/nspcc-dev/neofs-api-go/v2/rpc/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Client represents NeoFS client.
|
type Client struct {
|
||||||
type Client interface {
|
|
||||||
Accounting
|
|
||||||
Container
|
|
||||||
Netmap
|
|
||||||
Object
|
|
||||||
Session
|
|
||||||
Reputation
|
|
||||||
|
|
||||||
// Raw must return underlying raw protobuf client.
|
|
||||||
Raw() *client.Client
|
|
||||||
|
|
||||||
// Conn must return underlying connection.
|
|
||||||
//
|
|
||||||
// Must return a non-nil result after the first RPC call
|
|
||||||
// completed without a connection error.
|
|
||||||
Conn() io.Closer
|
|
||||||
}
|
|
||||||
|
|
||||||
type clientImpl struct {
|
|
||||||
raw *client.Client
|
raw *client.Client
|
||||||
|
|
||||||
opts *clientOptions
|
opts *clientOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(opts ...Option) (Client, error) {
|
func New(opts ...Option) (*Client, error) {
|
||||||
clientOptions := defaultClientOptions()
|
clientOptions := defaultClientOptions()
|
||||||
|
|
||||||
for i := range opts {
|
for i := range opts {
|
||||||
opts[i](clientOptions)
|
opts[i](clientOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &clientImpl{
|
return &Client{
|
||||||
opts: clientOptions,
|
opts: clientOptions,
|
||||||
raw: client.New(clientOptions.rawOpts...),
|
raw: client.New(clientOptions.rawOpts...),
|
||||||
}, nil
|
}, nil
|
||||||
|
|
|
@ -59,7 +59,7 @@ type processResponseV2Res struct {
|
||||||
// Actions:
|
// Actions:
|
||||||
// * verify signature (internal);
|
// * verify signature (internal);
|
||||||
// * call response callback (internal).
|
// * call response callback (internal).
|
||||||
func (c *clientImpl) processResponseV2(res *processResponseV2Res, prm processResponseV2Prm) bool {
|
func (c *Client) processResponseV2(res *processResponseV2Res, prm processResponseV2Prm) bool {
|
||||||
// verify response structure
|
// verify response structure
|
||||||
if isInvalidSignatureV2(res, prm.resp) {
|
if isInvalidSignatureV2(res, prm.resp) {
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -20,30 +20,6 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-sdk-go/version"
|
"github.com/nspcc-dev/neofs-sdk-go/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Container contains methods related to container and ACL.
|
|
||||||
type Container interface {
|
|
||||||
// PutContainer creates new container in the NeoFS network.
|
|
||||||
PutContainer(context.Context, *container.Container, ...CallOption) (*ContainerPutRes, error)
|
|
||||||
|
|
||||||
// GetContainer returns container by ID.
|
|
||||||
GetContainer(context.Context, *cid.ID, ...CallOption) (*ContainerGetRes, error)
|
|
||||||
|
|
||||||
// ListContainers return container list with the provided owner.
|
|
||||||
ListContainers(context.Context, *owner.ID, ...CallOption) (*ContainerListRes, error)
|
|
||||||
|
|
||||||
// DeleteContainer removes container from NeoFS network.
|
|
||||||
DeleteContainer(context.Context, *cid.ID, ...CallOption) (*ContainerDeleteRes, error)
|
|
||||||
|
|
||||||
// EACL returns extended ACL for a given container.
|
|
||||||
EACL(context.Context, *cid.ID, ...CallOption) (*EACLRes, error)
|
|
||||||
|
|
||||||
// SetEACL sets extended ACL.
|
|
||||||
SetEACL(context.Context, *eacl.Table, ...CallOption) (*SetEACLRes, error)
|
|
||||||
|
|
||||||
// AnnounceContainerUsedSpace announces amount of space which is taken by stored objects.
|
|
||||||
AnnounceContainerUsedSpace(context.Context, []container.UsedSpaceAnnouncement, ...CallOption) (*AnnounceSpaceRes, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type delContainerSignWrapper struct {
|
type delContainerSignWrapper struct {
|
||||||
body *v2container.DeleteRequestBody
|
body *v2container.DeleteRequestBody
|
||||||
}
|
}
|
||||||
|
@ -87,7 +63,7 @@ func (x *ContainerPutRes) setID(id *cid.ID) {
|
||||||
x.id = id
|
x.id = id
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientImpl) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*ContainerPutRes, error) {
|
func (c *Client) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*ContainerPutRes, error) {
|
||||||
// apply all available options
|
// apply all available options
|
||||||
callOptions := c.defaultCallOptions()
|
callOptions := c.defaultCallOptions()
|
||||||
|
|
||||||
|
@ -194,7 +170,7 @@ func (x *ContainerGetRes) setContainer(cnr *container.Container) {
|
||||||
// GetContainer receives container structure through NeoFS API call.
|
// GetContainer receives container structure through NeoFS API call.
|
||||||
//
|
//
|
||||||
// Returns error if container structure is received but does not meet NeoFS API specification.
|
// Returns error if container structure is received but does not meet NeoFS API specification.
|
||||||
func (c *clientImpl) GetContainer(ctx context.Context, id *cid.ID, opts ...CallOption) (*ContainerGetRes, error) {
|
func (c *Client) GetContainer(ctx context.Context, id *cid.ID, opts ...CallOption) (*ContainerGetRes, error) {
|
||||||
// apply all available options
|
// apply all available options
|
||||||
callOptions := c.defaultCallOptions()
|
callOptions := c.defaultCallOptions()
|
||||||
|
|
||||||
|
@ -270,7 +246,7 @@ func (x *ContainerListRes) setIDList(ids []*cid.ID) {
|
||||||
x.ids = ids
|
x.ids = ids
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientImpl) ListContainers(ctx context.Context, ownerID *owner.ID, opts ...CallOption) (*ContainerListRes, error) {
|
func (c *Client) ListContainers(ctx context.Context, ownerID *owner.ID, opts ...CallOption) (*ContainerListRes, error) {
|
||||||
// apply all available options
|
// apply all available options
|
||||||
callOptions := c.defaultCallOptions()
|
callOptions := c.defaultCallOptions()
|
||||||
|
|
||||||
|
@ -340,7 +316,7 @@ type ContainerDeleteRes struct {
|
||||||
statusRes
|
statusRes
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientImpl) DeleteContainer(ctx context.Context, id *cid.ID, opts ...CallOption) (*ContainerDeleteRes, error) {
|
func (c *Client) DeleteContainer(ctx context.Context, id *cid.ID, opts ...CallOption) (*ContainerDeleteRes, error) {
|
||||||
// apply all available options
|
// apply all available options
|
||||||
callOptions := c.defaultCallOptions()
|
callOptions := c.defaultCallOptions()
|
||||||
|
|
||||||
|
@ -418,7 +394,7 @@ func (x *EACLRes) SetTable(table *eacl.Table) {
|
||||||
x.table = table
|
x.table = table
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientImpl) EACL(ctx context.Context, id *cid.ID, opts ...CallOption) (*EACLRes, error) {
|
func (c *Client) EACL(ctx context.Context, id *cid.ID, opts ...CallOption) (*EACLRes, error) {
|
||||||
// apply all available options
|
// apply all available options
|
||||||
callOptions := c.defaultCallOptions()
|
callOptions := c.defaultCallOptions()
|
||||||
|
|
||||||
|
@ -484,7 +460,7 @@ type SetEACLRes struct {
|
||||||
statusRes
|
statusRes
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientImpl) SetEACL(ctx context.Context, eacl *eacl.Table, opts ...CallOption) (*SetEACLRes, error) {
|
func (c *Client) SetEACL(ctx context.Context, eacl *eacl.Table, opts ...CallOption) (*SetEACLRes, error) {
|
||||||
// apply all available options
|
// apply all available options
|
||||||
callOptions := c.defaultCallOptions()
|
callOptions := c.defaultCallOptions()
|
||||||
|
|
||||||
|
@ -554,7 +530,7 @@ type AnnounceSpaceRes struct {
|
||||||
|
|
||||||
// AnnounceContainerUsedSpace used by storage nodes to estimate their container
|
// AnnounceContainerUsedSpace used by storage nodes to estimate their container
|
||||||
// sizes during lifetime. Use it only in storage node applications.
|
// sizes during lifetime. Use it only in storage node applications.
|
||||||
func (c *clientImpl) AnnounceContainerUsedSpace(
|
func (c *Client) AnnounceContainerUsedSpace(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
announce []container.UsedSpaceAnnouncement,
|
announce []container.UsedSpaceAnnouncement,
|
||||||
opts ...CallOption,
|
opts ...CallOption,
|
||||||
|
|
|
@ -12,17 +12,6 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-sdk-go/version"
|
"github.com/nspcc-dev/neofs-sdk-go/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Netmap contains methods related to netmap.
|
|
||||||
type Netmap interface {
|
|
||||||
// EndpointInfo returns attributes, address and public key of the node, specified
|
|
||||||
// in client constructor via address or open connection. This can be used as a
|
|
||||||
// health check to see if node is alive and responses to requests.
|
|
||||||
EndpointInfo(context.Context, ...CallOption) (*EndpointInfoRes, error)
|
|
||||||
|
|
||||||
// NetworkInfo returns information about the NeoFS network of which the remote server is a part.
|
|
||||||
NetworkInfo(context.Context, ...CallOption) (*NetworkInfoRes, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
// EACLWithSignature represents eACL table/signature pair.
|
// EACLWithSignature represents eACL table/signature pair.
|
||||||
type EndpointInfo struct {
|
type EndpointInfo struct {
|
||||||
version *version.Version
|
version *version.Version
|
||||||
|
@ -57,7 +46,7 @@ func (x *EndpointInfoRes) setInfo(info *EndpointInfo) {
|
||||||
// EndpointInfo returns attributes, address and public key of the node, specified
|
// EndpointInfo returns attributes, address and public key of the node, specified
|
||||||
// in client constructor via address or open connection. This can be used as a
|
// in client constructor via address or open connection. This can be used as a
|
||||||
// health check to see if node is alive and responses to requests.
|
// health check to see if node is alive and responses to requests.
|
||||||
func (c *clientImpl) EndpointInfo(ctx context.Context, opts ...CallOption) (*EndpointInfoRes, error) {
|
func (c *Client) EndpointInfo(ctx context.Context, opts ...CallOption) (*EndpointInfoRes, error) {
|
||||||
// apply all available options
|
// apply all available options
|
||||||
callOptions := c.defaultCallOptions()
|
callOptions := c.defaultCallOptions()
|
||||||
|
|
||||||
|
@ -126,7 +115,7 @@ func (x *NetworkInfoRes) setInfo(info *netmap.NetworkInfo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkInfo returns information about the NeoFS network of which the remote server is a part.
|
// NetworkInfo returns information about the NeoFS network of which the remote server is a part.
|
||||||
func (c *clientImpl) NetworkInfo(ctx context.Context, opts ...CallOption) (*NetworkInfoRes, error) {
|
func (c *Client) NetworkInfo(ctx context.Context, opts ...CallOption) (*NetworkInfoRes, error) {
|
||||||
// apply all available options
|
// apply all available options
|
||||||
callOptions := c.defaultCallOptions()
|
callOptions := c.defaultCallOptions()
|
||||||
|
|
||||||
|
|
|
@ -20,30 +20,6 @@ import (
|
||||||
signer "github.com/nspcc-dev/neofs-sdk-go/util/signature"
|
signer "github.com/nspcc-dev/neofs-sdk-go/util/signature"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Object contains methods for working with objects.
|
|
||||||
type Object interface {
|
|
||||||
// PutObject puts new object to NeoFS.
|
|
||||||
PutObject(context.Context, *PutObjectParams, ...CallOption) (*ObjectPutRes, error)
|
|
||||||
|
|
||||||
// DeleteObject deletes object to NeoFS.
|
|
||||||
DeleteObject(context.Context, *DeleteObjectParams, ...CallOption) (*ObjectDeleteRes, error)
|
|
||||||
|
|
||||||
// GetObject returns object stored in NeoFS.
|
|
||||||
GetObject(context.Context, *GetObjectParams, ...CallOption) (*ObjectGetRes, error)
|
|
||||||
|
|
||||||
// HeadObject returns object header.
|
|
||||||
HeadObject(context.Context, *ObjectHeaderParams, ...CallOption) (*ObjectHeadRes, error)
|
|
||||||
|
|
||||||
// ObjectPayloadRangeData returns range of object payload.
|
|
||||||
ObjectPayloadRangeData(context.Context, *RangeDataParams, ...CallOption) (*ObjectRangeRes, error)
|
|
||||||
|
|
||||||
// HashObjectPayloadRanges returns hashes of the object payload ranges from NeoFS.
|
|
||||||
HashObjectPayloadRanges(context.Context, *RangeChecksumParams, ...CallOption) (*ObjectRangeHashRes, error)
|
|
||||||
|
|
||||||
// SearchObjects searches for objects in NeoFS using provided parameters.
|
|
||||||
SearchObjects(context.Context, *SearchObjectParams, ...CallOption) (*ObjectSearchRes, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type PutObjectParams struct {
|
type PutObjectParams struct {
|
||||||
obj *object.Object
|
obj *object.Object
|
||||||
|
|
||||||
|
@ -221,7 +197,7 @@ func (x ObjectPutRes) ID() *object.ID {
|
||||||
return x.id
|
return x.id
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientImpl) PutObject(ctx context.Context, p *PutObjectParams, opts ...CallOption) (*ObjectPutRes, error) {
|
func (c *Client) PutObject(ctx context.Context, p *PutObjectParams, opts ...CallOption) (*ObjectPutRes, error) {
|
||||||
callOpts := c.defaultCallOptions()
|
callOpts := c.defaultCallOptions()
|
||||||
|
|
||||||
for i := range opts {
|
for i := range opts {
|
||||||
|
@ -393,7 +369,7 @@ func (x *ObjectDeleteRes) setTombstoneAddress(addr *object.Address) {
|
||||||
// DeleteObject removes object by address.
|
// DeleteObject removes object by address.
|
||||||
//
|
//
|
||||||
// If target of tombstone address is not set, the address is ignored.
|
// If target of tombstone address is not set, the address is ignored.
|
||||||
func (c *clientImpl) DeleteObject(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) (*ObjectDeleteRes, error) {
|
func (c *Client) DeleteObject(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) (*ObjectDeleteRes, error) {
|
||||||
callOpts := c.defaultCallOptions()
|
callOpts := c.defaultCallOptions()
|
||||||
|
|
||||||
for i := range opts {
|
for i := range opts {
|
||||||
|
@ -615,7 +591,7 @@ func writeUnexpectedMessageTypeErr(res resCommon, val interface{}) {
|
||||||
res.setStatus(st)
|
res.setStatus(st)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientImpl) GetObject(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*ObjectGetRes, error) {
|
func (c *Client) GetObject(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*ObjectGetRes, error) {
|
||||||
callOpts := c.defaultCallOptions()
|
callOpts := c.defaultCallOptions()
|
||||||
|
|
||||||
for i := range opts {
|
for i := range opts {
|
||||||
|
@ -823,7 +799,7 @@ type ObjectHeadRes struct {
|
||||||
objectRes
|
objectRes
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientImpl) HeadObject(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*ObjectHeadRes, error) {
|
func (c *Client) HeadObject(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*ObjectHeadRes, error) {
|
||||||
callOpts := c.defaultCallOptions()
|
callOpts := c.defaultCallOptions()
|
||||||
|
|
||||||
for i := range opts {
|
for i := range opts {
|
||||||
|
@ -1016,7 +992,7 @@ func (x ObjectRangeRes) Data() []byte {
|
||||||
return x.data
|
return x.data
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientImpl) ObjectPayloadRangeData(ctx context.Context, p *RangeDataParams, opts ...CallOption) (*ObjectRangeRes, error) {
|
func (c *Client) ObjectPayloadRangeData(ctx context.Context, p *RangeDataParams, opts ...CallOption) (*ObjectRangeRes, error) {
|
||||||
callOpts := c.defaultCallOptions()
|
callOpts := c.defaultCallOptions()
|
||||||
|
|
||||||
for i := range opts {
|
for i := range opts {
|
||||||
|
@ -1203,7 +1179,7 @@ func (x ObjectRangeHashRes) Hashes() [][]byte {
|
||||||
return x.hashes
|
return x.hashes
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientImpl) HashObjectPayloadRanges(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) (*ObjectRangeHashRes, error) {
|
func (c *Client) HashObjectPayloadRanges(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) (*ObjectRangeHashRes, error) {
|
||||||
callOpts := c.defaultCallOptions()
|
callOpts := c.defaultCallOptions()
|
||||||
|
|
||||||
for i := range opts {
|
for i := range opts {
|
||||||
|
@ -1328,7 +1304,7 @@ func (x ObjectSearchRes) IDList() []*object.ID {
|
||||||
return x.ids
|
return x.ids
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientImpl) SearchObjects(ctx context.Context, p *SearchObjectParams, opts ...CallOption) (*ObjectSearchRes, error) {
|
func (c *Client) SearchObjects(ctx context.Context, p *SearchObjectParams, opts ...CallOption) (*ObjectSearchRes, error) {
|
||||||
callOpts := c.defaultCallOptions()
|
callOpts := c.defaultCallOptions()
|
||||||
|
|
||||||
for i := range opts {
|
for i := range opts {
|
||||||
|
@ -1428,7 +1404,7 @@ func (c *clientImpl) SearchObjects(ctx context.Context, p *SearchObjectParams, o
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientImpl) attachV2SessionToken(opts *callOptions, hdr *v2session.RequestMetaHeader, info v2SessionReqInfo) error {
|
func (c *Client) attachV2SessionToken(opts *callOptions, hdr *v2session.RequestMetaHeader, info v2SessionReqInfo) error {
|
||||||
if opts.session == nil {
|
if opts.session == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ type (
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *clientImpl) defaultCallOptions() *callOptions {
|
func (c *Client) defaultCallOptions() *callOptions {
|
||||||
return &callOptions{
|
return &callOptions{
|
||||||
version: version.Current(),
|
version: version.Current(),
|
||||||
ttl: 2,
|
ttl: 2,
|
||||||
|
|
|
@ -7,11 +7,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Raw returns underlying raw protobuf client.
|
// Raw returns underlying raw protobuf client.
|
||||||
func (c *clientImpl) Raw() *client.Client {
|
func (c *Client) Raw() *client.Client {
|
||||||
return c.raw
|
return c.raw
|
||||||
}
|
}
|
||||||
|
|
||||||
// implements Client.Conn method.
|
// implements Client.Conn method.
|
||||||
func (c *clientImpl) Conn() io.Closer {
|
func (c *Client) Conn() io.Closer {
|
||||||
return c.raw.Conn()
|
return c.raw.Conn()
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,16 +10,6 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-sdk-go/reputation"
|
"github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Reputation contains methods for working with Reputation system values.
|
|
||||||
type Reputation interface {
|
|
||||||
// AnnounceLocalTrust announces local trust values of local peer.
|
|
||||||
AnnounceLocalTrust(context.Context, AnnounceLocalTrustPrm, ...CallOption) (*AnnounceLocalTrustRes, error)
|
|
||||||
|
|
||||||
// AnnounceIntermediateTrust announces the intermediate result of the iterative algorithm for calculating
|
|
||||||
// the global reputation of the node.
|
|
||||||
AnnounceIntermediateTrust(context.Context, AnnounceIntermediateTrustPrm, ...CallOption) (*AnnounceIntermediateTrustRes, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
// AnnounceLocalTrustPrm groups parameters of AnnounceLocalTrust operation.
|
// AnnounceLocalTrustPrm groups parameters of AnnounceLocalTrust operation.
|
||||||
type AnnounceLocalTrustPrm struct {
|
type AnnounceLocalTrustPrm struct {
|
||||||
epoch uint64
|
epoch uint64
|
||||||
|
@ -52,7 +42,7 @@ type AnnounceLocalTrustRes struct {
|
||||||
statusRes
|
statusRes
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientImpl) AnnounceLocalTrust(ctx context.Context, prm AnnounceLocalTrustPrm, opts ...CallOption) (*AnnounceLocalTrustRes, error) {
|
func (c *Client) AnnounceLocalTrust(ctx context.Context, prm AnnounceLocalTrustPrm, opts ...CallOption) (*AnnounceLocalTrustRes, error) {
|
||||||
// apply all available options
|
// apply all available options
|
||||||
callOptions := c.defaultCallOptions()
|
callOptions := c.defaultCallOptions()
|
||||||
|
|
||||||
|
@ -143,7 +133,7 @@ type AnnounceIntermediateTrustRes struct {
|
||||||
statusRes
|
statusRes
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientImpl) AnnounceIntermediateTrust(ctx context.Context, prm AnnounceIntermediateTrustPrm, opts ...CallOption) (*AnnounceIntermediateTrustRes, error) {
|
func (c *Client) AnnounceIntermediateTrust(ctx context.Context, prm AnnounceIntermediateTrustPrm, opts ...CallOption) (*AnnounceIntermediateTrustRes, error) {
|
||||||
// apply all available options
|
// apply all available options
|
||||||
callOptions := c.defaultCallOptions()
|
callOptions := c.defaultCallOptions()
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ func WithResponseInfoHandler(f func(ResponseMetaInfo) error) Option {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientImpl) handleResponseInfoV2(opts *callOptions, resp responseV2) error {
|
func (c *Client) handleResponseInfoV2(opts *callOptions, resp responseV2) error {
|
||||||
if c.opts.cbRespInfo == nil {
|
if c.opts.cbRespInfo == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,6 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-sdk-go/owner"
|
"github.com/nspcc-dev/neofs-sdk-go/owner"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Session contains session-related methods.
|
|
||||||
type Session interface {
|
|
||||||
// CreateSession creates session using provided expiration time.
|
|
||||||
CreateSession(context.Context, uint64, ...CallOption) (*CreateSessionRes, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
var errMalformedResponseBody = errors.New("malformed response body")
|
var errMalformedResponseBody = errors.New("malformed response body")
|
||||||
|
|
||||||
type CreateSessionRes struct {
|
type CreateSessionRes struct {
|
||||||
|
@ -44,7 +38,7 @@ func (x CreateSessionRes) SessionKey() []byte {
|
||||||
return x.sessionKey
|
return x.sessionKey
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientImpl) CreateSession(ctx context.Context, expiration uint64, opts ...CallOption) (*CreateSessionRes, error) {
|
func (c *Client) CreateSession(ctx context.Context, expiration uint64, opts ...CallOption) (*CreateSessionRes, error) {
|
||||||
// apply all available options
|
// apply all available options
|
||||||
callOptions := c.defaultCallOptions()
|
callOptions := c.defaultCallOptions()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue