client

package
v1.22.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2021 License: Apache-2.0 Imports: 27 Imported by: 1

Documentation

Index

Constants

View Source
const TZSize = 64

Variables

This section is empty.

Functions

func DeleteObject added in v1.21.0

func DeleteObject(ctx context.Context, c *Client, p *DeleteObjectParams, opts ...CallOption) (*object.Address, error)

DeleteObject is a wrapper over Client.DeleteObject method that provides the ability to receive tombstone address without setting a target in the parameters.

func GetVerifiedContainerStructure added in v1.21.1

func GetVerifiedContainerStructure(ctx context.Context, c *Client, id *container.ID, opts ...CallOption) (*container.Container, error)

GetVerifiedContainerStructure is a wrapper over Client.GetContainer method which checks if the structure of the resulting container matches its identifier.

Returns container.ErrIDMismatch if container does not match the identifier.

Types

type CallOption

type CallOption interface {
	// contains filtered or unexported methods
}

func WithBearer

func WithBearer(token *token.BearerToken) CallOption

func WithEpoch

func WithEpoch(epoch uint64) CallOption

func WithSession

func WithSession(token *token.SessionToken) CallOption

func WithTTL

func WithTTL(ttl uint32) CallOption

func WithXHeader

func WithXHeader(x *pkg.XHeader) CallOption

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(key *ecdsa.PrivateKey, opts ...Option) (*Client, error)

func (*Client) AttachBearerToken

func (c *Client) AttachBearerToken(token *token.BearerToken)

AttachBearerToken attaches bearer token to client.

Provided bearer is attached to all requests without WithBearer option. Use WithBearer(nil) option in order to send request without bearer token.

func (*Client) AttachSessionToken

func (c *Client) AttachSessionToken(token *token.SessionToken)

AttachSessionToken attaches session token to client.

Provided token is attached to all requests without WithSession option. Use WithSession(nil) option in order to send request without session token.

func (Client) CreateSession

func (c Client) CreateSession(ctx context.Context, expiration uint64, opts ...CallOption) (*token.SessionToken, error)

func (Client) DeleteContainer

func (c Client) DeleteContainer(ctx context.Context, id *container.ID, opts ...CallOption) error

func (*Client) DeleteObject

func (c *Client) DeleteObject(ctx context.Context, p *DeleteObjectParams, opts ...CallOption) error

DeleteObject removes object by address.

If target of tombstone address is not set, the address is ignored.

func (Client) EndpointInfo

func (c Client) EndpointInfo(ctx context.Context, opts ...CallOption) (*netmap.NodeInfo, error)

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.

func (Client) Epoch

func (c Client) Epoch(ctx context.Context, opts ...CallOption) (uint64, error)

Epoch returns the epoch number from the local state of the remote host.

func (Client) GetBalance

func (c Client) GetBalance(ctx context.Context, owner *owner.ID, opts ...CallOption) (*accounting.Decimal, error)

func (Client) GetContainer

func (c Client) GetContainer(ctx context.Context, id *container.ID, opts ...CallOption) (*container.Container, error)

GetContainer receives container structure through NeoFS API call.

Returns error if container structure is received but does not meet NeoFS API specification.

func (Client) GetEACL

func (c Client) GetEACL(ctx context.Context, id *container.ID, opts ...CallOption) (*eacl.Table, error)

func (Client) GetEACLWithSignature added in v1.20.3

func (c Client) GetEACLWithSignature(ctx context.Context, id *container.ID, opts ...CallOption) (*EACLWithSignature, error)

func (*Client) GetObject

func (c *Client) GetObject(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*object.Object, error)

func (*Client) GetObjectHeader

func (c *Client) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*object.Object, error)

func (Client) GetSelfBalance

func (c Client) GetSelfBalance(ctx context.Context, opts ...CallOption) (*accounting.Decimal, error)

func (Client) ListContainers

func (c Client) ListContainers(ctx context.Context, owner *owner.ID, opts ...CallOption) ([]*container.ID, error)

func (Client) ListSelfContainers

func (c Client) ListSelfContainers(ctx context.Context, opts ...CallOption) ([]*container.ID, error)

func (*Client) ObjectPayloadRangeData

func (c *Client) ObjectPayloadRangeData(ctx context.Context, p *RangeDataParams, opts ...CallOption) ([]byte, error)

func (*Client) ObjectPayloadRangeSHA256

func (c *Client) ObjectPayloadRangeSHA256(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) ([][sha256.Size]byte, error)

func (*Client) ObjectPayloadRangeTZ

func (c *Client) ObjectPayloadRangeTZ(ctx context.Context, p *RangeChecksumParams, opts ...CallOption) ([][TZSize]byte, error)

func (Client) PutContainer

func (c Client) PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*container.ID, error)

func (*Client) PutObject

func (c *Client) PutObject(ctx context.Context, p *PutObjectParams, opts ...CallOption) (*object.ID, error)

func (*Client) SearchObject

func (c *Client) SearchObject(ctx context.Context, p *SearchObjectParams, opts ...CallOption) ([]*object.ID, error)

func (Client) SetEACL

func (c Client) SetEACL(ctx context.Context, eacl *eacl.Table, opts ...CallOption) error

type DeleteObjectParams

type DeleteObjectParams struct {
	// contains filtered or unexported fields
}

func (*DeleteObjectParams) Address added in v1.21.0

func (p *DeleteObjectParams) Address() *object.Address

func (*DeleteObjectParams) TombstoneAddressTarget added in v1.21.0

func (p *DeleteObjectParams) TombstoneAddressTarget() ObjectAddressWriter

TombstoneAddressTarget returns target component to write tombstone address.

func (*DeleteObjectParams) WithAddress

func (*DeleteObjectParams) WithTombstoneAddressTarget added in v1.21.0

func (p *DeleteObjectParams) WithTombstoneAddressTarget(v ObjectAddressWriter) *DeleteObjectParams

WithTombstoneAddressTarget sets target component to write tombstone address.

type EACLWithSignature added in v1.20.3

type EACLWithSignature struct {
	// contains filtered or unexported fields
}

EACLWithSignature represents eACL table/signature pair.

func (EACLWithSignature) EACL added in v1.20.3

func (e EACLWithSignature) EACL() *eacl.Table

EACL returns eACL table.

func (EACLWithSignature) Signature added in v1.20.3

func (e EACLWithSignature) Signature() *pkg.Signature

Signature returns table signature.

type GetObjectParams

type GetObjectParams struct {
	// contains filtered or unexported fields
}

func (*GetObjectParams) Address added in v1.21.0

func (p *GetObjectParams) Address() *object.Address

func (*GetObjectParams) PayloadWriter added in v1.21.0

func (p *GetObjectParams) PayloadWriter() io.Writer

func (*GetObjectParams) RawFlag added in v1.21.0

func (p *GetObjectParams) RawFlag() bool

func (*GetObjectParams) WithAddress

func (p *GetObjectParams) WithAddress(v *object.Address) *GetObjectParams

func (*GetObjectParams) WithPayloadWriter

func (p *GetObjectParams) WithPayloadWriter(w io.Writer) *GetObjectParams

func (*GetObjectParams) WithRawFlag added in v1.21.0

func (p *GetObjectParams) WithRawFlag(v bool) *GetObjectParams

type ObjectAddressWriter added in v1.21.0

type ObjectAddressWriter interface {
	SetAddress(*object.Address)
}

ObjectAddressWriter is an interface of the component that writes the object address.

type ObjectHeaderParams

type ObjectHeaderParams struct {
	// contains filtered or unexported fields
}

func (*ObjectHeaderParams) Address added in v1.21.0

func (p *ObjectHeaderParams) Address() *object.Address

func (*ObjectHeaderParams) AllFields added in v1.21.0

func (p *ObjectHeaderParams) AllFields() bool

AllFields return true if parameter set to return all header fields, returns false if parameter set to return only main fields of header.

func (*ObjectHeaderParams) RawFlag added in v1.21.0

func (p *ObjectHeaderParams) RawFlag() bool

func (*ObjectHeaderParams) WithAddress

func (*ObjectHeaderParams) WithAllFields

func (p *ObjectHeaderParams) WithAllFields() *ObjectHeaderParams

func (*ObjectHeaderParams) WithMainFields

func (p *ObjectHeaderParams) WithMainFields() *ObjectHeaderParams

func (*ObjectHeaderParams) WithRawFlag added in v1.21.0

func (p *ObjectHeaderParams) WithRawFlag(v bool) *ObjectHeaderParams

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithAddress

func WithAddress(addr string) Option

func WithDialTimeout added in v1.20.3

func WithDialTimeout(dur time.Duration) Option

WithDialTimeout returns option to set connection timeout to the remote node.

func WithGRPCConnection

func WithGRPCConnection(grpcConn *grpc.ClientConn) Option

type PutObjectParams

type PutObjectParams struct {
	// contains filtered or unexported fields
}

func (*PutObjectParams) Object added in v1.21.0

func (p *PutObjectParams) Object() *object.Object

func (*PutObjectParams) PayloadReader added in v1.21.0

func (p *PutObjectParams) PayloadReader() io.Reader

func (*PutObjectParams) WithObject

func (p *PutObjectParams) WithObject(v *object.Object) *PutObjectParams

func (*PutObjectParams) WithPayloadReader

func (p *PutObjectParams) WithPayloadReader(v io.Reader) *PutObjectParams

type RangeChecksumParams

type RangeChecksumParams struct {
	// contains filtered or unexported fields
}

func (*RangeChecksumParams) Address added in v1.21.0

func (p *RangeChecksumParams) Address() *object.Address

func (*RangeChecksumParams) RangeList added in v1.21.0

func (p *RangeChecksumParams) RangeList() []*object.Range

func (*RangeChecksumParams) Salt added in v1.21.0

func (p *RangeChecksumParams) Salt() []byte

func (*RangeChecksumParams) WithAddress

func (*RangeChecksumParams) WithRangeList

func (p *RangeChecksumParams) WithRangeList(rs ...*object.Range) *RangeChecksumParams

func (*RangeChecksumParams) WithSalt

func (p *RangeChecksumParams) WithSalt(v []byte) *RangeChecksumParams

type RangeDataParams

type RangeDataParams struct {
	// contains filtered or unexported fields
}

func (*RangeDataParams) Address added in v1.21.0

func (p *RangeDataParams) Address() *object.Address

func (*RangeDataParams) DataWriter added in v1.21.0

func (p *RangeDataParams) DataWriter() io.Writer

func (*RangeDataParams) Range added in v1.21.0

func (p *RangeDataParams) Range() *object.Range

func (*RangeDataParams) Raw added in v1.21.0

func (p *RangeDataParams) Raw() bool

func (*RangeDataParams) WithAddress

func (p *RangeDataParams) WithAddress(v *object.Address) *RangeDataParams

func (*RangeDataParams) WithDataWriter

func (p *RangeDataParams) WithDataWriter(v io.Writer) *RangeDataParams

func (*RangeDataParams) WithRange

func (p *RangeDataParams) WithRange(v *object.Range) *RangeDataParams

func (*RangeDataParams) WithRaw added in v1.21.0

func (p *RangeDataParams) WithRaw(v bool) *RangeDataParams

type SearchObjectParams

type SearchObjectParams struct {
	// contains filtered or unexported fields
}

func (*SearchObjectParams) ContainerID added in v1.21.0

func (p *SearchObjectParams) ContainerID() *container.ID

func (*SearchObjectParams) SearchFilters added in v1.21.0

func (p *SearchObjectParams) SearchFilters() object.SearchFilters

func (*SearchObjectParams) WithContainerID

func (p *SearchObjectParams) WithContainerID(v *container.ID) *SearchObjectParams

func (*SearchObjectParams) WithSearchFilters

func (p *SearchObjectParams) WithSearchFilters(v object.SearchFilters) *SearchObjectParams

type TransportInfo

type TransportInfo struct {
	Version  *pkg.Version
	Protocol TransportProtocol
}

type TransportProtocol

type TransportProtocol uint32
const (
	Unknown TransportProtocol = iota
	GRPC
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL