Documentation ¶
Index ¶
- func ZapFieldCapture(ctx Context) zap.Field
- func ZapFieldChangefeed(ctx Context) zap.Field
- type ChangefeedVars
- type Context
- func NewBackendContext4Test(withChangefeedVars bool) Context
- func NewContext(stdCtx context.Context, globalVars *GlobalVars) Context
- func NewContext4Test(baseCtx context.Context, withChangefeedVars bool) Context
- func WithCancel(ctx Context) (Context, context.CancelFunc)
- func WithChangefeedVars(ctx Context, changefeedVars *ChangefeedVars) Context
- func WithErrorHandler(ctx Context, f func(error) error) Context
- func WithStd(ctx Context, stdCtx context.Context) Context
- type GlobalVars
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ZapFieldCapture ¶
ZapFieldCapture returns a zap field containing capture address
func ZapFieldChangefeed ¶
ZapFieldChangefeed returns a zap field containing changefeed id
Types ¶
type ChangefeedVars ¶
type ChangefeedVars struct { ID model.ChangeFeedID Info *model.ChangeFeedInfo }
ChangefeedVars contains some vars which can be used anywhere in a pipeline the lifecycle of vars in the ChangefeedVars should be aligned with the changefeed. All field in Vars should be READ-ONLY and THREAD-SAFE
type Context ¶
type Context interface { context.Context // GlobalVars return the `GlobalVars` store by the root context created by `NewContext` // Note that the `GlobalVars` should be READ-ONLY and THREAD-SAFE // The root node and all its children node share one pointer of `GlobalVars` // So any modification of `GlobalVars` will cause all other family nodes to change. GlobalVars() *GlobalVars // ChangefeedVars return the `ChangefeedVars` store by the context created by `WithChangefeedVars` // Note that the `ChangefeedVars` should be READ-ONLY and THREAD-SAFE // The root node and all its children node share one pointer of `ChangefeedVars` // So any modification of `ChangefeedVars` will cause all other family nodes to change. // ChangefeedVars could be return nil when the `ChangefeedVars` is not set by `WithChangefeedVars` ChangefeedVars() *ChangefeedVars // Throw an error to parents nodes // we can using `WatchThrow` to listen the errors thrown by children nodes Throw(error) }
Context contains Vars(), Done(), Throw(error) and StdContext() context.Context Context is used to instead of standard context
func NewBackendContext4Test ¶
NewBackendContext4Test returns a new pipeline context for test, and us context.Background() as ethe parent context
func NewContext ¶
func NewContext(stdCtx context.Context, globalVars *GlobalVars) Context
NewContext returns a new pipeline context
func NewContext4Test ¶
NewBackendContext4Test returns a new pipeline context for test, and use the given context as parent context
func WithCancel ¶
func WithCancel(ctx Context) (Context, context.CancelFunc)
WithCancel returns a Context with the cancel function
func WithChangefeedVars ¶
func WithChangefeedVars(ctx Context, changefeedVars *ChangefeedVars) Context
WithChangefeedVars return a Context with the `ChangefeedVars`
func WithErrorHandler ¶
WithErrorHandler creates a new context that can watch the Throw function if the function `f` specified in WithErrorHandler returns an error, the error will be thrown to the parent context.
type GlobalVars ¶
type GlobalVars struct { PDClient pd.Client KVStorage tikv.Storage CaptureInfo *model.CaptureInfo EtcdClient *etcd.CDCEtcdClient GrpcPool kv.GrpcPool RegionCache *tikv.RegionCache TimeAcquirer pdtime.TimeAcquirer // OwnerRevision is the Etcd revision when the owner got elected. OwnerRevision int64 }
GlobalVars contains some vars which can be used anywhere in a pipeline the lifecycle of vars in the GlobalVars should be aligned with the ticdc server process. All field in Vars should be READ-ONLY and THREAD-SAFE