-
Notifications
You must be signed in to change notification settings - Fork 18
/
context.go
34 lines (27 loc) · 914 Bytes
/
context.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package floc
import "context"
/*
Context provides safe access to the underlying context.
For more details on the underlying context see https://golang.org/pkg/context/#Context.
*/
type Context interface {
Releaser
// Ctx returns the underlying context.
Ctx() context.Context
// UpdateCtx sets the new underlying context.
UpdateCtx(ctx context.Context)
// Done returns a channel that's closed when the flow done.
// Successive calls to Done return the same value.
Done() <-chan struct{}
// Value returns the value associated with this context for key,
// or nil if no value is associated with key.
Value(key interface{}) (value interface{})
// AddValue creates a new context with value and make it the current.
// This is an equivalent to.
//
// oldCtx := ctx.Ctx()
// newCtx := context.WithValue(oldCtx, key, value)
// ctx.UpdateCtx(newCtx)
//
AddValue(key, value interface{})
}