Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientCache ¶
type ClientCache struct {
// contains filtered or unexported fields
}
ClientCache is a structure around frostfs-sdk-go/client to reuse already created clients.
func NewSDKClientCache ¶
func NewSDKClientCache(opts ClientCacheOpts) *ClientCache
NewSDKClientCache creates instance of client cache. `opts` are used for new client creation.
func (*ClientCache) CloseAll ¶
func (c *ClientCache) CloseAll()
CloseAll closes underlying connections of all cached clients.
Ignores closing errors.
func (*ClientCache) Get ¶
func (c *ClientCache) Get(info clientcore.NodeInfo) (clientcore.MultiAddressClient, error)
Get function returns existing client or creates a new one.
func (*ClientCache) SetLogger ¶ added in v0.48.0
func (c *ClientCache) SetLogger(l *logger.Logger)
type ClientCacheOpts ¶
type ClientCacheOpts struct {
DialTimeout time.Duration
StreamTimeout time.Duration
ClientWaitTimeout time.Duration
HealthcheckInterval time.Duration
IdleTimeout time.Duration
ReconnectTimeout time.Duration
MaxStreamsPerConnection int64
MaxClientPerAddress int64
Key *ecdsa.PrivateKey
ResponseCallback func(client.ResponseMetaInfo) error
AllowExternal bool
DialerSource *net.DialerSource
RetryPolicy *RetryPolicy
RetryThrottling *RetryThrottling
Log *logger.Logger
Name string
Metrics Metrics
// HealthCheckServiceName is the service name used for gRPC health checks.
// If nil, the cache name is used instead.
HealthCheckServiceName *string
}
type GRPCClientCache ¶
type GRPCClientCache[T any] struct { // contains filtered or unexported fields }
GRPCClientCache is a caching storage of gRPC-based client instances, keyed by host ID. The type parameter T is the client type.
func New ¶
func New[T any](opts ClientCacheOpts, ctor func(*grpc.ClientConn, *ClientCacheOpts) T) *GRPCClientCache[T]
New creates a new GRPCClientCache with the given options and client constructor. The constructor is called for each new client connection.
func NewMultiAddress ¶
func NewMultiAddress(opts ClientCacheOpts) *GRPCClientCache[clientcore.MultiAddressClient]
NewMultiAddress creates a grpcstor-based ClientCacher for the SDK Client.
func (*GRPCClientCache[T]) CloseAll ¶
func (c *GRPCClientCache[T]) CloseAll()
CloseAll closes underlying connections of all cached clients.
Ignores closing errors.
func (*GRPCClientCache[T]) Get ¶
func (c *GRPCClientCache[T]) Get(info clientcore.NodeInfo) (T, error)
Get returns an existing client for the given NodeInfo, or creates a new one.
func (*GRPCClientCache[T]) SetLogger ¶
func (c *GRPCClientCache[T]) SetLogger(l *logger.Logger)
SetLogger sets the logger for this cache instance.
type Metrics ¶ added in v0.48.0
type Metrics interface {
IncFailedHealthcheckCounter(service, address string)
}
type MultiAddrClientCacher ¶
type MultiAddrClientCacher interface {
Get(clientcore.NodeInfo) (clientcore.MultiAddressClient, error)
}
MultiAddrClientCacher provides a MultiAddressClient for a given NodeInfo.