table

package
v3.11.7 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2022 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSessionPoolClosed is returned by a client instance to indicate
	// that client is closed and not able to complete requested operation.
	ErrSessionPoolClosed = errors.New("ydb: table: session pool is closed")

	// ErrSessionPoolOverflow is returned by a client instance to indicate
	// that the client is full and requested operation is not able to complete.
	ErrSessionPoolOverflow = errors.New("ydb: table: session pool overflow")

	// ErrSessionUnknown is returned by a client instance to indicate that
	// requested session does not exist within the client.
	ErrSessionUnknown = errors.New("ydb: table: unknown session")

	// ErrSessionShutdown is returned by a client instance to indicate that
	// requested session is under shutdown.
	ErrSessionShutdown = errors.New("ydb: table: session under shutdown")

	// ErrNoProgress is returned by a client instance to indicate that
	// operation could not be completed.
	ErrNoProgress = errors.New("ydb: table: no progress")
)

Functions

This section is empty.

Types

type Client

type Client interface {
	table.Client

	Get(ctx context.Context) (s Session, err error)
	Put(ctx context.Context, s Session) (err error)
	CloseSession(ctx context.Context, s Session) (err error)
}

func New

type Session

type Session interface {
	table.ClosableSession

	Status() string
	OnClose(f func(ctx context.Context))
	// contains filtered or unexported methods
}

type SessionBuilder

type SessionBuilder func(context.Context) (Session, error)

SessionBuilder is the interface that holds logic of creating sessions.

type SessionProvider

type SessionProvider interface {
	// Get returns alive idle session or creates new one.
	Get(context.Context) (Session, error)

	// Put takes no longer needed session for reuse or deletion depending
	// on implementation.
	// Put must be fast, if necessary must be async
	Put(context.Context, Session) (err error)

	// CloseSession provides the most effective way of session closing
	// instead of plain session.Close().
	// CloseSession must be fast. If necessary, can be async.
	CloseSession(ctx context.Context, s Session) error
}

SessionProvider is the interface that holds session lifecycle logic.

func SingleSession

func SingleSession(s Session) SessionProvider

SingleSession returns SessionProvider that uses only given session during retries.

type SessionProviderFunc

type SessionProviderFunc struct {
	OnGet func(context.Context) (Session, error)
	OnPut func(context.Context, Session) error
}

func (SessionProviderFunc) CloseSession

func (f SessionProviderFunc) CloseSession(ctx context.Context, s Session) error

func (SessionProviderFunc) Get

func (SessionProviderFunc) Put

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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