config

package
v3.66.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSessionPoolDeleteTimeout        = 500 * time.Millisecond
	DefaultSessionPoolCreateSessionTimeout = 5 * time.Second
	DefaultSessionPoolSizeLimit            = 50
	DefaultSessionPoolIdleThreshold        = 5 * time.Minute

	// Deprecated: table client do not supports background session keep-aliving now.
	// Will be removed after Oct 2024.
	// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
	DefaultKeepAliveMinSize = 10

	// Deprecated: table client do not supports background session keep-aliving now.
	// Will be removed after Oct 2024.
	// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
	DefaultIdleKeepAliveThreshold = 2

	// Deprecated: table client do not supports background session keep-aliving now.
	// Will be removed after Oct 2024.
	// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
	DefaultSessionPoolKeepAliveTimeout = 500 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	config.Common
	// contains filtered or unexported fields
}

Config is a configuration of table client

func New

func New(opts ...Option) *Config

func (*Config) Clock added in v3.44.0

func (c *Config) Clock() clockwork.Clock

Clock defines clock

func (*Config) CreateSessionTimeout

func (c *Config) CreateSessionTimeout() time.Duration

CreateSessionTimeout limits maximum time spent on Create session request

func (*Config) DeleteTimeout

func (c *Config) DeleteTimeout() time.Duration

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 deprecated

func (c *Config) IdleKeepAliveThreshold() int

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

Deprecated: table client do not supports background session keep-aliving now. Will be removed after Oct 2024. Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated

func (*Config) IdleThreshold

func (c *Config) IdleThreshold() time.Duration

IdleThreshold is a maximum duration between any activity within session. If this threshold reached, idle session will be closed

If IdleThreshold is less than zero then there is no idle limit. If IdleThreshold is zero, then the DefaultSessionPoolIdleThreshold value is used.

func (*Config) IgnoreTruncated added in v3.36.0

func (c *Config) IgnoreTruncated() bool

IgnoreTruncated specifies behavior on truncated flag

func (*Config) KeepAliveMinSize deprecated

func (c *Config) KeepAliveMinSize() int

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

Deprecated: table client do not supports background session keep-aliving now. Will be removed after Oct 2024. Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated

func (*Config) KeepAliveTimeout deprecated

func (c *Config) KeepAliveTimeout() time.Duration

KeepAliveTimeout limits maximum time spent on KeepAlive request If KeepAliveTimeout is less than or equal to zero then the DefaultSessionPoolKeepAliveTimeout is used.

Deprecated: table client do not supports background session keep-aliving now. Will be removed after Oct 2024. Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated

func (*Config) SizeLimit

func (c *Config) SizeLimit() int

SizeLimit is an upper bound of pooled sessions. If SizeLimit is less than or equal to zero then the DefaultSessionPoolSizeLimit variable is used as a limit.

func (*Config) Trace

func (c *Config) Trace() *trace.Table

Trace defines trace over table client calls

type Option

type Option func(*Config)

func With

func With(config config.Common) Option

With applies common configuration params

func WithClock added in v3.44.0

func WithClock(clock clockwork.Clock) Option

WithClock replaces default clock

func WithCreateSessionTimeout

func WithCreateSessionTimeout(createSessionTimeout time.Duration) Option

WithCreateSessionTimeout limits maximum time spent on Create session request If createSessionTimeout is less than or equal to zero then no used timeout on create session request

func WithDeleteTimeout

func WithDeleteTimeout(deleteTimeout time.Duration) Option

WithDeleteTimeout limits maximum time spent on Delete request If deleteTimeout is less than or equal to zero then the DefaultSessionPoolDeleteTimeout is used.

func WithIdleKeepAliveThreshold deprecated

func WithIdleKeepAliveThreshold(idleKeepAliveThreshold int) Option

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

Deprecated: table client do not supports background session keep-aliving now. Will be removed after Oct 2024. Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated

func WithIdleThreshold

func WithIdleThreshold(idleThreshold time.Duration) Option

WithIdleThreshold sets maximum duration between any activity within session. If this threshold reached, session will be closed.

If idleThreshold is less than zero then there is no idle limit. If idleThreshold is zero, then the DefaultSessionPoolIdleThreshold value is used.

func WithIgnoreTruncated added in v3.36.0

func WithIgnoreTruncated() Option

WithIgnoreTruncated disables errors on truncated flag

func WithKeepAliveMinSize deprecated

func WithKeepAliveMinSize(keepAliveMinSize int) Option

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

Deprecated: table client do not supports background session keep-aliving now. Will be removed after Oct 2024. Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated

func WithKeepAliveTimeout deprecated

func WithKeepAliveTimeout(keepAliveTimeout time.Duration) Option

WithKeepAliveTimeout limits maximum time spent on KeepAlive request If keepAliveTimeout is less than or equal to zero then the DefaultSessionPoolKeepAliveTimeout is used.

Deprecated: table client do not supports background session keep-aliving now. Will be removed after Oct 2024. Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated

func WithSizeLimit

func WithSizeLimit(sizeLimit int) Option

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.

func WithTrace

func WithTrace(trace *trace.Table, opts ...trace.TableComposeOption) Option

WithTrace appends table trace to early defined traces

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL