Version: v0.0.0-...-9649366 Latest Latest

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

Go to latest
Published: Nov 21, 2019 License: Apache-2.0 Imports: 8 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Cancellable

type Cancellable interface {
	// IsCancelled determines whether the object is cancelled.
	IsCancelled() bool

	// Cancel cancels the object.

	// Reset resets the object.

Cancellable is an object that can be cancelled.

func NewCancellable

func NewCancellable() Cancellable

NewCancellable creates a new cancellable object

func NewNoOpCanncellable

func NewNoOpCanncellable() Cancellable

NewNoOpCanncellable returns a no-op cancellable

type Context

type Context interface {
	// IsClosed returns whether the context is closed.
	IsClosed() bool

	// RegisterFinalizer will register a resource finalizer.

	// RegisterCloser will register a resource closer.

	// DependsOn will register a blocking context that
	// must complete first before finalizers can be called.

	// Close will close the context.

	// BlockingClose will close the context and call the
	// registered finalizers in a blocking manner after waiting
	// for any dependent contexts to close. After calling
	// the context becomes safe to reset and reuse again
	// if and only if it is not a pooled context.

	// Reset will reset the context for reuse.

	// BlockingCloseReset will close the context and call the
	// registered finalizers in a blocking manner after waiting
	// for any dependent contexts to close. After calling
	// the context becomes reset and is safe for reuse again as it
	// will not be returned to a pool.

	// GoContext returns the Go std context.
	GoContext() (stdctx.Context, bool)

	// SetGoContext sets the Go std context.

	// StartTraceSpan starts a new span and returns a child ctx.
	StartTraceSpan(string) (Context, opentracing.Span)

	// StartSampledTraceSpan starts a new span and returns a child ctx
	// and a bool if the span is being sampled. This is used over StartTraceSpan()
	// for hot paths where performance is crucial.
	StartSampledTraceSpan(string) (Context, opentracing.Span, bool)

Context provides context to an operation.

func NewContext

func NewContext() Context

NewContext creates a new context.

type Options

type Options interface {
	// SetContextPoolOptions sets the context pool options.
	SetContextPoolOptions(pool.ObjectPoolOptions) Options

	// ContextPoolOptions returns the context pool options.
	ContextPoolOptions() pool.ObjectPoolOptions

	// SetFinalizerPoolOptions sets the finalizer pool options.
	SetFinalizerPoolOptions(pool.ObjectPoolOptions) Options

	// FinalizerPoolOptions returns the finalizer pool options.
	FinalizerPoolOptions() pool.ObjectPoolOptions

Options controls knobs for context pooling.

func NewOptions

func NewOptions() Options

NewOptions returns a new Options object.

type Pool

type Pool interface {
	// Get provides a context from the pool.
	Get() Context

	// Put returns a context to the pool.

Pool provides a pool for contexts.

func NewPool

func NewPool(opts Options) Pool

NewPool creates a new context pool.

Jump to

Keyboard shortcuts

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