Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetaContext ¶
type MetaContext struct {
// contains filtered or unexported fields
}
MetaContext is an object which implements context.Context and which holds multiple contexts within it. The MetaContext is considered canceled only when ALL of the underlying contexts have been canceled.
Once canceled, it cannot be uncancelled, so it is an error to keep adding contexts once the meta context is considered cancelled.
func (*MetaContext) Add ¶
func (mc *MetaContext) Add(ctx context.Context) error
Add adds a new context to the metacontext.
func (*MetaContext) Deadline ¶
func (mc *MetaContext) Deadline() (deadline time.Time, ok bool)
Deadline returns the earliest Deadline in the pool.
func (*MetaContext) Done ¶
func (mc *MetaContext) Done() <-chan struct{}
Done returns the done channel. The MetaContext is done only when ALL of the contained contexts are done.
func (*MetaContext) Err ¶
func (mc *MetaContext) Err() error
Err returns the first done error reported by any context, if the whole context is done. Nil otherwise.
func (*MetaContext) Value ¶
func (mc *MetaContext) Value(key interface{}) interface{}
Value calls context.Value on the first not-done context, or on the first one, if all are done.