Documentation
¶
Index ¶
- func Exit(code int)
- func GetExpectedPrimaryFlag(client *clientv3.Client, primaryPath string) string
- func InitClient(s server) error
- func KeepExpectedPrimaryAlive(ctx context.Context, cli *clientv3.Client, exitPrimary chan<- struct{}, ...) (*election.Lease, error)
- func PromHandler() gin.HandlerFunc
- func Register(s server, serviceName string) (*discovery.ServiceRegistryEntry, *discovery.ServiceRegister, error)
- func StartGRPCAndHTTPServers(s server, serverReadyChan chan<- struct{}, l net.Listener)
- func StatusHandler(c *gin.Context)
- func StopGRPCServer(s server)
- func StopHTTPServer(s server)
- func TransferPrimary(client *clientv3.Client, lease *election.Lease, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetExpectedPrimaryFlag ¶
GetExpectedPrimaryFlag gets the expected primary flag.
func KeepExpectedPrimaryAlive ¶
func KeepExpectedPrimaryAlive(ctx context.Context, cli *clientv3.Client, exitPrimary chan<- struct{}, leaseTimeout int64, leaderPath, memberValue, service string) (*election.Lease, error)
KeepExpectedPrimaryAlive keeps the expected primary alive. We use lease to keep `expected primary` healthy. ONLY reset by the following conditions: - changed by `{service}/primary/transfer` API. - leader lease expired. ONLY primary called this function.
func PromHandler ¶
func PromHandler() gin.HandlerFunc
PromHandler is a handler to get prometheus metrics.
func Register ¶
func Register(s server, serviceName string) (*discovery.ServiceRegistryEntry, *discovery.ServiceRegister, error)
Register registers the service.
func StartGRPCAndHTTPServers ¶
StartGRPCAndHTTPServers starts the grpc and http servers.
func StatusHandler ¶
StatusHandler is a handler to get status info.
func TransferPrimary ¶
func TransferPrimary(client *clientv3.Client, lease *election.Lease, serviceName, oldPrimary, newPrimary string, keyspaceGroupID uint32, tsoMembersMap map[string]bool) error
TransferPrimary transfers the primary of the specified service. keyspaceGroupID is optional, only used for TSO service.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.