Documentation
¶
Index ¶
- func NewEphemeralKey() (*ecdsa.PrivateKey, error)
- type Accounting
- type Builder
- type BuilderOptions
- type CallOption
- type Client
- type Container
- type ContainerPollingParams
- type NodeParam
- type NodesParam
- type Object
- type Pool
- type ResGetObject
- type ResObjectRange
- type ResObjectSearch
- type Sampler
- type SessionCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEphemeralKey ¶
func NewEphemeralKey() (*ecdsa.PrivateKey, error)
NewEphemeralKey creates new private key used for NeoFS session. It'll be removed after refactoring to use neo-go crypto library.
Types ¶
type Accounting ¶
type Accounting interface {
Balance(ctx context.Context, owner *owner.ID, opts ...CallOption) (*accounting.Decimal, error)
}
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is an interim structure used to collect node addresses/weights and build connection pool subsequently.
type BuilderOptions ¶
type BuilderOptions struct {
Key *ecdsa.PrivateKey
Logger *zap.Logger
NodeConnectionTimeout time.Duration
NodeRequestTimeout time.Duration
ClientRebalanceInterval time.Duration
SessionTokenThreshold time.Duration
SessionExpirationDuration uint64
// contains filtered or unexported fields
}
BuilderOptions contains options used to build connection pool.
type CallOption ¶
type CallOption func(config *callConfig)
func WithBearer ¶
func WithBearer(token *token.BearerToken) CallOption
func WithKey ¶
func WithKey(key *ecdsa.PrivateKey) CallOption
func WithSession ¶
func WithSession(token *session.Token) CallOption
type Client ¶
type Client interface {
BalanceGet(context.Context, client.PrmBalanceGet) (*client.ResBalanceGet, error)
ContainerPut(context.Context, client.PrmContainerPut) (*client.ResContainerPut, error)
ContainerGet(context.Context, client.PrmContainerGet) (*client.ResContainerGet, error)
ContainerList(context.Context, client.PrmContainerList) (*client.ResContainerList, error)
ContainerDelete(context.Context, client.PrmContainerDelete) (*client.ResContainerDelete, error)
ContainerEACL(context.Context, client.PrmContainerEACL) (*client.ResContainerEACL, error)
ContainerSetEACL(context.Context, client.PrmContainerSetEACL) (*client.ResContainerSetEACL, error)
EndpointInfo(context.Context, client.PrmEndpointInfo) (*client.ResEndpointInfo, error)
NetworkInfo(context.Context, client.PrmNetworkInfo) (*client.ResNetworkInfo, error)
ObjectPutInit(context.Context, client.PrmObjectPutInit) (*client.ObjectWriter, error)
ObjectDelete(context.Context, client.PrmObjectDelete) (*client.ResObjectDelete, error)
ObjectGetInit(context.Context, client.PrmObjectGet) (*client.ObjectReader, error)
ObjectHead(context.Context, client.PrmObjectHead) (*client.ResObjectHead, error)
ObjectRangeInit(context.Context, client.PrmObjectRange) (*client.ObjectRangeReader, error)
ObjectSearchInit(context.Context, client.PrmObjectSearch) (*client.ObjectListReader, error)
SessionCreate(context.Context, client.PrmSessionCreate) (*client.ResSessionCreate, error)
}
Client is a wrapper for client.Client to generate mock.
type Container ¶
type Container interface {
PutContainer(ctx context.Context, cnr *container.Container, opts ...CallOption) (*cid.ID, error)
GetContainer(ctx context.Context, cid *cid.ID, opts ...CallOption) (*container.Container, error)
ListContainers(ctx context.Context, ownerID *owner.ID, opts ...CallOption) ([]*cid.ID, error)
DeleteContainer(ctx context.Context, cid *cid.ID, opts ...CallOption) error
GetEACL(ctx context.Context, cid *cid.ID, opts ...CallOption) (*eacl.Table, error)
SetEACL(ctx context.Context, table *eacl.Table, opts ...CallOption) error
}
type ContainerPollingParams ¶
ContainerPollingParams contains parameters used in polling is a container created or not.
func DefaultPollingParams ¶
func DefaultPollingParams() *ContainerPollingParams
DefaultPollingParams creates ContainerPollingParams with default values.
type NodesParam ¶
type NodesParam struct {
// contains filtered or unexported fields
}
type Object ¶
type Object interface {
PutObject(ctx context.Context, hdr object.Object, payload io.Reader, opts ...CallOption) (*oid.ID, error)
DeleteObject(ctx context.Context, addr address.Address, opts ...CallOption) error
GetObject(context.Context, address.Address, ...CallOption) (*ResGetObject, error)
HeadObject(context.Context, address.Address, ...CallOption) (*object.Object, error)
ObjectRange(ctx context.Context, addr address.Address, off, ln uint64, opts ...CallOption) (*ResObjectRange, error)
SearchObjects(context.Context, cid.ID, object.SearchFilters, ...CallOption) (*ResObjectSearch, error)
}
type Pool ¶
type Pool interface {
Object
Container
Accounting
Connection() (Client, *session.Token, error)
OwnerID() *owner.ID
WaitForContainerPresence(context.Context, *cid.ID, *ContainerPollingParams) error
Close()
}
Pool is an interface providing connection artifacts on request.
type ResGetObject ¶
type ResGetObject struct {
Header object.Object
Payload io.ReadCloser
}
type ResObjectRange ¶
type ResObjectRange struct {
// contains filtered or unexported fields
}
func (*ResObjectRange) Close ¶
func (x *ResObjectRange) Close() error
type ResObjectSearch ¶
type ResObjectSearch struct {
// contains filtered or unexported fields
}
func (*ResObjectSearch) Close ¶
func (x *ResObjectSearch) Close()
type Sampler ¶
type Sampler struct {
// contains filtered or unexported fields
}
Sampler implements weighted random number generation using Vose's Alias Method (https://www.keithschwarz.com/darts-dice-coins/).
func NewSampler ¶
NewSampler creates new Sampler with a given set of probabilities using given source of randomness. Created Sampler will produce numbers from 0 to len(probabilities).
type SessionCache ¶
type SessionCache struct {
// contains filtered or unexported fields
}
func NewCache ¶
func NewCache() (*SessionCache, error)
func (*SessionCache) DeleteByPrefix ¶
func (c *SessionCache) DeleteByPrefix(prefix string)
func (*SessionCache) GetAccessTime ¶
func (c *SessionCache) GetAccessTime(key string) (time.Time, bool)