client

package
v0.0.0-...-5e759bf Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 33 Imported by: 10

Documentation

Overview

Package client provides FrostFS API client implementation.

The main component is Client type. It is a virtual connection to the network and provides methods for executing operations on the server.

Create client instance:

var c client.Client

Initialize client state:

var prm client.PrmInit
prm.SetDefaultPrivateKey(key)
// ...

c.Init(prm)

Connect to the FrostFS server:

var prm client.PrmDial
prm.SetServerURI("localhost:8080")
prm.SetDefaultPrivateKey(key)
// ...

err := c.Dial(prm)
// ...

Execute FrostFS operation on the server:

var prm client.PrmContainerPut
prm.SetContainer(cnr)
// ...

res, err := c.ContainerPut(context.Background(), prm)
err := c.Dial(dialPrm)
if err == nil {
	err = apistatus.ErrFromStatus(res.Status())
}
// ...

Consume custom service of the server:

syntax = "proto3";

service CustomService {
	rpc CustomRPC(CustomRPCRequest) returns (CustomRPCResponse);
}

import "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client"
import "github.com/TrueCloudLab/frostfs-api-go/v2/rpc/common"

req := new(CustomRPCRequest)
// ...
resp := new(CustomRPCResponse)

err := c.ExecRaw(func(c *client.Client) error {
	return client.SendUnary(c, common.CallMethodInfo{
		Service: "CustomService",
		Name:    "CustomRPC",
	}, req, resp)
})
// ...

Close the connection:

err := c.Close()
// ...

Note that it's not allowed to override Client behaviour directly: the parameters for the all operations are write-only and the results of the all operations are read-only. To be able to override client behavior (e.g. for tests), abstract it with an interface:

import "github.com/TrueCloudLab/frostfs-sdk-go/client"

type FrostFSClient interface {
	// Operations according to the application needs
	CreateContainer(context.Context, container.Container) error
	// ...
}

type client struct {
	c *client.Client
}

func (x *client) CreateContainer(context.Context, container.Container) error {
	// ...
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErrContainerNotFound

func IsErrContainerNotFound(err error) bool

IsErrContainerNotFound checks if err corresponds to FrostFS status return corresponding to missing container. Supports wrapped errors.

func IsErrEACLNotFound

func IsErrEACLNotFound(err error) bool

IsErrEACLNotFound checks if err corresponds to FrostFS status return corresponding to missing eACL table. Supports wrapped errors.

func IsErrObjectAlreadyRemoved

func IsErrObjectAlreadyRemoved(err error) bool

IsErrObjectAlreadyRemoved checks if err corresponds to FrostFS status return corresponding to already removed object. Supports wrapped errors.

func IsErrObjectNotFound

func IsErrObjectNotFound(err error) bool

IsErrObjectNotFound checks if err corresponds to FrostFS status return corresponding to missing object. Supports wrapped errors.

func IsErrSessionExpired

func IsErrSessionExpired(err error) bool

IsErrSessionExpired checks if err corresponds to FrostFS status return corresponding to expired session. Supports wrapped errors.

func IsErrSessionNotFound

func IsErrSessionNotFound(err error) bool

IsErrSessionNotFound checks if err corresponds to FrostFS status return corresponding to missing session. Supports wrapped errors.

func SyncContainerWithNetwork

func SyncContainerWithNetwork(ctx context.Context, cnr *container.Container, c *Client) error

SyncContainerWithNetwork requests network configuration using passed client and applies it to the container. Container MUST not be nil.

Note: if container does not match network configuration, SyncContainerWithNetwork changes it.

Returns any network/parsing config errors.

See also NetworkInfo, container.ApplyNetworkConfig.

Types

type Client

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

Client represents virtual connection to the FrostFS network to communicate with FrostFS server using FrostFS API protocol. It is designed to provide an abstraction interface from the protocol details of data transfer over a network in FrostFS.

Client can be created using simple Go variable declaration. Before starting work with the Client, it SHOULD BE correctly initialized (see Init method). Before executing the FrostFS operations using the Client, connection to the server MUST BE correctly established (see Dial method and pay attention to the mandatory parameters). Using the Client before connecting have been established can lead to a panic. After the work, the Client SHOULD BE closed (see Close method): it frees internal and system resources which were allocated for the period of work of the Client. Calling Init/Dial/Close method during the communication process step strongly discouraged as it leads to undefined behavior.

Each method which produces a FrostFS API call may return a server response. Status responses are returned in the result structure, and can be cast to built-in error instance (or in the returned error if the client is configured accordingly). Certain statuses can be checked using `apistatus` and standard `errors` packages. Note that package provides some helper functions to work with status returns (e.g. IsErrContainerNotFound). All possible responses are documented in methods, however, some may be returned from all of them (pay attention to the presence of the pointer sign):

  • *apistatus.ServerInternal on internal server error;
  • *apistatus.NodeUnderMaintenance if a server is under maintenance;
  • *apistatus.SuccessDefaultV2 on default success.

Client MUST NOT be copied by value: use pointer to Client instead.

See client package overview to get some examples.

func (*Client) AnnounceIntermediateTrust

func (c *Client) AnnounceIntermediateTrust(ctx context.Context, prm PrmAnnounceIntermediateTrust) (*ResAnnounceIntermediateTrust, error)

AnnounceIntermediateTrust sends global trust values calculated for the specified FrostFS network participants at some stage of client's calculation algorithm.

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`. If PrmInit.ResolveFrostFSFailures has been called, unsuccessful FrostFS status codes are returned as `error`, otherwise, are included in the returned result structure.

Returns an error if parameters are set incorrectly (see PrmAnnounceIntermediateTrust docs). Context is required and must not be nil. It is used for network communication.

Return statuses:

  • global (see Client docs).

func (*Client) AnnounceLocalTrust

func (c *Client) AnnounceLocalTrust(ctx context.Context, prm PrmAnnounceLocalTrust) (*ResAnnounceLocalTrust, error)

AnnounceLocalTrust sends client's trust values to the FrostFS network participants.

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`. If PrmInit.ResolveFrostFSFailures has been called, unsuccessful FrostFS status codes are returned as `error`, otherwise, are included in the returned result structure.

Returns an error if parameters are set incorrectly (see PrmAnnounceLocalTrust docs). Context is required and must not be nil. It is used for network communication.

Return statuses:

  • global (see Client docs).

func (*Client) BalanceGet

func (c *Client) BalanceGet(ctx context.Context, prm PrmBalanceGet) (*ResBalanceGet, error)

BalanceGet requests current balance of the FrostFS account.

Exactly one return value is non-nil. By default, server status is returned in res structure. Any client's internal or transport errors are returned as `error`, If PrmInit.ResolveFrostFSFailures has been called, unsuccessful FrostFS status codes are returned as `error`, otherwise, are included in the returned result structure.

Returns an error if parameters are set incorrectly (see PrmBalanceGet docs). Context is required and must not be nil. It is used for network communication.

Return statuses:

  • global (see Client docs).

func (*Client) Close

func (c *Client) Close() error

Close closes underlying connection to the FrostFS server. Implements io.Closer. MUST NOT be called before successful Dial. Can be called concurrently with server operations processing on running goroutines: in this case they are likely to fail due to a connection error.

One-time method call during application shutdown stage (after Init and Dial) is expected. Calling multiple times leads to undefined behavior.

See also Init / Dial.

func (*Client) ContainerAnnounceUsedSpace

func (c *Client) ContainerAnnounceUsedSpace(ctx context.Context, prm PrmAnnounceSpace) (*ResAnnounceSpace, error)

ContainerAnnounceUsedSpace sends request to announce volume of the space used for the container objects.

Exactly one return value is non-nil. By default, server status is returned in res structure. Any client's internal or transport errors are returned as `error`. If PrmInit.ResolveFrostFSFailures has been called, unsuccessful FrostFS status codes are returned as `error`, otherwise, are included in the returned result structure.

Operation is asynchronous and no guaranteed even in the absence of errors. The required time is also not predictable.

At this moment success can not be checked.

Returns an error if parameters are set incorrectly (see PrmAnnounceSpace docs). Context is required and must not be nil. It is used for network communication.

Return statuses:

  • global (see Client docs).

func (*Client) ContainerDelete

func (c *Client) ContainerDelete(ctx context.Context, prm PrmContainerDelete) (*ResContainerDelete, error)

ContainerDelete sends request to remove the FrostFS container.

Exactly one return value is non-nil. By default, server status is returned in res structure. Any client's internal or transport errors are returned as `error`. If PrmInit.ResolveFrostFSFailures has been called, unsuccessful FrostFS status codes are returned as `error`, otherwise, are included in the returned result structure.

Operation is asynchronous and no guaranteed even in the absence of errors. The required time is also not predictable.

Success can be verified by reading by identifier (see GetContainer).

Returns an error if parameters are set incorrectly (see PrmContainerDelete docs). Context is required and must not be nil. It is used for network communication.

Exactly one return value is non-nil. Server status return is returned in ResContainerDelete. Reflects all internal errors in second return value (transport problems, response processing, etc.).

Return statuses:

  • global (see Client docs).

func (*Client) ContainerEACL

func (c *Client) ContainerEACL(ctx context.Context, prm PrmContainerEACL) (*ResContainerEACL, error)

ContainerEACL reads eACL table of the FrostFS container.

Exactly one return value is non-nil. By default, server status is returned in res structure. Any client's internal or transport errors are returned as `error`. If PrmInit.ResolveFrostFSFailures has been called, unsuccessful FrostFS status codes are returned as `error`, otherwise, are included in the returned result structure.

Returns an error if parameters are set incorrectly (see PrmContainerEACL docs). Context is required and must not be nil. It is used for network communication.

Return statuses:

  • global (see Client docs);
  • *apistatus.ContainerNotFound;
  • *apistatus.EACLNotFound.

func (*Client) ContainerGet

func (c *Client) ContainerGet(ctx context.Context, prm PrmContainerGet) (*ResContainerGet, error)

ContainerGet reads FrostFS container by ID.

Exactly one return value is non-nil. By default, server status is returned in res structure. Any client's internal or transport errors are returned as `error`. If PrmInit.ResolveFrostFSFailures has been called, unsuccessful FrostFS status codes are returned as `error`, otherwise, are included in the returned result structure.

Returns an error if parameters are set incorrectly (see PrmContainerGet docs). Context is required and must not be nil. It is used for network communication.

Return statuses:

  • global (see Client docs);
  • *apistatus.ContainerNotFound.

func (*Client) ContainerList

func (c *Client) ContainerList(ctx context.Context, prm PrmContainerList) (*ResContainerList, error)

ContainerList requests identifiers of the account-owned containers.

Exactly one return value is non-nil. By default, server status is returned in res structure. Any client's internal or transport errors are returned as `error`. If PrmInit.ResolveFrostFSFailures has been called, unsuccessful FrostFS status codes are returned as `error`, otherwise, are included in the returned result structure.

Returns an error if parameters are set incorrectly (see PrmContainerList docs). Context is required and must not be nil. It is used for network communication.

Return statuses:

  • global (see Client docs).

func (*Client) ContainerPut

func (c *Client) ContainerPut(ctx context.Context, prm PrmContainerPut) (*ResContainerPut, error)

ContainerPut sends request to save container in FrostFS.

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`. If PrmInit.ResolveFrostFSFailures has been called, unsuccessful FrostFS status codes are returned as `error`, otherwise, are included in the returned result structure.

Operation is asynchronous and no guaranteed even in the absence of errors. The required time is also not predictable.

Success can be verified by reading by identifier (see ResContainerPut.ID).

Returns an error if parameters are set incorrectly (see PrmContainerPut docs). Context is required and must not be nil. It is used for network communication.

Return statuses:

  • global (see Client docs).

func (*Client) ContainerSetEACL

func (c *Client) ContainerSetEACL(ctx context.Context, prm PrmContainerSetEACL) (*ResContainerSetEACL, error)

ContainerSetEACL sends request to update eACL table of the FrostFS container.

Exactly one return value is non-nil. By default, server status is returned in res structure. Any client's internal or transport errors are returned as `error`. If PrmInit.ResolveFrostFSFailures has been called, unsuccessful FrostFS status codes are returned as `error`, otherwise, are included in the returned result structure.

Operation is asynchronous and no guaranteed even in the absence of errors. The required time is also not predictable.

Success can be verified by reading by identifier (see EACL).

Returns an error if parameters are set incorrectly (see PrmContainerSetEACL docs). Context is required and must not be nil. It is used for network communication.

Return statuses:

  • global (see Client docs).

func (*Client) Dial

func (c *Client) Dial(prm PrmDial) error

Dial establishes a connection to the server from the FrostFS network. Returns an error describing failure reason. If failed, the Client SHOULD NOT be used.

Uses the context specified by SetContext if it was called with non-nil argument, otherwise context.Background() is used. Dial returns context errors, see context package docs for details.

Returns an error if required parameters are set incorrectly, look carefully at the method documentation.

One-time method call during application start-up stage (after Init ) is expected. Calling multiple times leads to undefined behavior.

See also Init / Close.

func (*Client) EndpointInfo

func (c *Client) EndpointInfo(ctx context.Context, prm PrmEndpointInfo) (*ResEndpointInfo, error)

EndpointInfo requests information about the storage node served on the remote endpoint.

Method can be used as a health check to see if node is alive and responds to requests.

Any client's internal or transport errors are returned as `error`. If PrmInit.ResolveFrostFSFailures has been called, unsuccessful FrostFS status codes are returned as `error`, otherwise, are included in the returned result structure.

Returns an error if parameters are set incorrectly (see PrmEndpointInfo docs). Context is required and must not be nil. It is used for network communication.

Exactly one return value is non-nil. Server status return is returned in ResEndpointInfo. Reflects all internal errors in second return value (transport problems, response processing, etc.).

Return statuses:

  • global (see Client docs).

func (*Client) ExecRaw

func (c *Client) ExecRaw(f func(client *client.Client) error) error

ExecRaw executes f with underlying github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client.Client instance. Communicate over the Protocol Buffers protocol in a more flexible way: most often used to transmit data over a fixed version of the FrostFS protocol, as well as to support custom services.

The f must not manipulate the client connection passed into it.

Like all other operations, must be called after connecting to the server and before closing the connection.

See also Dial and Close. See also github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client package docs.

func (*Client) Init

func (c *Client) Init(prm PrmInit)

Init brings the Client instance to its initial state.

One-time method call during application init stage (before Dial) is expected. Calling multiple times leads to undefined behavior.

See docs of PrmInit methods for details. See also Dial / Close.

func (*Client) NetMapSnapshot

func (c *Client) NetMapSnapshot(ctx context.Context, _ PrmNetMapSnapshot) (*ResNetMapSnapshot, error)

NetMapSnapshot requests current network view of the remote server.

Any client's internal or transport errors are returned as `error`. If PrmInit.ResolveFrostFSFailures has been called, unsuccessful FrostFS status codes are returned as `error`, otherwise, are included in the returned result structure.

Returns an error if parameters are set incorrectly. 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 ResNetMapSnapshot. Reflects all internal errors in second return value (transport problems, response processing, etc.).

Return statuses:

  • global (see Client docs).

func (*Client) NetworkInfo

func (c *Client) NetworkInfo(ctx context.Context, prm PrmNetworkInfo) (*ResNetworkInfo, error)

NetworkInfo requests information about the FrostFS network of which the remote server is a part.

Any client's internal or transport errors are returned as `error`. If PrmInit.ResolveFrostFSFailures has been called, unsuccessful FrostFS status codes are returned as `error`, otherwise, are included in the returned result structure.

Returns an error if parameters are set incorrectly (see PrmNetworkInfo docs). Context is required and must not be nil. It is used for network communication.

Exactly one return value is non-nil. Server status return is returned in ResNetworkInfo. Reflects all internal errors in second return value (transport problems, response processing, etc.).

Return statuses:

  • global (see Client docs).

func (*Client) ObjectDelete

func (c *Client) ObjectDelete(ctx context.Context, prm PrmObjectDelete) (*ResObjectDelete, error)

ObjectDelete marks an object for deletion from the container using FrostFS API protocol. As a marker, a special unit called a tombstone is placed in the container. It confirms the user's intent to delete the object, and is itself a container object. Explicit deletion is done asynchronously, and is generally not guaranteed.

Returns a list of checksums in raw form: the format of hashes and their number is left for the caller to check. Client preserves the order of the server's response.

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`, If PrmInit.ResolveFrostFSFailures has been called, unsuccessful FrostFS status codes are returned as `error`, otherwise, are included in the returned result structure.

Returns an error if parameters are set incorrectly (see PrmObjectDelete docs). Context is required and must not be nil. It is used for network communication.

Return statuses:

  • global (see Client docs)
  • *apistatus.ContainerNotFound;
  • *apistatus.ObjectAccessDenied;
  • *apistatus.ObjectLocked;
  • *apistatus.SessionTokenExpired.

func (*Client) ObjectGetInit

func (c *Client) ObjectGetInit(ctx context.Context, prm PrmObjectGet) (*ObjectReader, error)

ObjectGetInit initiates reading an object through a remote server using FrostFS API protocol.

The call only opens the transmission channel, explicit fetching is done using the ObjectReader. Exactly one return value is non-nil. Resulting reader must be finally closed.

Returns an error if parameters are set incorrectly (see PrmObjectGet docs). Context is required and must not be nil. It is used for network communication.

func (*Client) ObjectHash

func (c *Client) ObjectHash(ctx context.Context, prm PrmObjectHash) (*ResObjectHash, error)

ObjectHash requests checksum of the range list of the object payload using FrostFS API protocol.

Returns a list of checksums in raw form: the format of hashes and their number is left for the caller to check. Client preserves the order of the server's response.

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`, If PrmInit.ResolveFrostFSFailures has been called, unsuccessful FrostFS status codes are returned as `error`, otherwise, are included in the returned result structure.

Returns an error if parameters are set incorrectly (see PrmObjectHash docs). Context is required and must not be nil. It is used for network communication.

Return statuses:

  • global (see Client docs);
  • *apistatus.ContainerNotFound;
  • *apistatus.ObjectNotFound;
  • *apistatus.ObjectAccessDenied;
  • *apistatus.ObjectOutOfRange;
  • *apistatus.SessionTokenExpired.

func (*Client) ObjectHead

func (c *Client) ObjectHead(ctx context.Context, prm PrmObjectHead) (*ResObjectHead, error)

ObjectHead reads object header through a remote server using FrostFS API protocol.

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`, If PrmInit.ResolveFrostFSFailures has been called, unsuccessful FrostFS status codes are returned as `error`, otherwise, are included in the returned result structure.

Returns an error if parameters are set incorrectly (see PrmObjectHead docs). Context is required and must not be nil. It is used for network communication.

Return errors:

*object.SplitInfoError (returned on virtual objects with PrmObjectHead.MakeRaw).

Return statuses:

  • global (see Client docs);
  • *apistatus.ContainerNotFound;
  • *apistatus.ObjectNotFound;
  • *apistatus.ObjectAccessDenied;
  • *apistatus.ObjectAlreadyRemoved;
  • *apistatus.SessionTokenExpired.

func (*Client) ObjectPutInit

func (c *Client) ObjectPutInit(ctx context.Context, prm PrmObjectPutInit) (*ObjectWriter, error)

ObjectPutInit initiates writing an object through a remote server using FrostFS API protocol.

The call only opens the transmission channel, explicit recording is done using the ObjectWriter. Exactly one return value is non-nil. Resulting writer must be finally closed.

Returns an error if parameters are set incorrectly. Context is required and must not be nil. It is used for network communication.

func (*Client) ObjectRangeInit

func (c *Client) ObjectRangeInit(ctx context.Context, prm PrmObjectRange) (*ObjectRangeReader, error)

ObjectRangeInit initiates reading an object's payload range through a remote server using FrostFS API protocol.

The call only opens the transmission channel, explicit fetching is done using the ObjectRangeReader. Exactly one return value is non-nil. Resulting reader must be finally closed.

Returns an error if parameters are set incorrectly (see PrmObjectRange docs). Context is required and must not be nil. It is used for network communication.

func (*Client) ObjectSearchInit

func (c *Client) ObjectSearchInit(ctx context.Context, prm PrmObjectSearch) (*ObjectListReader, error)

ObjectSearchInit initiates object selection through a remote server using FrostFS API protocol.

The call only opens the transmission channel, explicit fetching of matched objects is done using the ObjectListReader. Exactly one return value is non-nil. Resulting reader must be finally closed.

Returns an error if parameters are set incorrectly (see PrmObjectSearch docs). Context is required and must not be nil. It is used for network communication.

func (*Client) SessionCreate

func (c *Client) SessionCreate(ctx context.Context, prm PrmSessionCreate) (*ResSessionCreate, error)

SessionCreate opens a session with the node server on the remote endpoint. The session lifetime coincides with the server lifetime. Results can be written to session token which can be later attached to the requests.

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`. If PrmInit.ResolveFrostFSFailures has been called, unsuccessful FrostFS status codes are returned as `error`, otherwise, are included in the returned result structure.

Returns an error if parameters are set incorrectly (see PrmSessionCreate docs). Context is required and must not be nil. It is used for network communication.

Return statuses:

  • global (see Client docs).

type ObjectListReader

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

ObjectListReader is designed to read list of object identifiers from FrostFS system.

Must be initialized using Client.ObjectSearch, any other usage is unsafe.

func (*ObjectListReader) Close

func (x *ObjectListReader) Close() (*ResObjectSearch, error)

Close ends reading list of the matched objects and returns the result of the operation along with the final results. Must be called after using the ObjectListReader.

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 Go built-in error. If Client is tuned to resolve FrostFS API statuses, then FrostFS failures codes are returned as error.

Return statuses:

  • global (see Client docs);
  • *apistatus.ContainerNotFound;
  • *apistatus.ObjectAccessDenied;
  • *apistatus.SessionTokenExpired.

func (*ObjectListReader) Iterate

func (x *ObjectListReader) Iterate(f func(oid.ID) bool) error

Iterate iterates over the list of found object identifiers. f can return true to stop iteration earlier.

Returns an error if object can't be read.

func (*ObjectListReader) Read

func (x *ObjectListReader) Read(buf []oid.ID) (int, bool)

Read reads another list of the object identifiers. Works similar to io.Reader.Read but copies oid.ID and returns success flag instead of error.

Failure reason can be received via Close.

Panics if buf has zero length.

type ObjectRangeReader

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

ObjectRangeReader is designed to read payload range of one object from FrostFS system.

Must be initialized using Client.ObjectRangeInit, any other usage is unsafe.

func (*ObjectRangeReader) Close

func (x *ObjectRangeReader) Close() (*ResObjectRange, error)

Close ends reading the payload range and returns the result of the operation along with the final results. Must be called after using the ObjectRangeReader.

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 Go built-in error. If Client is tuned to resolve FrostFS API statuses, then FrostFS failures codes are returned as error.

Return errors:

*object.SplitInfoError (returned on virtual objects with PrmObjectRange.MakeRaw).

Return statuses:

  • global (see Client docs);
  • *apistatus.ContainerNotFound;
  • *apistatus.ObjectNotFound;
  • *apistatus.ObjectAccessDenied;
  • *apistatus.ObjectAlreadyRemoved;
  • *apistatus.ObjectOutOfRange;
  • *apistatus.SessionTokenExpired.

func (*ObjectRangeReader) Read

func (x *ObjectRangeReader) Read(p []byte) (int, error)

Read implements io.Reader of the object payload.

func (*ObjectRangeReader) ReadChunk

func (x *ObjectRangeReader) ReadChunk(buf []byte) (int, bool)

ReadChunk reads another chunk of the object payload range. Works similar to io.Reader.Read but returns success flag instead of error.

Failure reason can be received via Close.

type ObjectReader

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

ObjectReader is designed to read one object from FrostFS system.

Must be initialized using Client.ObjectGetInit, any other usage is unsafe.

func (*ObjectReader) Close

func (x *ObjectReader) Close() (*ResObjectGet, error)

Close ends reading the object and returns the result of the operation along with the final results. Must be called after using the ObjectReader.

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 Go built-in error. If Client is tuned to resolve FrostFS API statuses, then FrostFS failures codes are returned as error.

Return errors:

*object.SplitInfoError (returned on virtual objects with PrmObjectGet.MakeRaw).

Return statuses:

  • global (see Client docs);
  • *apistatus.ContainerNotFound;
  • *apistatus.ObjectNotFound;
  • *apistatus.ObjectAccessDenied;
  • *apistatus.ObjectAlreadyRemoved;
  • *apistatus.SessionTokenExpired.

func (*ObjectReader) Read

func (x *ObjectReader) Read(p []byte) (int, error)

Read implements io.Reader of the object payload.

func (*ObjectReader) ReadChunk

func (x *ObjectReader) ReadChunk(buf []byte) (int, bool)

ReadChunk reads another chunk of the object payload. Works similar to io.Reader.Read but returns success flag instead of error.

Failure reason can be received via Close.

func (*ObjectReader) ReadHeader

func (x *ObjectReader) ReadHeader(dst *object.Object) bool

ReadHeader reads header of the object. Result means success. Failure reason can be received via Close.

type ObjectWriter

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

ObjectWriter is designed to write one object to FrostFS system.

Must be initialized using Client.ObjectPutInit, any other usage is unsafe.

func (*ObjectWriter) Close

func (x *ObjectWriter) Close() (*ResObjectPut, error)

Close ends writing the object and returns the result of the operation along with the final results. Must be called after using the ObjectWriter.

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 Go built-in error. If Client is tuned to resolve FrostFS API statuses, then FrostFS failures codes are returned as error.

Return statuses:

  • global (see Client docs);
  • *apistatus.ContainerNotFound;
  • *apistatus.ObjectAccessDenied;
  • *apistatus.ObjectLocked;
  • *apistatus.LockNonRegularObject;
  • *apistatus.SessionTokenNotFound;
  • *apistatus.SessionTokenExpired.

func (*ObjectWriter) WriteHeader

func (x *ObjectWriter) WriteHeader(hdr object.Object) bool

WriteHeader writes header of the object. Result means success. Failure reason can be received via Close.

func (*ObjectWriter) WritePayloadChunk

func (x *ObjectWriter) WritePayloadChunk(chunk []byte) bool

WritePayloadChunk writes chunk of the object payload. Result means success. Failure reason can be received via Close.

type PrmAnnounceIntermediateTrust

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

PrmAnnounceIntermediateTrust groups parameters of AnnounceIntermediateTrust operation.

func (*PrmAnnounceIntermediateTrust) SetCurrentValue

func (x *PrmAnnounceIntermediateTrust) SetCurrentValue(trust reputation.PeerToPeerTrust)

SetCurrentValue sets current global trust value computed at the specified iteration of the client's calculation algorithm. Required parameter.

func (*PrmAnnounceIntermediateTrust) SetEpoch

func (x *PrmAnnounceIntermediateTrust) SetEpoch(epoch uint64)

SetEpoch sets number of FrostFS epoch with which client's calculation algorithm is initialized. Required parameter, must not be zero.

func (*PrmAnnounceIntermediateTrust) SetIteration

func (x *PrmAnnounceIntermediateTrust) SetIteration(iter uint32)

SetIteration sets current sequence number of the client's calculation algorithm. By default, corresponds to initial (zero) iteration.

func (*PrmAnnounceIntermediateTrust) WithXHeaders

func (x *PrmAnnounceIntermediateTrust) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

type PrmAnnounceLocalTrust

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

PrmAnnounceLocalTrust groups parameters of AnnounceLocalTrust operation.

func (*PrmAnnounceLocalTrust) SetEpoch

func (x *PrmAnnounceLocalTrust) SetEpoch(epoch uint64)

SetEpoch sets number of FrostFS epoch in which the trust was assessed. Required parameter, must not be zero.

func (*PrmAnnounceLocalTrust) SetValues

func (x *PrmAnnounceLocalTrust) SetValues(trusts []reputation.Trust)

SetValues sets values describing trust of the client to the FrostFS network participants. Required parameter. Must not be empty.

Must not be mutated before the end of the operation.

func (*PrmAnnounceLocalTrust) WithXHeaders

func (x *PrmAnnounceLocalTrust) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

type PrmAnnounceSpace

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

PrmAnnounceSpace groups parameters of ContainerAnnounceUsedSpace operation.

func (*PrmAnnounceSpace) SetValues

func (x *PrmAnnounceSpace) SetValues(vs []container.SizeEstimation)

SetValues sets values describing volume of space that is used for the container objects. Required parameter. Must not be empty.

Must not be mutated before the end of the operation.

func (*PrmAnnounceSpace) WithXHeaders

func (x *PrmAnnounceSpace) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

type PrmBalanceGet

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

PrmBalanceGet groups parameters of BalanceGet operation.

func (*PrmBalanceGet) SetAccount

func (x *PrmBalanceGet) SetAccount(id user.ID)

SetAccount sets identifier of the FrostFS account for which the balance is requested. Required parameter.

func (*PrmBalanceGet) WithXHeaders

func (x *PrmBalanceGet) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

type PrmContainerDelete

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

PrmContainerDelete groups parameters of ContainerDelete operation.

func (*PrmContainerDelete) SetContainer

func (x *PrmContainerDelete) SetContainer(id cid.ID)

SetContainer sets identifier of the FrostFS container to be removed. Required parameter.

func (*PrmContainerDelete) WithXHeaders

func (x *PrmContainerDelete) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

func (*PrmContainerDelete) WithinSession

func (x *PrmContainerDelete) WithinSession(tok session.Container)

WithinSession specifies session within which container should be removed.

Creator of the session acquires the authorship of the request. This may affect the execution of an operation (e.g. access control).

Must be signed.

type PrmContainerEACL

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

PrmContainerEACL groups parameters of ContainerEACL operation.

func (*PrmContainerEACL) SetContainer

func (x *PrmContainerEACL) SetContainer(id cid.ID)

SetContainer sets identifier of the FrostFS container to read the eACL table. Required parameter.

func (*PrmContainerEACL) WithXHeaders

func (x *PrmContainerEACL) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

type PrmContainerGet

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

PrmContainerGet groups parameters of ContainerGet operation.

func (*PrmContainerGet) SetContainer

func (x *PrmContainerGet) SetContainer(id cid.ID)

SetContainer sets identifier of the container to be read. Required parameter.

func (*PrmContainerGet) WithXHeaders

func (x *PrmContainerGet) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

type PrmContainerList

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

PrmContainerList groups parameters of ContainerList operation.

func (*PrmContainerList) SetAccount

func (x *PrmContainerList) SetAccount(id user.ID)

SetAccount sets identifier of the FrostFS account to list the containers. Required parameter.

func (*PrmContainerList) WithXHeaders

func (x *PrmContainerList) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

type PrmContainerPut

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

PrmContainerPut groups parameters of ContainerPut operation.

func (*PrmContainerPut) SetContainer

func (x *PrmContainerPut) SetContainer(cnr container.Container)

SetContainer sets structured information about new FrostFS container. Required parameter.

func (*PrmContainerPut) WithXHeaders

func (x *PrmContainerPut) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

func (*PrmContainerPut) WithinSession

func (x *PrmContainerPut) WithinSession(s session.Container)

WithinSession specifies session within which container should be saved.

Creator of the session acquires the authorship of the request. This affects the execution of an operation (e.g. access control).

Session is optional, if set the following requirements apply:

  • session operation MUST be session.VerbContainerPut (ForVerb)
  • token MUST be signed using private key of the owner of the container to be saved

type PrmContainerSetEACL

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

PrmContainerSetEACL groups parameters of ContainerSetEACL operation.

func (*PrmContainerSetEACL) SetTable

func (x *PrmContainerSetEACL) SetTable(table eacl.Table)

SetTable sets eACL table structure to be set for the container. Required parameter.

func (*PrmContainerSetEACL) WithXHeaders

func (x *PrmContainerSetEACL) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

func (*PrmContainerSetEACL) WithinSession

func (x *PrmContainerSetEACL) WithinSession(s session.Container)

WithinSession specifies session within which extended ACL of the container should be saved.

Creator of the session acquires the authorship of the request. This affects the execution of an operation (e.g. access control).

Session is optional, if set the following requirements apply:

  • if particular container is specified (ApplyOnlyTo), it MUST equal the container for which extended ACL is going to be set
  • session operation MUST be session.VerbContainerSetEACL (ForVerb)
  • token MUST be signed using private key of the owner of the container to be saved

type PrmDial

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

PrmDial groups connection parameters for the Client.

See also Dial.

func (*PrmDial) SetContext

func (x *PrmDial) SetContext(ctx context.Context)

SetContext allows to specify optional base context within which connection should be established.

Context SHOULD NOT be nil.

func (*PrmDial) SetServerURI

func (x *PrmDial) SetServerURI(endpoint string)

SetServerURI sets server URI in the FrostFS network. Required parameter.

Format of the URI:

[scheme://]host:port

Supported schemes:

grpc
grpcs

See also SetTLSConfig.

func (*PrmDial) SetStreamTimeout

func (x *PrmDial) SetStreamTimeout(timeout time.Duration)

SetStreamTimeout sets the timeout for individual operations in streaming RPC. MUST BE positive. If not called, 10s timeout will be used by default.

func (*PrmDial) SetTLSConfig

func (x *PrmDial) SetTLSConfig(tlsConfig *tls.Config)

SetTLSConfig sets tls.Config to open TLS client connection to the FrostFS server. Nil (default) means insecure connection.

See also SetServerURI.

func (*PrmDial) SetTimeout

func (x *PrmDial) SetTimeout(timeout time.Duration)

SetTimeout sets the timeout for connection to be established. MUST BE positive. If not called, 5s timeout will be used by default.

type PrmEndpointInfo

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

PrmEndpointInfo groups parameters of EndpointInfo operation.

func (*PrmEndpointInfo) WithXHeaders

func (x *PrmEndpointInfo) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

type PrmInit

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

PrmInit groups initialization parameters of Client instances.

See also Init.

func (*PrmInit) ResolveFrostFSFailures

func (x *PrmInit) ResolveFrostFSFailures()

ResolveFrostFSFailures makes the Client to resolve failure statuses of the FrostFS protocol into Go built-in errors. These errors are returned from each protocol operation. By default, statuses aren't resolved and written to the resulting structure (see corresponding Res* docs).

func (*PrmInit) SetDefaultPrivateKey

func (x *PrmInit) SetDefaultPrivateKey(key ecdsa.PrivateKey)

SetDefaultPrivateKey sets Client private key to be used for the protocol communication by default.

Required for operations without custom key parametrization (see corresponding Prm* docs).

func (*PrmInit) SetResponseInfoCallback

func (x *PrmInit) SetResponseInfoCallback(f func(ResponseMetaInfo) error)

SetResponseInfoCallback makes the Client to pass ResponseMetaInfo from each FrostFS server response to f. Nil (default) means ignore response meta info.

type PrmNetMapSnapshot

type PrmNetMapSnapshot struct {
}

PrmNetMapSnapshot groups parameters of NetMapSnapshot operation.

type PrmNetworkInfo

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

PrmNetworkInfo groups parameters of NetworkInfo operation.

func (*PrmNetworkInfo) WithXHeaders

func (x *PrmNetworkInfo) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

type PrmObjectDelete

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

PrmObjectDelete groups parameters of ObjectDelete operation.

func (*PrmObjectDelete) ByID

func (x *PrmObjectDelete) ByID(id oid.ID)

ByID specifies identifier of the requested object. Required parameter.

func (*PrmObjectDelete) FromContainer

func (x *PrmObjectDelete) FromContainer(id cid.ID)

FromContainer specifies FrostFS container of the object. Required parameter.

func (*PrmObjectDelete) UseKey

func (x *PrmObjectDelete) UseKey(key ecdsa.PrivateKey)

UseKey specifies private key to sign the requests. If key is not provided, then Client default key is used.

func (*PrmObjectDelete) WithBearerToken

func (x *PrmObjectDelete) WithBearerToken(t bearer.Token)

WithBearerToken attaches bearer token to be used for the operation.

If set, underlying eACL rules will be used in access control.

Must be signed.

func (*PrmObjectDelete) WithXHeaders

func (x *PrmObjectDelete) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

func (*PrmObjectDelete) WithinSession

func (x *PrmObjectDelete) WithinSession(t session.Object)

WithinSession specifies session within which object should be read.

Creator of the session acquires the authorship of the request. This may affect the execution of an operation (e.g. access control).

Must be signed.

type PrmObjectGet

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

PrmObjectGet groups parameters of ObjectGetInit operation.

func (*PrmObjectGet) ByID

func (x *PrmObjectGet) ByID(id oid.ID)

ByID specifies identifier of the requested object. Required parameter.

func (*PrmObjectGet) FromContainer

func (x *PrmObjectGet) FromContainer(id cid.ID)

FromContainer specifies FrostFS container of the object. Required parameter.

func (*PrmObjectGet) MarkLocal

func (x *PrmObjectGet) MarkLocal()

MarkLocal tells the server to execute the operation locally.

func (*PrmObjectGet) MarkRaw

func (x *PrmObjectGet) MarkRaw()

MarkRaw marks an intent to read physically stored object.

func (*PrmObjectGet) UseKey

func (x *PrmObjectGet) UseKey(key ecdsa.PrivateKey)

UseKey specifies private key to sign the requests. If key is not provided, then Client default key is used.

func (*PrmObjectGet) WithBearerToken

func (x *PrmObjectGet) WithBearerToken(t bearer.Token)

WithBearerToken attaches bearer token to be used for the operation.

If set, underlying eACL rules will be used in access control.

Must be signed.

func (*PrmObjectGet) WithXHeaders

func (x *PrmObjectGet) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

func (*PrmObjectGet) WithinSession

func (x *PrmObjectGet) WithinSession(t session.Object)

WithinSession specifies session within which object should be read.

Creator of the session acquires the authorship of the request. This may affect the execution of an operation (e.g. access control).

Must be signed.

type PrmObjectHash

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

PrmObjectHash groups parameters of ObjectHash operation.

func (*PrmObjectHash) ByID

func (x *PrmObjectHash) ByID(id oid.ID)

ByID specifies identifier of the requested object. Required parameter.

func (*PrmObjectHash) FromContainer

func (x *PrmObjectHash) FromContainer(id cid.ID)

FromContainer specifies FrostFS container of the object. Required parameter.

func (*PrmObjectHash) MarkLocal

func (x *PrmObjectHash) MarkLocal()

MarkLocal tells the server to execute the operation locally.

func (*PrmObjectHash) SetRangeList

func (x *PrmObjectHash) SetRangeList(r ...uint64)

SetRangeList sets list of ranges in (offset, length) pair format. Required parameter.

If passed as slice, then it must not be mutated before the operation completes.

func (*PrmObjectHash) TillichZemorAlgo

func (x *PrmObjectHash) TillichZemorAlgo()

TillichZemorAlgo changes the hash function to Tillich-Zemor (https://link.springer.com/content/pdf/10.1007/3-540-48658-5_5.pdf).

By default, SHA256 hash function is used.

func (*PrmObjectHash) UseKey

func (x *PrmObjectHash) UseKey(key ecdsa.PrivateKey)

UseKey specifies private key to sign the requests. If key is not provided, then Client default key is used.

func (*PrmObjectHash) UseSalt

func (x *PrmObjectHash) UseSalt(salt []byte)

UseSalt sets the salt to XOR the data range before hashing.

Must not be mutated before the operation completes.

func (*PrmObjectHash) WithBearerToken

func (x *PrmObjectHash) WithBearerToken(t bearer.Token)

WithBearerToken attaches bearer token to be used for the operation.

If set, underlying eACL rules will be used in access control.

Must be signed.

func (*PrmObjectHash) WithXHeaders

func (x *PrmObjectHash) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

func (*PrmObjectHash) WithinSession

func (x *PrmObjectHash) WithinSession(t session.Object)

WithinSession specifies session within which object should be read.

Creator of the session acquires the authorship of the request. This may affect the execution of an operation (e.g. access control).

Must be signed.

type PrmObjectHead

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

PrmObjectHead groups parameters of ObjectHead operation.

func (*PrmObjectHead) ByID

func (x *PrmObjectHead) ByID(id oid.ID)

ByID specifies identifier of the requested object. Required parameter.

func (*PrmObjectHead) FromContainer

func (x *PrmObjectHead) FromContainer(id cid.ID)

FromContainer specifies FrostFS container of the object. Required parameter.

func (*PrmObjectHead) MarkLocal

func (x *PrmObjectHead) MarkLocal()

MarkLocal tells the server to execute the operation locally.

func (*PrmObjectHead) MarkRaw

func (x *PrmObjectHead) MarkRaw()

MarkRaw marks an intent to read physically stored object.

func (*PrmObjectHead) UseKey

func (x *PrmObjectHead) UseKey(key ecdsa.PrivateKey)

UseKey specifies private key to sign the requests. If key is not provided, then Client default key is used.

func (*PrmObjectHead) WithBearerToken

func (x *PrmObjectHead) WithBearerToken(t bearer.Token)

WithBearerToken attaches bearer token to be used for the operation.

If set, underlying eACL rules will be used in access control.

Must be signed.

func (*PrmObjectHead) WithXHeaders

func (x *PrmObjectHead) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

func (*PrmObjectHead) WithinSession

func (x *PrmObjectHead) WithinSession(t session.Object)

WithinSession specifies session within which object should be read.

Creator of the session acquires the authorship of the request. This may affect the execution of an operation (e.g. access control).

Must be signed.

type PrmObjectPutInit

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

PrmObjectPutInit groups parameters of ObjectPutInit operation.

func (*PrmObjectPutInit) MarkLocal

func (x *PrmObjectPutInit) MarkLocal()

MarkLocal tells the server to execute the operation locally.

func (*PrmObjectPutInit) SetCopiesNumber

func (x *PrmObjectPutInit) SetCopiesNumber(copiesNumber uint32)

SetCopiesNumber sets number of object copies that is enough to consider put successful.

func (*PrmObjectPutInit) UseKey

func (x *PrmObjectPutInit) UseKey(key ecdsa.PrivateKey)

UseKey specifies private key to sign the requests. If key is not provided, then Client default key is used.

func (*PrmObjectPutInit) WithBearerToken

func (x *PrmObjectPutInit) WithBearerToken(t bearer.Token)

WithBearerToken attaches bearer token to be used for the operation. Should be called once before any writing steps.

func (*PrmObjectPutInit) WithXHeaders

func (x *PrmObjectPutInit) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

func (*PrmObjectPutInit) WithinSession

func (x *PrmObjectPutInit) WithinSession(t session.Object)

WithinSession specifies session within which object should be stored. Should be called once before any writing steps.

type PrmObjectRange

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

PrmObjectRange groups parameters of ObjectRange operation.

func (*PrmObjectRange) ByID

func (x *PrmObjectRange) ByID(id oid.ID)

ByID specifies identifier of the requested object. Required parameter.

func (*PrmObjectRange) FromContainer

func (x *PrmObjectRange) FromContainer(id cid.ID)

FromContainer specifies FrostFS container of the object. Required parameter.

func (*PrmObjectRange) MarkLocal

func (x *PrmObjectRange) MarkLocal()

MarkLocal tells the server to execute the operation locally.

func (*PrmObjectRange) MarkRaw

func (x *PrmObjectRange) MarkRaw()

MarkRaw marks an intent to read physically stored object.

func (*PrmObjectRange) SetLength

func (x *PrmObjectRange) SetLength(ln uint64)

SetLength sets length of the payload range to be read. Must be positive.

func (*PrmObjectRange) SetOffset

func (x *PrmObjectRange) SetOffset(off uint64)

SetOffset sets offset of the payload range to be read. Zero by default.

func (*PrmObjectRange) UseKey

func (x *PrmObjectRange) UseKey(key ecdsa.PrivateKey)

UseKey specifies private key to sign the requests. If key is not provided, then Client default key is used.

func (*PrmObjectRange) WithBearerToken

func (x *PrmObjectRange) WithBearerToken(t bearer.Token)

WithBearerToken attaches bearer token to be used for the operation.

If set, underlying eACL rules will be used in access control.

Must be signed.

func (*PrmObjectRange) WithXHeaders

func (x *PrmObjectRange) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

func (*PrmObjectRange) WithinSession

func (x *PrmObjectRange) WithinSession(t session.Object)

WithinSession specifies session within which object should be read.

Creator of the session acquires the authorship of the request. This may affect the execution of an operation (e.g. access control).

Must be signed.

type PrmObjectSearch

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

PrmObjectSearch groups parameters of ObjectSearch operation.

func (*PrmObjectSearch) InContainer

func (x *PrmObjectSearch) InContainer(id cid.ID)

InContainer specifies the container in which to look for objects. Required parameter.

func (*PrmObjectSearch) MarkLocal

func (x *PrmObjectSearch) MarkLocal()

MarkLocal tells the server to execute the operation locally.

func (*PrmObjectSearch) SetFilters

func (x *PrmObjectSearch) SetFilters(filters object.SearchFilters)

SetFilters sets filters by which to select objects. All container objects match unset/empty filters.

func (*PrmObjectSearch) UseKey

func (x *PrmObjectSearch) UseKey(key ecdsa.PrivateKey)

UseKey specifies private key to sign the requests. If key is not provided, then Client default key is used.

func (*PrmObjectSearch) WithBearerToken

func (x *PrmObjectSearch) WithBearerToken(t bearer.Token)

WithBearerToken attaches bearer token to be used for the operation.

If set, underlying eACL rules will be used in access control.

Must be signed.

func (*PrmObjectSearch) WithXHeaders

func (x *PrmObjectSearch) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

func (*PrmObjectSearch) WithinSession

func (x *PrmObjectSearch) WithinSession(t session.Object)

WithinSession specifies session within which the search query must be executed.

Creator of the session acquires the authorship of the request. This may affect the execution of an operation (e.g. access control).

Must be signed.

type PrmSessionCreate

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

PrmSessionCreate groups parameters of SessionCreate operation.

func (*PrmSessionCreate) SetExp

func (x *PrmSessionCreate) SetExp(exp uint64)

SetExp sets number of the last NepFS epoch in the lifetime of the session after which it will be expired.

func (*PrmSessionCreate) UseKey

func (x *PrmSessionCreate) UseKey(key ecdsa.PrivateKey)

UseKey specifies private key to sign the requests and compute token owner. If key is not provided, then Client default key is used.

func (*PrmSessionCreate) WithXHeaders

func (x *PrmSessionCreate) WithXHeaders(hs ...string)

WithXHeaders specifies list of extended headers (string key-value pairs) to be attached to the request. Must have an even length.

Slice must not be mutated until the operation completes.

type ResAnnounceIntermediateTrust

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

ResAnnounceIntermediateTrust groups results of AnnounceIntermediateTrust operation.

func (ResAnnounceIntermediateTrust) Status

func (x ResAnnounceIntermediateTrust) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

type ResAnnounceLocalTrust

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

ResAnnounceLocalTrust groups results of AnnounceLocalTrust operation.

func (ResAnnounceLocalTrust) Status

func (x ResAnnounceLocalTrust) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

type ResAnnounceSpace

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

ResAnnounceSpace groups resulting values of ContainerAnnounceUsedSpace operation.

func (ResAnnounceSpace) Status

func (x ResAnnounceSpace) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

type ResBalanceGet

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

ResBalanceGet groups resulting values of BalanceGet operation.

func (ResBalanceGet) Amount

func (x ResBalanceGet) Amount() accounting.Decimal

Amount returns current amount of funds on the FrostFS account as decimal number.

func (ResBalanceGet) Status

func (x ResBalanceGet) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

type ResContainerDelete

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

ResContainerDelete groups resulting values of ContainerDelete operation.

func (ResContainerDelete) Status

func (x ResContainerDelete) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

type ResContainerEACL

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

ResContainerEACL groups resulting values of ContainerEACL operation.

func (ResContainerEACL) Status

func (x ResContainerEACL) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

func (ResContainerEACL) Table

func (x ResContainerEACL) Table() eacl.Table

Table returns eACL table of the requested container.

type ResContainerGet

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

ResContainerGet groups resulting values of ContainerGet operation.

func (ResContainerGet) Container

func (x ResContainerGet) Container() container.Container

Container returns structured information about the requested container.

Client doesn't retain value so modification is safe.

func (ResContainerGet) Status

func (x ResContainerGet) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

type ResContainerList

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

ResContainerList groups resulting values of ContainerList operation.

func (ResContainerList) Containers

func (x ResContainerList) Containers() []cid.ID

Containers returns list of identifiers of the account-owned containers.

Client doesn't retain value so modification is safe.

func (ResContainerList) Status

func (x ResContainerList) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

type ResContainerPut

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

ResContainerPut groups resulting values of ContainerPut operation.

func (ResContainerPut) ID

func (x ResContainerPut) ID() cid.ID

ID returns identifier of the container declared to be stored in the system. Used as a link to information about the container (in particular, you can asynchronously check if the save was successful).

func (ResContainerPut) Status

func (x ResContainerPut) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

type ResContainerSetEACL

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

ResContainerSetEACL groups resulting values of ContainerSetEACL operation.

func (ResContainerSetEACL) Status

func (x ResContainerSetEACL) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

type ResEndpointInfo

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

ResEndpointInfo group resulting values of EndpointInfo operation.

func (ResEndpointInfo) LatestVersion

func (x ResEndpointInfo) LatestVersion() version.Version

LatestVersion returns latest FrostFS API protocol's version in use.

func (ResEndpointInfo) NodeInfo

func (x ResEndpointInfo) NodeInfo() netmap.NodeInfo

NodeInfo returns information about the FrostFS node served on the remote endpoint.

func (ResEndpointInfo) Status

func (x ResEndpointInfo) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

type ResNetMapSnapshot

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

ResNetMapSnapshot groups resulting values of NetMapSnapshot operation.

func (ResNetMapSnapshot) NetMap

func (x ResNetMapSnapshot) NetMap() netmap.NetMap

NetMap returns current server's local network map.

func (ResNetMapSnapshot) Status

func (x ResNetMapSnapshot) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

type ResNetworkInfo

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

ResNetworkInfo groups resulting values of NetworkInfo operation.

func (ResNetworkInfo) Info

Info returns structured information about the FrostFS network.

func (ResNetworkInfo) Status

func (x ResNetworkInfo) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

type ResObjectDelete

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

ResObjectDelete groups resulting values of ObjectDelete operation.

func (ResObjectDelete) Status

func (x ResObjectDelete) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

func (ResObjectDelete) Tombstone

func (x ResObjectDelete) Tombstone() oid.ID

Tombstone returns identifier of the created tombstone object.

type ResObjectGet

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

ResObjectGet groups the final result values of ObjectGetInit operation.

func (ResObjectGet) Status

func (x ResObjectGet) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

type ResObjectHash

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

ResObjectHash groups resulting values of ObjectHash operation.

func (ResObjectHash) Checksums

func (x ResObjectHash) Checksums() [][]byte

Checksums returns a list of calculated checksums in range order.

func (ResObjectHash) Status

func (x ResObjectHash) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

type ResObjectHead

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

ResObjectHead groups resulting values of ObjectHead operation.

func (*ResObjectHead) ReadHeader

func (x *ResObjectHead) ReadHeader(dst *object.Object) bool

ReadHeader reads header of the requested object. Returns false if header is missing in the response (not read).

func (ResObjectHead) Status

func (x ResObjectHead) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

type ResObjectPut

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

ResObjectPut groups the final result values of ObjectPutInit operation.

func (ResObjectPut) Status

func (x ResObjectPut) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

func (ResObjectPut) StoredObjectID

func (x ResObjectPut) StoredObjectID() oid.ID

StoredObjectID returns identifier of the saved object.

type ResObjectRange

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

ResObjectRange groups the final result values of ObjectRange operation.

func (ResObjectRange) Status

func (x ResObjectRange) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

type ResObjectSearch

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

ResObjectSearch groups the final result values of ObjectSearch operation.

func (ResObjectSearch) Status

func (x ResObjectSearch) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

type ResSessionCreate

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

ResSessionCreate groups resulting values of SessionCreate operation.

func (ResSessionCreate) ID

func (x ResSessionCreate) ID() []byte

ID returns identifier of the opened session in a binary FrostFS API protocol format.

Client doesn't retain value so modification is safe.

func (ResSessionCreate) PublicKey

func (x ResSessionCreate) PublicKey() []byte

PublicKey returns public key of the opened session in a binary FrostFS API protocol format.

func (ResSessionCreate) Status

func (x ResSessionCreate) Status() apistatus.Status

Status returns server's status return.

Use apistatus package functionality to handle the status.

type ResponseMetaInfo

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

ResponseMetaInfo groups meta information about any FrostFS API response.

func (ResponseMetaInfo) Epoch

func (x ResponseMetaInfo) Epoch() uint64

Epoch returns local FrostFS epoch of the server.

func (ResponseMetaInfo) ResponderKey

func (x ResponseMetaInfo) ResponderKey() []byte

ResponderKey returns responder's public key in a binary format.

Result must not be mutated.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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