operation

package
v3.9.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextCancelAfter

func ContextCancelAfter(ctx context.Context) (d time.Duration, ok bool)

ContextCancelAfter returns the timeout within given deadline after which YDB should try to cancel operation and return result regardless of the cancelation.

func ContextTimeout

func ContextTimeout(ctx context.Context) (d time.Duration, ok bool)

ContextTimeout returns the timeout within given deadline after which YDB should try to cancel operation and return result regardless of the cancelation.

func SetOperationParams

func SetOperationParams(req interface{}, params Params)

func WithCancelAfter

func WithCancelAfter(ctx context.Context, d time.Duration) context.Context

WithCancelAfter returns a copy of parent deadline in which YDB operation cancel after parameter is set to d. If parent deadline cancelation timeout is smaller than d, parent deadline deadline is returned.

func WithMode

func WithMode(ctx context.Context, m Mode) context.Context

WithMode returns a copy of parent deadline in which YDB operation mode parameter is set to m. If parent deadline mode is set and is not equal to m, WithMode will panic.

func WithTimeout

func WithTimeout(ctx context.Context, d time.Duration) context.Context

WithTimeout returns a copy of parent deadline in which YDB operation timeout parameter is set to d. If parent deadline timeout is smaller than d, parent deadline is returned.

Types

type Mode

type Mode uint
const (
	ModeUnknown Mode = iota
	ModeSync
	ModeAsync
)

func ContextMode

func ContextMode(ctx context.Context) (m Mode, ok bool)

ContextMode returns the mode of YDB operation within given deadline.

func (Mode) String

func (m Mode) String() string

type ModeInterface

type ModeInterface interface {
	String() string
}

type Params

type Params struct {
	Timeout     time.Duration
	CancelAfter time.Duration
	Mode        Mode
}

func ContextParams

func ContextParams(ctx context.Context) (p Params)

func (Params) Empty

func (p Params) Empty() bool

func (Params) GetCancelAfter

func (p Params) GetCancelAfter() time.Duration

func (Params) GetMode

func (p Params) GetMode() string

func (Params) GetTimeout

func (p Params) GetTimeout() time.Duration

Jump to

Keyboard shortcuts

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