Documentation
¶
Index ¶
- func ExtractLocalDC(ctx context.Context) string
- func IsIdempotent(ctx context.Context) bool
- func IsNestedCall(ctx context.Context) bool
- func MarkRetryCall(ctx context.Context) context.Context
- func MergeContexts(deadline context.Context, additionalValues context.Context) context.Context
- func ValueOnly(ctx context.Context) context.Context
- func WithCancel(ctx context.Context) (context.Context, context.CancelFunc)
- func WithDone(parent context.Context, done <-chan struct{}) (context.Context, context.CancelFunc)
- func WithIdempotent(ctx context.Context, idempotent bool) context.Context
- func WithLocalDC(ctx context.Context, dc string) context.Context
- func WithStoppableTimeoutCause(ctx context.Context, timeout time.Duration, cause error) (context.Context, func() bool)
- func WithTimeout(ctx context.Context, t time.Duration) (context.Context, context.CancelFunc)
- type CancelsGuard
- type MergedContexts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractLocalDC ¶ added in v3.42.6
func IsIdempotent ¶ added in v3.42.0
func IsNestedCall ¶ added in v3.54.2
func MergeContexts ¶ added in v3.108.4
MergeContexts returns a context with the deadline from the deadline context and values from both contexts
func WithCancel ¶ added in v3.46.1
func WithIdempotent ¶ added in v3.42.0
func WithLocalDC ¶ added in v3.42.6
func WithStoppableTimeoutCause ¶ added in v3.118.1
func WithStoppableTimeoutCause(ctx context.Context, timeout time.Duration, cause error) (context.Context, func() bool)
WithStoppableTimeoutCause returns a copy of the parent context that is cancelled with the specified cause after timeout elapses, and a stop function. Calling the stop function prevents the timeout from canceling the context and releases resources associated with it. The cause error will be used when the timeout triggers cancellation.
The returned stop function returns a boolean value:
- true if the timeout was successfully stopped before it fired (context was not cancelled by timeout)
- false if the timeout already fired and the context was cancelled with the specified cause
func WithTimeout ¶ added in v3.46.1
Types ¶
type CancelsGuard ¶ added in v3.64.0
type CancelsGuard struct {
// contains filtered or unexported fields
}
func NewCancelsGuard ¶ added in v3.64.0
func NewCancelsGuard() *CancelsGuard
func (*CancelsGuard) Cancel ¶ added in v3.64.0
func (g *CancelsGuard) Cancel()
func (*CancelsGuard) WithCancel ¶ added in v3.66.2
func (g *CancelsGuard) WithCancel(ctx context.Context) (context.Context, context.CancelFunc)
type MergedContexts ¶ added in v3.108.4
type MergedContexts struct {
// contains filtered or unexported fields
}
func (*MergedContexts) Deadline ¶ added in v3.108.4
func (ctx *MergedContexts) Deadline() (deadline time.Time, ok bool)
func (*MergedContexts) Done ¶ added in v3.108.4
func (ctx *MergedContexts) Done() <-chan struct{}
func (*MergedContexts) Err ¶ added in v3.108.4
func (ctx *MergedContexts) Err() error
func (*MergedContexts) Value ¶ added in v3.108.4
func (ctx *MergedContexts) Value(key interface{}) interface{}
Click to show internal directories.
Click to hide internal directories.