Documentation
¶
Index ¶
- 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
- type NonAsyncPool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 the parent context
func NewContext ¶
func NewContext(stdCtx context.Context, globalVars *GlobalVars) Context
NewContext returns a new pipeline context
func NewContext4Test ¶
NewContext4Test 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 { CaptureInfo *model.CaptureInfo EtcdClient etcd.CDCEtcdClient // SortEngineManager is introduced for pull-based sinks. SortEngineFactory *factory.SortEngineFactory // OwnerRevision is the Etcd revision when the owner got elected. OwnerRevision int64 // MessageServer and MessageRouter are for peer-messaging MessageServer *p2p.MessageServer MessageRouter p2p.MessageRouter // ChangefeedThreadPool is the thread pool for changefeed initialization ChangefeedThreadPool workerpool.AsyncPool }
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
type NonAsyncPool ¶
type NonAsyncPool struct{}
NonAsyncPool is a dummy implementation of workerpool.AsyncPool, which runs tasks synchronously. It is used in tests to avoid the overhead of asynchronous task scheduling.