Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Closer ¶
type Closer interface {
Close() error
}
Closer is an interface implemented by objects that should be closed when a context completes
type Context ¶
type Context interface {
Closer
// SetRequestContext sets the given context as the request context for this
// execution context. This is used for calls to the m3 storage wrapper.
SetRequestContext(ctx.Context)
// RequestContext will provide the wrapped request context. Used for calls
// to m3 storage wrapper.
RequestContext() ctx.Context
// RegisterCloser registers an object that should be closed when this
// context is closed. Can be used to cleanup per-request objects.
RegisterCloser(closer Closer)
// AddAsyncTask allows asynchronous tasks to be enqueued that will
// ensure this context does not call its registered closers until
// the tasks are all complete
AddAsyncTasks(count int)
// DoneAsyncTask signals that an asynchronous task is complete, when
// all asynchronous tasks complete if the context has been closed and
// avoided calling its registered closers it will finally call them
DoneAsyncTask()
}
Context is an execution context. A Context holds deadlines and request scoped values. Contexts should be scoped to a request; created when the request begins and closed when the request completes. Contexts are safe for use by multiple goroutines, but should not span multiple requests.