Documentation ¶
Index ¶
- Constants
- type Config
- func (c Config) CreateSessionTimeout() time.Duration
- func (c Config) DeleteTimeout() time.Duration
- func (c Config) IdleKeepAliveThreshold() int
- func (c Config) IdleThreshold() time.Duration
- func (c Config) KeepAliveMinSize() int
- func (c Config) KeepAliveTimeout() time.Duration
- func (c Config) SizeLimit() int
- func (c Config) Trace() trace.Table
- type Option
- func With(config config.Common) Option
- func WithCreateSessionTimeout(createSessionTimeout time.Duration) Option
- func WithDeleteTimeout(deleteTimeout time.Duration) Option
- func WithIdleKeepAliveThreshold(idleKeepAliveThreshold int) Option
- func WithIdleThreshold(idleThreshold time.Duration) Option
- func WithKeepAliveMinSize(keepAliveMinSize int) Option
- func WithKeepAliveTimeout(keepAliveTimeout time.Duration) Option
- func WithSizeLimit(sizeLimit int) Option
- func WithTrace(trace trace.Table, opts ...trace.TableComposeOption) Option
Constants ¶
const ( DefaultSessionPoolKeepAliveTimeout = 500 * time.Millisecond DefaultSessionPoolDeleteTimeout = 500 * time.Millisecond DefaultSessionPoolCreateSessionTimeout = 5 * time.Second DefaultSessionPoolIdleThreshold = 5 * time.Minute DefaultSessionPoolSizeLimit = 50 DefaultKeepAliveMinSize = 10 DefaultIdleKeepAliveThreshold = 2 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config is a configuration of table client
func (Config) CreateSessionTimeout ¶
CreateSessionTimeout limits maximum time spent on Create session request If CreateSessionTimeout is less than or equal to zero then the DefaultSessionPoolCreateSessionTimeout is used.
func (Config) DeleteTimeout ¶
DeleteTimeout limits maximum time spent on Delete request If DeleteTimeout is less than or equal to zero then the DefaultSessionPoolDeleteTimeout is used.
func (Config) IdleKeepAliveThreshold ¶
IdleKeepAliveThreshold is a number of keepAlive messages to call before the session is removed if it is an excess session (see KeepAliveMinSize) This means that session will be deleted after the expiration of lifetime = IdleThreshold * IdleKeepAliveThreshold If IdleKeepAliveThreshold is less than zero then it will be treated as infinite and no sessions will be removed ever. If IdleKeepAliveThreshold is equal to zero, it will be set to DefaultIdleKeepAliveThreshold
func (Config) IdleThreshold ¶
IdleThreshold is a maximum duration between any activity within session. If this threshold reached, KeepAlive() method will be called on idle session.
If IdleThreshold is less than zero then there is no idle limit. If IdleThreshold is zero, then the DefaultSessionPoolIdleThreshold value is used.
func (Config) KeepAliveMinSize ¶
KeepAliveMinSize is a lower bound for sessions in the pool. If there are more sessions open, then the excess idle ones will be closed and removed after IdleKeepAliveThreshold is reached for each of them. If KeepAliveMinSize is less than zero, then no sessions will be preserved If KeepAliveMinSize is zero, the DefaultKeepAliveMinSize is used
func (Config) KeepAliveTimeout ¶
KeepAliveTimeout limits maximum time spent on KeepAlive request If KeepAliveTimeout is less than or equal to zero then the DefaultSessionPoolKeepAliveTimeout is used.
type Option ¶
type Option func(*Config)
func WithCreateSessionTimeout ¶
WithCreateSessionTimeout limits maximum time spent on Create session request If createSessionTimeout is less than or equal to zero then the DefaultSessionPoolCreateSessionTimeout is used.
func WithDeleteTimeout ¶
WithDeleteTimeout limits maximum time spent on Delete request If deleteTimeout is less than or equal to zero then the DefaultSessionPoolDeleteTimeout is used.
func WithIdleKeepAliveThreshold ¶
WithIdleKeepAliveThreshold defines number of keepAlive messages to call before the session is removed if it is an excess session (see KeepAliveMinSize) This means that session will be deleted after the expiration of lifetime = IdleThreshold * IdleKeepAliveThreshold If IdleKeepAliveThreshold is less than zero then it will be treated as infinite and no sessions will be removed ever. If IdleKeepAliveThreshold is equal to zero, it will be set to DefaultIdleKeepAliveThreshold
func WithIdleThreshold ¶
WithIdleThreshold sets maximum duration between any activity within session. If this threshold reached, KeepAlive() method will be called on idle session.
If idleThreshold is less than zero then there is no idle limit. If idleThreshold is zero, then the DefaultSessionPoolIdleThreshold value is used.
func WithKeepAliveMinSize ¶
WithKeepAliveMinSize defines lower bound for sessions in the pool. If there are more sessions open, then the excess idle ones will be closed and removed after IdleKeepAliveThreshold is reached for each of them. If keepAliveMinSize is less than zero, then no sessions will be preserved If keepAliveMinSize is zero, the DefaultKeepAliveMinSize is used
func WithKeepAliveTimeout ¶
WithKeepAliveTimeout limits maximum time spent on KeepAlive request If keepAliveTimeout is less than or equal to zero then the DefaultSessionPoolKeepAliveTimeout is used.
func WithSizeLimit ¶
WithSizeLimit defines upper bound of pooled sessions. If sizeLimit is less than or equal to zero then the DefaultSessionPoolSizeLimit variable is used as a limit.