tidb: github.com/pingcap/tidb/owner Index | Files

package owner

import "github.com/pingcap/tidb/owner"


Package Files

manager.go mock.go


const (
    // NewSessionDefaultRetryCnt is the default retry times when create new session.
    NewSessionDefaultRetryCnt = 3
    // NewSessionRetryUnlimited is the unlimited retry times when create new session.
    NewSessionRetryUnlimited = math.MaxInt64


var ManagerSessionTTL = 60

ManagerSessionTTL is the etcd session's TTL in seconds. It's exported for testing.

func GetOwnerInfo Uses

func GetOwnerInfo(ctx, logCtx context.Context, elec *concurrency.Election, id string) (string, error)

GetOwnerInfo gets the owner information.

func NewSession Uses

func NewSession(ctx context.Context, logPrefix string, etcdCli *clientv3.Client, retryCnt, ttl int) (*concurrency.Session, error)

NewSession creates a new etcd session.

type DDLOwnerChecker Uses

type DDLOwnerChecker interface {
    // IsOwner returns whether the ownerManager is the owner.
    IsOwner() bool

DDLOwnerChecker is used to check whether tidb is owner.

type Manager Uses

type Manager interface {
    // ID returns the ID of the manager.
    ID() string
    // IsOwner returns whether the ownerManager is the owner.
    IsOwner() bool
    // RetireOwner make the manager to be a not owner. It's exported for testing.
    // GetOwnerID gets the owner ID.
    GetOwnerID(ctx context.Context) (string, error)
    // CampaignOwner campaigns the owner.
    CampaignOwner() error
    // ResignOwner lets the owner start a new election.
    ResignOwner(ctx context.Context) error
    // Cancel cancels this etcd ownerManager campaign.

Manager is used to campaign the owner and manage the owner information.

func NewMockManager Uses

func NewMockManager(ctx context.Context, id string) Manager

NewMockManager creates a new mock Manager.

func NewOwnerManager Uses

func NewOwnerManager(ctx context.Context, etcdCli *clientv3.Client, prompt, id, key string) Manager

NewOwnerManager creates a new Manager.

Package owner imports 20 packages (graph) and is imported by 120 packages. Updated 2020-05-31. Refresh now. Tools for package owners.