pool

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: 3

Documentation

Overview

Package pool provides a wrapper for several FrostFS API clients.

The main component is Pool type. It is a virtual connection to the network and provides methods for executing operations on the server. It also supports a weighted random selection of the underlying client to make requests.

Create pool instance with 3 nodes connection. This InitParameters will make pool use 192.168.130.71 node while it is healthy. Otherwise, it will make the pool use 192.168.130.72 for 90% of requests and 192.168.130.73 for remaining 10%. :

var prm pool.InitParameters
prm.SetKey(key)
prm.AddNode(NewNodeParam(1, "192.168.130.71", 1))
prm.AddNode(NewNodeParam(2, "192.168.130.72", 9))
prm.AddNode(NewNodeParam(2, "192.168.130.73", 1))
// ...

p, err := pool.NewPool(prm)
// ...

Connect to the FrostFS server:

err := p.Dial(ctx)
// ...

Execute FrostFS operation on the server:

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

res, err := p.PutContainer(context.Background(), prm)
// ...

Execute FrostFS operation on the server and check error:

var prm pool.PrmObjectHead
prm.SetAddress(addr)
// ...

res, err := p.HeadObject(context.Background(), prm)
if client.IsErrObjectNotFound(err) {
	// ...
}
// ...

Close the connection:

p.Close()

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownNode = errors.New("unknown node")

ErrUnknownNode indicate that node with current address is not found in list.

Functions

func SyncContainerWithNetwork

func SyncContainerWithNetwork(ctx context.Context, cnr *container.Container, p *Pool) error

SyncContainerWithNetwork applies network configuration received via the Pool to the container. Changes the container if it does not satisfy network configuration.

Pool and container MUST not be nil.

Returns any error that does not allow reading configuration from the network.

Types

type InitParameters

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

InitParameters contains values used to initialize connection Pool.

func (*InitParameters) AddNode

func (x *InitParameters) AddNode(nodeParam NodeParam)

AddNode append information about the node to which you want to connect.

func (*InitParameters) SetClientRebalanceInterval

func (x *InitParameters) SetClientRebalanceInterval(interval time.Duration)

SetClientRebalanceInterval specifies the interval for updating nodes health status.

See also Pool.Dial.

func (*InitParameters) SetErrorThreshold

func (x *InitParameters) SetErrorThreshold(threshold uint32)

SetErrorThreshold specifies the number of errors on connection after which node is considered as unhealthy.

func (*InitParameters) SetHealthcheckTimeout

func (x *InitParameters) SetHealthcheckTimeout(timeout time.Duration)

SetHealthcheckTimeout specifies the timeout for request to node to decide if it is alive.

See also Pool.Dial.

func (*InitParameters) SetKey

func (x *InitParameters) SetKey(key *ecdsa.PrivateKey)

SetKey specifies default key to be used for the protocol communication by default.

func (*InitParameters) SetLogger

func (x *InitParameters) SetLogger(logger *zap.Logger)

SetLogger specifies logger.

func (*InitParameters) SetNodeDialTimeout

func (x *InitParameters) SetNodeDialTimeout(timeout time.Duration)

SetNodeDialTimeout specifies the timeout for connection to be established.

func (*InitParameters) SetNodeStreamTimeout

func (x *InitParameters) SetNodeStreamTimeout(timeout time.Duration)

SetNodeStreamTimeout specifies the timeout for individual operations in streaming RPC.

func (*InitParameters) SetRequestCallback

func (x *InitParameters) SetRequestCallback(f func(RequestInfo))

SetRequestCallback makes the pool client to pass RequestInfo for each request to f. Nil (default) means ignore RequestInfo.

func (*InitParameters) SetSessionExpirationDuration

func (x *InitParameters) SetSessionExpirationDuration(expirationDuration uint64)

SetSessionExpirationDuration specifies the session token lifetime in epochs.

type MethodIndex

type MethodIndex int

MethodIndex index of method in list of statuses in clientStatusMonitor.

func (MethodIndex) String

func (m MethodIndex) String() string

String implements fmt.Stringer.

type NodeParam

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

NodeParam groups parameters of remote node.

func NewNodeParam

func NewNodeParam(priority int, address string, weight float64) (prm NodeParam)

NewNodeParam creates NodeParam using parameters.

func (*NodeParam) SetAddress

func (x *NodeParam) SetAddress(address string)

SetAddress specifies address of the node.

func (*NodeParam) SetPriority

func (x *NodeParam) SetPriority(priority int)

SetPriority specifies priority of the node. Negative value is allowed. In the result node groups with the same priority will be sorted by descent.

func (*NodeParam) SetWeight

func (x *NodeParam) SetWeight(weight float64)

SetWeight specifies weight of the node.

type NodeStatistic

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

NodeStatistic is metrics of certain connections.

func (NodeStatistic) Address

func (n NodeStatistic) Address() string

Address returns node endpoint address.

func (NodeStatistic) AverageCreateSession

func (n NodeStatistic) AverageCreateSession() time.Duration

AverageCreateSession returns average time to perform SessionCreate request.

func (NodeStatistic) AverageDeleteContainer

func (n NodeStatistic) AverageDeleteContainer() time.Duration

AverageDeleteContainer returns average time to perform ContainerDelete request.

func (NodeStatistic) AverageDeleteObject

func (n NodeStatistic) AverageDeleteObject() time.Duration

AverageDeleteObject returns average time to perform ObjectDelete request.

func (NodeStatistic) AverageEndpointInfo

func (n NodeStatistic) AverageEndpointInfo() time.Duration

AverageEndpointInfo returns average time to perform EndpointInfo request.

func (NodeStatistic) AverageGetBalance

func (n NodeStatistic) AverageGetBalance() time.Duration

AverageGetBalance returns average time to perform BalanceGet request.

func (NodeStatistic) AverageGetContainer

func (n NodeStatistic) AverageGetContainer() time.Duration

AverageGetContainer returns average time to perform ContainerGet request.

func (NodeStatistic) AverageGetContainerEACL

func (n NodeStatistic) AverageGetContainerEACL() time.Duration

AverageGetContainerEACL returns average time to perform ContainerEACL request.

func (NodeStatistic) AverageGetObject

func (n NodeStatistic) AverageGetObject() time.Duration

AverageGetObject returns average time to perform ObjectGet request.

func (NodeStatistic) AverageHeadObject

func (n NodeStatistic) AverageHeadObject() time.Duration

AverageHeadObject returns average time to perform ObjectHead request.

func (NodeStatistic) AverageListContainer

func (n NodeStatistic) AverageListContainer() time.Duration

AverageListContainer returns average time to perform ContainerList request.

func (NodeStatistic) AverageNetworkInfo

func (n NodeStatistic) AverageNetworkInfo() time.Duration

AverageNetworkInfo returns average time to perform NetworkInfo request.

func (NodeStatistic) AveragePutContainer

func (n NodeStatistic) AveragePutContainer() time.Duration

AveragePutContainer returns average time to perform ContainerPut request.

func (NodeStatistic) AveragePutObject

func (n NodeStatistic) AveragePutObject() time.Duration

AveragePutObject returns average time to perform ObjectPut request.

func (NodeStatistic) AverageRangeObject

func (n NodeStatistic) AverageRangeObject() time.Duration

AverageRangeObject returns average time to perform ObjectRange request.

func (NodeStatistic) AverageSetContainerEACL

func (n NodeStatistic) AverageSetContainerEACL() time.Duration

AverageSetContainerEACL returns average time to perform ContainerSetEACL request.

func (NodeStatistic) CurrentErrors

func (n NodeStatistic) CurrentErrors() uint32

CurrentErrors returns errors on current node. This value is always less than 'errorThreshold' from InitParameters.

func (NodeStatistic) OverallErrors

func (n NodeStatistic) OverallErrors() uint64

OverallErrors returns all errors on current node. This value never decreases.

func (NodeStatistic) Requests

func (n NodeStatistic) Requests() (requests uint64)

Requests returns number of requests.

type Pool

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

Pool represents virtual connection to the FrostFS network to communicate with multiple FrostFS servers without thinking about switching between servers due to load balancing proportions or their unavailability. It is designed to provide a convenient abstraction from the multiple sdkClient.client types.

Pool can be created and initialized using NewPool function. Before executing the FrostFS operations using the Pool, connection to the servers MUST BE correctly established (see Dial method). Using the Pool before connecting have been established can lead to a panic. After the work, the Pool SHOULD BE closed (see Close method): it frees internal and system resources which were allocated for the period of work of the Pool. Calling Dial/Close methods during the communication process step strongly discouraged as it leads to undefined behavior.

Each method which produces a FrostFS API call may return an error. Status of underlying server response is casted to built-in error instance. Certain statuses can be checked using `sdkClient` and standard `errors` packages. Note that package provides some helper functions to work with status returns (e.g. sdkClient.IsErrContainerNotFound, sdkClient.IsErrObjectNotFound).

See pool package overview to get some examples.

func NewPool

func NewPool(options InitParameters) (*Pool, error)

NewPool creates connection pool using parameters.

func (*Pool) Balance

func (p *Pool) Balance(ctx context.Context, prm PrmBalanceGet) (accounting.Decimal, error)

Balance requests current balance of the FrostFS account.

Main return value MUST NOT be processed on an erroneous return.

func (*Pool) Close

func (p *Pool) Close()

Close closes the Pool and releases all the associated resources.

func (*Pool) DeleteContainer

func (p *Pool) DeleteContainer(ctx context.Context, prm PrmContainerDelete) error

DeleteContainer sends request to remove the FrostFS container and waits for the operation to complete.

Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:

polling interval: 5s
waiting timeout: 120s

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

func (*Pool) DeleteObject

func (p *Pool) DeleteObject(ctx context.Context, prm PrmObjectDelete) error

DeleteObject 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.

func (*Pool) Dial

func (p *Pool) Dial(ctx context.Context) error

Dial establishes a connection to the servers from the FrostFS network. It also starts a routine that checks the health of the nodes and updates the weights of the nodes for balancing. Returns an error describing failure reason.

If failed, the Pool SHOULD NOT be used.

See also InitParameters.SetClientRebalanceInterval.

func (*Pool) FindSiblingByParentID

func (p *Pool) FindSiblingByParentID(ctx context.Context, cnrID cid.ID, objID oid.ID, tokens relations.Tokens) ([]oid.ID, error)

FindSiblingByParentID implements relations.Relations.

func (*Pool) FindSiblingBySplitID

func (p *Pool) FindSiblingBySplitID(ctx context.Context, cnrID cid.ID, splitID *object.SplitID, tokens relations.Tokens) ([]oid.ID, error)

FindSiblingBySplitID implements relations.Relations.

func (*Pool) GetContainer

func (p *Pool) GetContainer(ctx context.Context, prm PrmContainerGet) (container.Container, error)

GetContainer reads FrostFS container by ID.

Main return value MUST NOT be processed on an erroneous return.

func (*Pool) GetEACL

func (p *Pool) GetEACL(ctx context.Context, prm PrmContainerEACL) (eacl.Table, error)

GetEACL reads eACL table of the FrostFS container.

Main return value MUST NOT be processed on an erroneous return.

func (*Pool) GetLeftSibling

func (p *Pool) GetLeftSibling(ctx context.Context, cnrID cid.ID, objID oid.ID, tokens relations.Tokens) (oid.ID, error)

GetLeftSibling implements relations.Relations.

func (*Pool) GetObject

func (p *Pool) GetObject(ctx context.Context, prm PrmObjectGet) (ResGetObject, error)

GetObject reads object header and initiates reading an object payload through a remote server using FrostFS API protocol.

Main return value MUST NOT be processed on an erroneous return.

func (*Pool) GetSplitInfo

func (p *Pool) GetSplitInfo(ctx context.Context, cnrID cid.ID, objID oid.ID, tokens relations.Tokens) (*object.SplitInfo, error)

GetSplitInfo implements relations.Relations.

func (*Pool) HeadObject

func (p *Pool) HeadObject(ctx context.Context, prm PrmObjectHead) (object.Object, error)

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

Main return value MUST NOT be processed on an erroneous return.

func (*Pool) ListChildrenByLinker

func (p *Pool) ListChildrenByLinker(ctx context.Context, cnrID cid.ID, objID oid.ID, tokens relations.Tokens) ([]oid.ID, error)

ListChildrenByLinker implements relations.Relations.

func (*Pool) ListContainers

func (p *Pool) ListContainers(ctx context.Context, prm PrmContainerList) ([]cid.ID, error)

ListContainers requests identifiers of the account-owned containers.

func (*Pool) NetworkInfo

func (p *Pool) NetworkInfo(ctx context.Context) (netmap.NetworkInfo, error)

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

Main return value MUST NOT be processed on an erroneous return.

func (*Pool) ObjectRange

func (p *Pool) ObjectRange(ctx context.Context, prm PrmObjectRange) (ResObjectRange, error)

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

Main return value MUST NOT be processed on an erroneous return.

func (*Pool) PutContainer

func (p *Pool) PutContainer(ctx context.Context, prm PrmContainerPut) (cid.ID, error)

PutContainer sends request to save container in FrostFS and waits for the operation to complete.

Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:

polling interval: 5s
waiting timeout: 120s

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

Main return value MUST NOT be processed on an erroneous return.

func (*Pool) PutObject

func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (oid.ID, error)

PutObject writes an object through a remote server using FrostFS API protocol.

Main return value MUST NOT be processed on an erroneous return.

func (*Pool) SearchObjects

func (p *Pool) SearchObjects(ctx context.Context, prm PrmObjectSearch) (ResObjectSearch, error)

SearchObjects 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 ResObjectSearch. Resulting reader must be finally closed.

Main return value MUST NOT be processed on an erroneous return.

func (*Pool) SetEACL

func (p *Pool) SetEACL(ctx context.Context, prm PrmContainerSetEACL) error

SetEACL sends request to update eACL table of the FrostFS container and waits for the operation to complete.

Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:

polling interval: 5s
waiting timeout: 120s

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

func (Pool) Statistic

func (p Pool) Statistic() Statistic

Statistic returns connection statistics.

type PrmBalanceGet

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

PrmBalanceGet groups parameters of Balance operation.

func (*PrmBalanceGet) SetAccount

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

SetAccount specifies identifier of the FrostFS account for which the balance is requested.

type PrmContainerDelete

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

PrmContainerDelete groups parameters of DeleteContainer operation.

func (*PrmContainerDelete) SetContainerID

func (x *PrmContainerDelete) SetContainerID(cnrID cid.ID)

SetContainerID specifies identifier of the FrostFS container to be removed.

func (*PrmContainerDelete) SetSessionToken

func (x *PrmContainerDelete) SetSessionToken(token session.Container)

SetSessionToken specifies session within which operation should be performed.

func (*PrmContainerDelete) SetWaitParams

func (x *PrmContainerDelete) SetWaitParams(waitParams WaitParams)

SetWaitParams specifies timeout params to complete operation. If not provided the default one will be used. Panics if any of the wait params isn't positive.

type PrmContainerEACL

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

PrmContainerEACL groups parameters of GetEACL operation.

func (*PrmContainerEACL) SetContainerID

func (x *PrmContainerEACL) SetContainerID(cnrID cid.ID)

SetContainerID specifies identifier of the FrostFS container to read the eACL table.

type PrmContainerGet

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

PrmContainerGet groups parameters of GetContainer operation.

func (*PrmContainerGet) SetContainerID

func (x *PrmContainerGet) SetContainerID(cnrID cid.ID)

SetContainerID specifies identifier of the container to be read.

type PrmContainerList

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

PrmContainerList groups parameters of ListContainers operation.

func (*PrmContainerList) SetOwnerID

func (x *PrmContainerList) SetOwnerID(ownerID user.ID)

SetOwnerID specifies identifier of the FrostFS account to list the containers.

type PrmContainerPut

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

PrmContainerPut groups parameters of PutContainer operation.

func (*PrmContainerPut) SetContainer

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

SetContainer container structure to be used as a parameter of the base client's operation.

See github.com/TrueCloudLab/frostfs-sdk-go/client.PrmContainerPut.SetContainer.

func (*PrmContainerPut) SetWaitParams

func (x *PrmContainerPut) SetWaitParams(waitParams WaitParams)

SetWaitParams specifies timeout params to complete operation. If not provided the default one will be used. Panics if any of the wait params isn't positive.

func (*PrmContainerPut) WithinSession

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

WithinSession specifies session to be used as a parameter of the base client's operation.

See github.com/TrueCloudLab/frostfs-sdk-go/client.PrmContainerPut.WithinSession.

type PrmContainerSetEACL

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

PrmContainerSetEACL groups parameters of SetEACL operation.

func (*PrmContainerSetEACL) SetTable

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

SetTable sets structure of container's extended ACL to be used as a parameter of the base client's operation.

See github.com/TrueCloudLab/frostfs-sdk-go/client.PrmContainerSetEACL.SetTable.

func (*PrmContainerSetEACL) SetWaitParams

func (x *PrmContainerSetEACL) SetWaitParams(waitParams WaitParams)

SetWaitParams specifies timeout params to complete operation. If not provided the default one will be used. Panics if any of the wait params isn't positive.

func (*PrmContainerSetEACL) WithinSession

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

WithinSession specifies session to be used as a parameter of the base client's operation.

See github.com/TrueCloudLab/frostfs-sdk-go/client.PrmContainerSetEACL.WithinSession.

type PrmObjectDelete

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

PrmObjectDelete groups parameters of DeleteObject operation.

func (*PrmObjectDelete) SetAddress

func (x *PrmObjectDelete) SetAddress(addr oid.Address)

SetAddress specifies FrostFS address of the object.

func (*PrmObjectDelete) UseBearer

func (x *PrmObjectDelete) UseBearer(token bearer.Token)

UseBearer attaches bearer token to be used for the operation.

func (*PrmObjectDelete) UseKey

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

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

func (*PrmObjectDelete) UseSession

func (x *PrmObjectDelete) UseSession(token session.Object)

UseSession specifies session within which operation should be performed.

type PrmObjectGet

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

PrmObjectGet groups parameters of GetObject operation.

func (*PrmObjectGet) SetAddress

func (x *PrmObjectGet) SetAddress(addr oid.Address)

SetAddress specifies FrostFS address of the object.

func (*PrmObjectGet) UseBearer

func (x *PrmObjectGet) UseBearer(token bearer.Token)

UseBearer attaches bearer token to be used for the operation.

func (*PrmObjectGet) UseKey

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

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

func (*PrmObjectGet) UseSession

func (x *PrmObjectGet) UseSession(token session.Object)

UseSession specifies session within which operation should be performed.

type PrmObjectHead

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

PrmObjectHead groups parameters of HeadObject operation.

func (*PrmObjectHead) MarkRaw

func (x *PrmObjectHead) MarkRaw()

MarkRaw marks an intent to read physically stored object.

func (*PrmObjectHead) SetAddress

func (x *PrmObjectHead) SetAddress(addr oid.Address)

SetAddress specifies FrostFS address of the object.

func (*PrmObjectHead) UseBearer

func (x *PrmObjectHead) UseBearer(token bearer.Token)

UseBearer attaches bearer token to be used for the operation.

func (*PrmObjectHead) UseKey

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

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

func (*PrmObjectHead) UseSession

func (x *PrmObjectHead) UseSession(token session.Object)

UseSession specifies session within which operation should be performed.

type PrmObjectPut

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

PrmObjectPut groups parameters of PutObject operation.

func (*PrmObjectPut) SetCopiesNumber

func (x *PrmObjectPut) SetCopiesNumber(copiesNumber uint32)

SetCopiesNumber sets number of object copies that is enough to consider put successful. Zero means using default behavior.

func (*PrmObjectPut) SetHeader

func (x *PrmObjectPut) SetHeader(hdr object.Object)

SetHeader specifies header of the object.

func (*PrmObjectPut) SetPayload

func (x *PrmObjectPut) SetPayload(payload io.Reader)

SetPayload specifies payload of the object.

func (*PrmObjectPut) UseBearer

func (x *PrmObjectPut) UseBearer(token bearer.Token)

UseBearer attaches bearer token to be used for the operation.

func (*PrmObjectPut) UseKey

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

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

func (*PrmObjectPut) UseSession

func (x *PrmObjectPut) UseSession(token session.Object)

UseSession specifies session within which operation should be performed.

type PrmObjectRange

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

PrmObjectRange groups parameters of RangeObject operation.

func (*PrmObjectRange) SetAddress

func (x *PrmObjectRange) SetAddress(addr oid.Address)

SetAddress specifies FrostFS address of the object.

func (*PrmObjectRange) SetLength

func (x *PrmObjectRange) SetLength(length uint64)

SetLength sets length of the payload range to be read.

func (*PrmObjectRange) SetOffset

func (x *PrmObjectRange) SetOffset(offset uint64)

SetOffset sets offset of the payload range to be read.

func (*PrmObjectRange) UseBearer

func (x *PrmObjectRange) UseBearer(token bearer.Token)

UseBearer attaches bearer token to be used for the operation.

func (*PrmObjectRange) UseKey

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

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

func (*PrmObjectRange) UseSession

func (x *PrmObjectRange) UseSession(token session.Object)

UseSession specifies session within which operation should be performed.

type PrmObjectSearch

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

PrmObjectSearch groups parameters of SearchObjects operation.

func (*PrmObjectSearch) SetContainerID

func (x *PrmObjectSearch) SetContainerID(cnrID cid.ID)

SetContainerID specifies the container in which to look for objects.

func (*PrmObjectSearch) SetFilters

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

SetFilters specifies filters by which to select objects.

func (*PrmObjectSearch) UseBearer

func (x *PrmObjectSearch) UseBearer(token bearer.Token)

UseBearer attaches bearer token to be used for the operation.

func (*PrmObjectSearch) UseKey

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

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

func (*PrmObjectSearch) UseSession

func (x *PrmObjectSearch) UseSession(token session.Object)

UseSession specifies session within which operation should be performed.

type RequestInfo

type RequestInfo struct {
	Address string
	Method  MethodIndex
	Elapsed time.Duration
}

RequestInfo groups info about pool request.

type ResGetObject

type ResGetObject struct {
	Header object.Object

	Payload io.ReadCloser
}

ResGetObject is designed to provide object header nad read one object payload from FrostFS system.

type ResObjectRange

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

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

Must be initialized using Pool.ObjectRange, any other usage is unsafe.

func (*ResObjectRange) Close

func (x *ResObjectRange) Close() 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 ResObjectRange.

func (*ResObjectRange) Read

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

Read implements io.Reader of the object payload.

type ResObjectSearch

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

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

Must be initialized using Pool.SearchObjects, any other usage is unsafe.

func (*ResObjectSearch) Close

func (x *ResObjectSearch) Close()

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 ResObjectSearch.

func (*ResObjectSearch) Iterate

func (x *ResObjectSearch) 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 (*ResObjectSearch) Read

func (x *ResObjectSearch) Read(buf []oid.ID) (int, error)

Read reads another list of the object identifiers.

type Statistic

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

Statistic is metrics of the pool.

func (Statistic) Node

func (s Statistic) Node(address string) (*NodeStatistic, error)

Node returns NodeStatistic by node address. If such node doesn't exist ErrUnknownNode error is returned.

func (Statistic) Nodes

func (s Statistic) Nodes() []NodeStatistic

Nodes returns list of nodes statistic.

func (Statistic) OverallErrors

func (s Statistic) OverallErrors() uint64

OverallErrors returns sum of errors on all connections. It doesn't decrease.

type WaitParams

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

WaitParams contains parameters used in polling is a something applied on FrostFS network.

func (*WaitParams) SetPollInterval

func (x *WaitParams) SetPollInterval(tick time.Duration)

SetPollInterval specifies the interval, once it will check the completion of the operation.

func (*WaitParams) SetTimeout

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

SetTimeout specifies the time to wait for the operation to complete.

Jump to

Keyboard shortcuts

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