Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface interface { // OnStart start the service whatever the tidb-server is owner or not. OnStart(ctx context.Context) // OnBecomeOwner would be called once become the owner. // The context passed in would be canceled once it is no more the owner. OnBecomeOwner(ctx context.Context) // OnTick would be called periodically. // The error can be recorded. OnTick(ctx context.Context) error // Name returns the name which is used for tracing the daemon. Name() string }
Interface describes the lifetime hook of a daemon application.
type OwnerDaemon ¶
type OwnerDaemon struct {
// contains filtered or unexported fields
}
OwnerDaemon is a wrapper for running "daemon" in the TiDB cluster. Generally, it uses the etcd election API (wrapped in the `owner.Manager` interface), and shares nothing between nodes. Please make sure the daemon is "stateless" (i.e. it doesn't depend on the local storage or memory state.) This struct is "synchronous" (which means there are no race accessing of these variables.).
func (*OwnerDaemon) Begin ¶
func (od *OwnerDaemon) Begin(ctx context.Context) (func(), error)
Begin starts the daemon. It would do some bootstrap task, and return a closure that would begin the main loop.
func (*OwnerDaemon) Running ¶
func (od *OwnerDaemon) Running() bool
Running tests whether the daemon is running (i.e. is it the owner?)
Click to show internal directories.
Click to hide internal directories.