Documentation ¶
Index ¶
- Variables
- func GetRequestID(ctx context.Context) string
- func SetRequestID(ctx context.Context, reqID string) context.Context
- type AddNodeByPathParams
- type AddNodeParams
- type GetNodesParams
- type GetSubTreeParams
- type InitParameters
- func (x *InitParameters) AddNode(nodeParam pool.NodeParam)
- func (x *InitParameters) SetClientRebalanceInterval(interval time.Duration)
- func (x *InitParameters) SetGRPCDialOptions(opts ...grpc.DialOption)
- func (x *InitParameters) SetHealthcheckTimeout(timeout time.Duration)
- func (x *InitParameters) SetKey(key *keys.PrivateKey)
- func (x *InitParameters) SetLogger(logger *zap.Logger)
- func (x *InitParameters) SetMaxRequestAttempts(maxAttempts int)
- func (x *InitParameters) SetNodeDialTimeout(timeout time.Duration)
- func (x *InitParameters) SetNodeStreamTimeout(timeout time.Duration)
- type MethodIndex
- type MoveNodeParams
- type Pool
- func (p *Pool) AddNode(ctx context.Context, prm AddNodeParams) (uint64, error)
- func (p *Pool) AddNodeByPath(ctx context.Context, prm AddNodeByPathParams) (uint64, error)
- func (p *Pool) Close() error
- func (p *Pool) Dial(ctx context.Context) error
- func (p *Pool) GetNodes(ctx context.Context, prm GetNodesParams) ([]*tree.GetNodeByPathResponseInfo, error)
- func (p *Pool) GetSubTree(ctx context.Context, prm GetSubTreeParams) (*SubTreeReader, error)
- func (p *Pool) MoveNode(ctx context.Context, prm MoveNodeParams) error
- func (p *Pool) RemoveNode(ctx context.Context, prm RemoveNodeParams) error
- func (p *Pool) Statistic() Statistic
- type RemoveNodeParams
- type Statistic
- func (s *Statistic) AverageAddNode() time.Duration
- func (s *Statistic) AverageAddNodeByPath() time.Duration
- func (s *Statistic) AverageGetNodes() time.Duration
- func (s *Statistic) AverageGetSubTree() time.Duration
- func (s *Statistic) AverageMoveNode() time.Duration
- func (s *Statistic) AverageRemoveNode() time.Duration
- func (s *Statistic) Requests() (requests uint64)
- type SubTreeReader
- type SubTreeSort
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNodeNotFound is returned from Tree service in case of not found error. ErrNodeNotFound = errors.New("not found") // ErrNodeAccessDenied is returned from Tree service in case of access denied error. ErrNodeAccessDenied = errors.New("access denied") )
var ErrUnhealthyEndpoint = errors.New("unhealthy endpoint")
ErrUnhealthyEndpoint is returned when client in the pool considered unavailable.
Functions ¶
func GetRequestID ¶
GetRequestID fetch tree pool request identifier from context.
Types ¶
type AddNodeByPathParams ¶
type AddNodeByPathParams struct { CID cid.ID TreeID string Path []string Meta map[string]string PathAttribute string BearerToken []byte }
AddNodeByPathParams groups parameters of Pool.AddNodeByPath operation.
type AddNodeParams ¶
type AddNodeParams struct { CID cid.ID TreeID string Parent uint64 Meta map[string]string BearerToken []byte }
AddNodeParams groups parameters of Pool.AddNode operation.
type GetNodesParams ¶
type GetNodesParams struct { CID cid.ID TreeID string Path []string Meta []string PathAttribute string LatestOnly bool AllAttrs bool BearerToken []byte }
GetNodesParams groups parameters of Pool.GetNodes operation.
type GetSubTreeParams ¶
type GetSubTreeParams struct { CID cid.ID TreeID string RootID []uint64 Depth uint32 BearerToken []byte Order SubTreeSort }
GetSubTreeParams groups parameters of Pool.GetSubTree operation.
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 pool.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) SetGRPCDialOptions ¶
func (x *InitParameters) SetGRPCDialOptions(opts ...grpc.DialOption)
SetGRPCDialOptions sets the gRPC dial options for new gRPC tree client connection.
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 *keys.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) SetMaxRequestAttempts ¶
func (x *InitParameters) SetMaxRequestAttempts(maxAttempts int)
SetMaxRequestAttempts sets the max attempt to make successful request. Default value is 0 that means the number of attempts equals to number of nodes in pool.
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.
type MoveNodeParams ¶
type MoveNodeParams struct { CID cid.ID TreeID string NodeID uint64 ParentID uint64 Meta map[string]string BearerToken []byte }
MoveNodeParams groups parameters of Pool.MoveNode operation.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool represents virtual connection to the FrostFS tree services network to communicate with multiple FrostFS tree services without thinking about switching between servers due to their unavailability.
Pool can be created and initialized using NewPool function. Before executing the FrostFS tree operations using the Pool, connection to the servers MUST BE correctly established (see Dial method).
func NewPool ¶
func NewPool(options InitParameters) (*Pool, error)
NewPool creates connection pool using parameters.
func (*Pool) AddNode ¶
AddNode invokes eponymous method from TreeServiceClient.
Can return predefined errors: * ErrNodeNotFound * ErrNodeAccessDenied.
func (*Pool) AddNodeByPath ¶
AddNodeByPath invokes eponymous method from TreeServiceClient.
Can return predefined errors: * ErrNodeNotFound * ErrNodeAccessDenied.
func (*Pool) Dial ¶
Dial establishes a connection to the tree 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) GetNodes ¶
func (p *Pool) GetNodes(ctx context.Context, prm GetNodesParams) ([]*tree.GetNodeByPathResponseInfo, error)
GetNodes invokes eponymous method from TreeServiceClient.
Can return predefined errors: * ErrNodeNotFound * ErrNodeAccessDenied.
func (*Pool) GetSubTree ¶
func (p *Pool) GetSubTree(ctx context.Context, prm GetSubTreeParams) (*SubTreeReader, error)
GetSubTree invokes eponymous method from TreeServiceClient.
Can return predefined errors: * ErrNodeNotFound * ErrNodeAccessDenied.
func (*Pool) MoveNode ¶
func (p *Pool) MoveNode(ctx context.Context, prm MoveNodeParams) error
MoveNode invokes eponymous method from TreeServiceClient.
Can return predefined errors: * ErrNodeNotFound * ErrNodeAccessDenied.
func (*Pool) RemoveNode ¶
func (p *Pool) RemoveNode(ctx context.Context, prm RemoveNodeParams) error
RemoveNode invokes eponymous method from TreeServiceClient.
Can return predefined errors: * ErrNodeNotFound * ErrNodeAccessDenied.
type RemoveNodeParams ¶
RemoveNodeParams groups parameters of Pool.RemoveNode operation.
type Statistic ¶
type Statistic struct {
// contains filtered or unexported fields
}
Statistic is metrics of the tree pool.
func (*Statistic) AverageAddNode ¶
func (*Statistic) AverageAddNodeByPath ¶
func (*Statistic) AverageGetNodes ¶
func (*Statistic) AverageGetSubTree ¶
func (*Statistic) AverageMoveNode ¶
func (*Statistic) AverageRemoveNode ¶
type SubTreeReader ¶
type SubTreeReader struct {
// contains filtered or unexported fields
}
SubTreeReader is designed to read list of subtree nodes FrostFS tree service.
Must be initialized using Pool.GetSubTree, any other usage is unsafe.
func (*SubTreeReader) Next ¶
func (x *SubTreeReader) Next() (*tree.GetSubTreeResponseBody, error)
Next gets the next node from subtree.
func (*SubTreeReader) Read ¶
func (x *SubTreeReader) Read(buf []*tree.GetSubTreeResponseBody) (int, error)
Read reads another list of the subtree nodes.
func (*SubTreeReader) ReadAll ¶
func (x *SubTreeReader) ReadAll() ([]*tree.GetSubTreeResponseBody, error)
ReadAll reads all nodes subtree nodes.
type SubTreeSort ¶
type SubTreeSort int32
SubTreeSort defines an order of nodes returned from GetSubTree RPC.
const ( // NoneOrder does not specify order of nodes returned in GetSubTree RPC. NoneOrder SubTreeSort = iota // AscendingOrder specifies ascending alphabetical order of nodes based on FilePath attribute. AscendingOrder )