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 ¶
- Variables
- func SyncContainerWithNetwork(ctx context.Context, cnr *container.Container, p *Pool) error
- type InitParameters
- func (x *InitParameters) AddNode(nodeParam NodeParam)
- func (x *InitParameters) SetClientRebalanceInterval(interval time.Duration)
- func (x *InitParameters) SetErrorThreshold(threshold uint32)
- func (x *InitParameters) SetGRPCDialOptions(opts ...grpc.DialOption)
- func (x *InitParameters) SetGracefulCloseOnSwitchTimeout(timeout time.Duration)
- func (x *InitParameters) SetHealthcheckTimeout(timeout time.Duration)
- func (x *InitParameters) SetKey(key *ecdsa.PrivateKey)
- func (x *InitParameters) SetLogger(logger *zap.Logger)
- func (x *InitParameters) SetNodeDialTimeout(timeout time.Duration)
- func (x *InitParameters) SetNodeStreamTimeout(timeout time.Duration)
- func (x *InitParameters) SetRequestCallback(f func(RequestInfo))
- func (x *InitParameters) SetSessionExpirationDuration(expirationDuration uint64)
- type MethodIndex
- type MethodStatus
- type NodeParam
- type NodeStatistic
- func (n NodeStatistic) Address() string
- func (n NodeStatistic) AverageCreateSession() time.Duration
- func (n NodeStatistic) AverageDeleteContainer() time.Duration
- func (n NodeStatistic) AverageDeleteObject() time.Duration
- func (n NodeStatistic) AverageEndpointInfo() time.Duration
- func (n NodeStatistic) AverageGetBalance() time.Duration
- func (n NodeStatistic) AverageGetContainer() time.Duration
- func (n NodeStatistic) AverageGetObject() time.Duration
- func (n NodeStatistic) AverageHeadObject() time.Duration
- func (n NodeStatistic) AverageListContainer() time.Duration
- func (n NodeStatistic) AverageNetworkInfo() time.Duration
- func (n NodeStatistic) AveragePutContainer() time.Duration
- func (n NodeStatistic) AveragePutObject() time.Duration
- func (n NodeStatistic) AverageRangeObject() time.Duration
- func (n NodeStatistic) CurrentErrors() uint32
- func (n NodeStatistic) OverallErrors() uint64
- func (n NodeStatistic) Requests() (requests uint64)
- type Pool
- func (p *Pool) AddAPEChain(ctx context.Context, prm PrmAddAPEChain) error
- func (p *Pool) Balance(ctx context.Context, prm PrmBalanceGet) (accounting.Decimal, error)
- func (p *Pool) Close()
- func (p *Pool) DeleteContainer(ctx context.Context, prm PrmContainerDelete) error
- func (p *Pool) DeleteObject(ctx context.Context, prm PrmObjectDelete) error
- func (p *Pool) Dial(ctx context.Context) error
- func (p *Pool) FindSiblingByParentID(ctx context.Context, cnrID cid.ID, objID oid.ID, tokens relations.Tokens) ([]oid.ID, error)
- func (p *Pool) FindSiblingBySplitID(ctx context.Context, cnrID cid.ID, splitID *object.SplitID, ...) ([]oid.ID, error)
- func (p *Pool) GetContainer(ctx context.Context, prm PrmContainerGet) (container.Container, error)
- func (p *Pool) GetLeftSibling(ctx context.Context, cnrID cid.ID, objID oid.ID, tokens relations.Tokens) (oid.ID, error)
- func (p *Pool) GetObject(ctx context.Context, prm PrmObjectGet) (ResGetObject, error)
- func (p *Pool) GetSplitInfo(ctx context.Context, cnrID cid.ID, objID oid.ID, tokens relations.Tokens) (*object.SplitInfo, error)
- func (p *Pool) HeadObject(ctx context.Context, prm PrmObjectHead) (object.Object, error)
- func (p *Pool) ListAPEChains(ctx context.Context, prm PrmListAPEChains) ([]ape.Chain, error)
- func (p *Pool) ListChildrenByLinker(ctx context.Context, cnrID cid.ID, objID oid.ID, tokens relations.Tokens) ([]oid.ID, error)
- func (p *Pool) ListContainers(ctx context.Context, prm PrmContainerList) ([]cid.ID, error)
- func (p *Pool) NetMapSnapshot(ctx context.Context) (netmap.NetMap, error)
- func (p *Pool) NetworkInfo(ctx context.Context) (netmap.NetworkInfo, error)
- func (p *Pool) ObjectRange(ctx context.Context, prm PrmObjectRange) (ResObjectRange, error)
- func (p *Pool) PatchObject(ctx context.Context, prm PrmObjectPatch) (ResPatchObject, error)
- func (p *Pool) PutContainer(ctx context.Context, prm PrmContainerPut) (cid.ID, error)
- func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (ResPutObject, error)
- func (p *Pool) RemoveAPEChain(ctx context.Context, prm PrmRemoveAPEChain) error
- func (p *Pool) SearchObjects(ctx context.Context, prm PrmObjectSearch) (ResObjectSearch, error)
- func (p Pool) Statistic() Statistic
- type PrmAddAPEChain
- type PrmBalanceGet
- type PrmContainerDelete
- type PrmContainerGet
- type PrmContainerList
- type PrmContainerPut
- type PrmListAPEChains
- type PrmObjectDelete
- type PrmObjectGet
- type PrmObjectHead
- type PrmObjectPatch
- func (x *PrmObjectPatch) SetAddress(addr oid.Address)
- func (x *PrmObjectPatch) SetMaxPayloadPatchChunkSize(maxPayloadPatchChunkSize int)
- func (x *PrmObjectPatch) SetNewAttributes(newAttrs []object.Attribute)
- func (x *PrmObjectPatch) SetPayloadReader(payload io.Reader)
- func (x *PrmObjectPatch) SetRange(rng *object.Range)
- func (x *PrmObjectPatch) SetReplaceAttributes(replaceAttrs bool)
- func (x *PrmObjectPatch) UseBearer(token bearer.Token)
- func (x *PrmObjectPatch) UseKey(key *ecdsa.PrivateKey)
- func (x *PrmObjectPatch) UseSession(token session.Object)
- type PrmObjectPut
- func (x *PrmObjectPut) SetBufferMaxSize(size uint64)
- func (x *PrmObjectPut) SetClientCut(clientCut bool)
- func (x *PrmObjectPut) SetCopiesNumber(copiesNumber uint32)
- func (x *PrmObjectPut) SetCopiesNumberVector(copiesNumber []uint32)
- func (x *PrmObjectPut) SetHeader(hdr object.Object)
- func (x *PrmObjectPut) SetPayload(payload io.Reader)
- func (x *PrmObjectPut) UseBearer(token bearer.Token)
- func (x *PrmObjectPut) UseKey(key *ecdsa.PrivateKey)
- func (x *PrmObjectPut) UseSession(token session.Object)
- func (x *PrmObjectPut) WithoutHomomorphicHash(v bool)
- type PrmObjectPutClientCutInit
- type PrmObjectRange
- func (x *PrmObjectRange) SetAddress(addr oid.Address)
- func (x *PrmObjectRange) SetLength(length uint64)
- func (x *PrmObjectRange) SetOffset(offset uint64)
- func (x *PrmObjectRange) UseBearer(token bearer.Token)
- func (x *PrmObjectRange) UseKey(key *ecdsa.PrivateKey)
- func (x *PrmObjectRange) UseSession(token session.Object)
- type PrmObjectSearch
- type PrmRemoveAPEChain
- type RequestInfo
- type ResGetObject
- type ResObjectPut
- type ResObjectRange
- type ResObjectSearch
- type ResPatchObject
- type ResPutObject
- type Statistic
- type StatusSnapshot
- type WaitParams
Constants ¶
This section is empty.
Variables ¶
var ErrUnknownNode = errors.New("unknown node")
ErrUnknownNode indicate that node with current address is not found in list.
Functions ¶
func SyncContainerWithNetwork ¶
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) SetGRPCDialOptions ¶
func (x *InitParameters) SetGRPCDialOptions(opts ...grpc.DialOption)
SetGRPCDialOptions sets the gRPC dial options for new gRPC client connection.
func (*InitParameters) SetGracefulCloseOnSwitchTimeout ¶
func (x *InitParameters) SetGracefulCloseOnSwitchTimeout(timeout time.Duration)
SetGracefulCloseOnSwitchTimeout specifies the timeout after which unhealthy client be closed during rebalancing if it will become healthy back. Generally this param should be less than client rebalance interval (see SetClientRebalanceInterval).
See also SetErrorThreshold.
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.
type MethodStatus ¶
type MethodStatus struct {
// contains filtered or unexported fields
}
MethodStatus provide statistic for specific method.
func NewMethodStatus ¶
func NewMethodStatus(name string) *MethodStatus
func (*MethodStatus) IncRequests ¶
func (m *MethodStatus) IncRequests(elapsed time.Duration)
func (*MethodStatus) Reset ¶
func (m *MethodStatus) Reset()
func (*MethodStatus) Snapshot ¶
func (m *MethodStatus) Snapshot() StatusSnapshot
type NodeParam ¶
type NodeParam struct {
// contains filtered or unexported fields
}
NodeParam groups parameters of remote node.
func NewNodeParam ¶
NewNodeParam creates NodeParam using parameters.
func (*NodeParam) Priority ¶
Priority returns priority of the node. Requests will be served by nodes subset with the highest priority (the smaller value - the higher priority). If there are no healthy nodes in subsets with current or higher priority, requests will be served by nodes subset with lower priority.
func (*NodeParam) SetAddress ¶
SetAddress specifies address of the node.
func (*NodeParam) SetPriority ¶
SetPriority specifies priority of the node. Negative value is allowed. In the result node groups with the same priority will be sorted by descent.
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) 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) 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) AddAPEChain ¶
func (p *Pool) AddAPEChain(ctx context.Context, prm PrmAddAPEChain) error
AddAPEChain sends a request to set APE chain rules for a target (basically, for a container).
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 ¶
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 ¶
GetContainer reads FrostFS container by ID.
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 ¶
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) ListAPEChains ¶
ListAPEChains sends a request to list APE chains rules for a target.
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 ¶
ListContainers requests identifiers of the account-owned containers.
func (*Pool) NetMapSnapshot ¶
NetMapSnapshot requests information about the FrostFS network map.
Main return value MUST NOT be processed on an erroneous return.
func (*Pool) NetworkInfo ¶
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) PatchObject ¶
func (p *Pool) PatchObject(ctx context.Context, prm PrmObjectPatch) (ResPatchObject, error)
PatchObject patches an object through a remote server using FrostFS API protocol.
Main return value MUST NOT be processed on an erroneous return.
func (*Pool) PutContainer ¶
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) (ResPutObject, 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) RemoveAPEChain ¶
func (p *Pool) RemoveAPEChain(ctx context.Context, prm PrmRemoveAPEChain) error
RemoveAPEChain sends a request to remove APE chain rules for a target.
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.
type PrmAddAPEChain ¶
type PrmAddAPEChain struct { Target ape.ChainTarget Chain ape.Chain }
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 { ContainerID cid.ID Session *session.Container WaitParams *WaitParams }
PrmContainerDelete groups parameters of DeleteContainer operation.
func (*PrmContainerDelete) SetContainerID
deprecated
func (x *PrmContainerDelete) SetContainerID(cnrID cid.ID)
SetContainerID specifies identifier of the FrostFS container to be removed.
Deprecated: Use PrmContainerDelete.ContainerID instead.
func (*PrmContainerDelete) SetSessionToken
deprecated
func (x *PrmContainerDelete) SetSessionToken(token session.Container)
SetSessionToken specifies session within which operation should be performed.
Deprecated: Use PrmContainerDelete.Session instead.
func (*PrmContainerDelete) SetWaitParams
deprecated
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.
Deprecated: Use PrmContainerDelete.WaitParams instead.
type PrmContainerGet ¶
PrmContainerGet groups parameters of GetContainer operation.
func (*PrmContainerGet) SetContainerID
deprecated
func (prm *PrmContainerGet) SetContainerID(cnrID cid.ID)
SetContainerID specifies identifier of the container to be read.
Deprecated: Use PrmContainerGet.ContainerID instead.
type PrmContainerList ¶
PrmContainerList groups parameters of ListContainers operation.
func (*PrmContainerList) SetOwnerID
deprecated
func (x *PrmContainerList) SetOwnerID(ownerID user.ID)
SetOwnerID specifies identifier of the FrostFS account to list the containers.
Deprecated: Use PrmContainerList.OwnerID instead.
type PrmContainerPut ¶
type PrmContainerPut struct { ClientParams sdkClient.PrmContainerPut WaitParams *WaitParams }
PrmContainerPut groups parameters of PutContainer operation.
func (*PrmContainerPut) SetContainer
deprecated
func (x *PrmContainerPut) SetContainer(cnr container.Container)
SetContainer container structure to be used as a parameter of the base client's operation.
See git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client.PrmContainerPut.SetContainer.
Deprecated: Use PrmContainerPut.ClientParams.Container instead.
func (*PrmContainerPut) SetWaitParams
deprecated
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.
Deprecated: Use PrmContainerPut.ClientParams.WaitParams instead.
func (*PrmContainerPut) WithinSession
deprecated
func (x *PrmContainerPut) WithinSession(s session.Container)
WithinSession specifies session to be used as a parameter of the base client's operation.
See git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client.PrmContainerPut.WithinSession.
Deprecated: Use PrmContainerPut.ClientParams.Session instead.
type PrmListAPEChains ¶
type PrmListAPEChains struct {
Target ape.ChainTarget
}
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) 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 ¶
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) 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 ¶
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) 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 ¶
UseSession specifies session within which operation should be performed.
type PrmObjectPatch ¶
type PrmObjectPatch struct {
// contains filtered or unexported fields
}
PrmObjectPatch groups parameters of PatchObject operation.
func (*PrmObjectPatch) SetAddress ¶
func (x *PrmObjectPatch) SetAddress(addr oid.Address)
SetAddress sets the address of the object that is patched.
func (*PrmObjectPatch) SetMaxPayloadPatchChunkSize ¶
func (x *PrmObjectPatch) SetMaxPayloadPatchChunkSize(maxPayloadPatchChunkSize int)
SetMaxPayloadPatchChunkSize sets a max buf size to read the patch's payload.
func (*PrmObjectPatch) SetNewAttributes ¶
func (x *PrmObjectPatch) SetNewAttributes(newAttrs []object.Attribute)
SetRange sets the new attributes to the patch.
func (*PrmObjectPatch) SetPayloadReader ¶
func (x *PrmObjectPatch) SetPayloadReader(payload io.Reader)
SetPayloadReader sets a payload reader.
func (*PrmObjectPatch) SetRange ¶
func (x *PrmObjectPatch) SetRange(rng *object.Range)
SetRange sets the patch's range.
func (*PrmObjectPatch) SetReplaceAttributes ¶
func (x *PrmObjectPatch) SetReplaceAttributes(replaceAttrs bool)
SetRange sets the replace attributes flag to the patch.
func (*PrmObjectPatch) UseKey ¶
func (x *PrmObjectPatch) UseKey(key *ecdsa.PrivateKey)
UseKey specifies private key to sign the requests. If key is not provided, then Pool default key is used.
func (*PrmObjectPatch) UseSession ¶
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) SetBufferMaxSize ¶
func (x *PrmObjectPut) SetBufferMaxSize(size uint64)
SetBufferMaxSize sets max buffer size to read payload. This value isn't used if object size is set explicitly and less than this value. Default value 3MB.
func (*PrmObjectPut) SetClientCut ¶
func (x *PrmObjectPut) SetClientCut(clientCut bool)
SetClientCut enables client cut for objects. It means that full object is prepared on client side and retrying is possible. But this leads to additional memory using for buffering object parts. Buffer size for every put is MaxObjectSize value from FrostFS network. There is limit for total memory allocation for in-flight request and can be set by InitParameters.SetMaxClientCutMemory (default value is 1gb). Put requests will fail if this limit be reached.
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) SetCopiesNumberVector ¶
func (x *PrmObjectPut) SetCopiesNumberVector(copiesNumber []uint32)
SetCopiesNumberVector sets number of object copies that is enough to consider put successful, provided as array. Nil/empty vector 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) 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 ¶
UseSession specifies session within which operation should be performed.
func (*PrmObjectPut) WithoutHomomorphicHash ¶
func (x *PrmObjectPut) WithoutHomomorphicHash(v bool)
WithoutHomomorphicHash if set to true do not use Tillich-Zémor hash for payload.
type PrmObjectPutClientCutInit ¶
type PrmObjectPutClientCutInit struct {
PrmObjectPut
}
func (*PrmObjectPutClientCutInit) UseBearer ¶
UseBearer attaches bearer token to be used for the operation.
func (*PrmObjectPutClientCutInit) UseKey ¶
func (x *PrmObjectPutClientCutInit) UseKey(key *ecdsa.PrivateKey)
UseKey specifies private key to sign the requests. If key is not provided, then Pool default key is used.
func (*PrmObjectPutClientCutInit) UseSession ¶
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) 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 ¶
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) 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 ¶
UseSession specifies session within which operation should be performed.
type PrmRemoveAPEChain ¶
type PrmRemoveAPEChain struct { Target ape.ChainTarget ChainID ape.ChainID }
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 ResObjectPut ¶
ResObjectPut groups the final result values of ObjectPutInit operation.
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.
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.
type ResPatchObject ¶
ResPatchObject is designed to provide identifier for the saved patched object.
type ResPutObject ¶
ResPutObject is designed to provide identifier and creation epoch of the saved object.
type Statistic ¶
type Statistic struct {
// contains filtered or unexported fields
}
Statistic is metrics of the pool.
func (Statistic) CurrentNodes ¶
CurrentNodes returns list of nodes of inner pool that has at least one healthy node. These nodes have the same and the highest priority among the other healthy nodes.
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 ¶
OverallErrors returns sum of errors on all connections. It doesn't decrease.
type StatusSnapshot ¶
type StatusSnapshot struct {
// contains filtered or unexported fields
}
StatusSnapshot is statistic for specific method.
func (StatusSnapshot) AllRequests ¶
func (s StatusSnapshot) AllRequests() uint64
func (StatusSnapshot) AllTime ¶
func (s StatusSnapshot) AllTime() uint64
type WaitParams ¶
WaitParams contains parameters used in polling is a something applied on FrostFS network.
func (*WaitParams) CheckValidity ¶
func (x *WaitParams) CheckValidity() error
CheckValidity checks if all wait params are non-negative.
func (*WaitParams) SetPollInterval
deprecated
func (x *WaitParams) SetPollInterval(tick time.Duration)
SetPollInterval specifies the interval, once it will check the completion of the operation.
Deprecated: Use WaitParams.PollInterval instead.
func (*WaitParams) SetTimeout
deprecated
func (x *WaitParams) SetTimeout(timeout time.Duration)
SetTimeout specifies the time to wait for the operation to complete.
Deprecated: Use WaitParams.Timeout instead.