config

package
v3.18.3-rc0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultInterval = time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	// Endpoint is a required starting endpoint for connect
	Endpoint() string

	// Database is a required database name.
	Database() string

	// Secure is an flag for secure connection
	Secure() bool

	// OperationTimeout is the maximum amount of time a YDB server will process
	// an operation. After timeout exceeds YDB will try to cancel operation and
	// regardless of the cancellation appropriate error will be returned to
	// the client.
	// If OperationTimeout is zero then no timeout is used.
	OperationTimeout() time.Duration

	// OperationCancelAfter is the maximum amount of time a YDB server will process an
	// operation. After timeout exceeds YDB will try to cancel operation and if
	// it succeeds appropriate error will be returned to the client; otherwise
	// processing will be continued.
	// If OperationCancelAfter is zero then no timeout is used.
	OperationCancelAfter() time.Duration

	// Trace defines trace over discovery client calls
	Trace() trace.Discovery

	// Interval is the frequency of background tasks of ydb endpoints discovery.
	// If Interval is zero then the DefaultInterval is used.
	// If Interval is negative, then no background discovery prepared.
	Interval() time.Duration

	// Meta is an option which contains meta information about database connection
	Meta() meta.Meta

	// PanicCallback returns user-defined panic callback
	// If nil - panic callback not defined
	PanicCallback() func(e interface{})
}

func New

func New(opts ...Option) Config

type Option

type Option func(c *config)

func WithDatabase

func WithDatabase(database string) Option

func WithEndpoint

func WithEndpoint(endpoint string) Option

func WithInterval

func WithInterval(interval time.Duration) Option

func WithMeta added in v3.16.1

func WithMeta(meta meta.Meta) Option

func WithOperationCancelAfter added in v3.11.0

func WithOperationCancelAfter(operationCancelAfter time.Duration) Option

func WithOperationTimeout added in v3.11.0

func WithOperationTimeout(operationTimeout time.Duration) Option

func WithPanicCallback added in v3.18.3

func WithPanicCallback(cb func(e interface{})) Option

func WithSecure

func WithSecure(ssl bool) Option

func WithTrace

func WithTrace(trace trace.Discovery, opts ...trace.DiscoveryComposeOption) Option

Jump to

Keyboard shortcuts

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