Documentation ¶
Index ¶
Constants ¶
View Source
const LevelTrace = slog.Level(-8)
View Source
const MaxChannelLen = 63
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClusterPgStore ¶
type ClusterPgStore interface {
Nodes() (map[string]*electiontypes.ClusterNode, error)
}
ClusterPgStore provides an interface that is used to enumerate a secondary list of nodes. Typically, this list comes from a database table and can be used to verify that a cluster is healthy.
type FollowResult ¶
type FollowResult bool
const ( FollowResultPromote FollowResult = true FollowResultStop FollowResult = false )
type Follower ¶
type Follower interface { Follow() FollowResult Promote() }
type PgNotifier ¶
type PgxFollower ¶
type PgxFollower struct {
// contains filtered or unexported fields
}
func NewPgxFollower ¶
func NewPgxFollower(cfg PgxFollowerConfig) *PgxFollower
func (*PgxFollower) Follow ¶
func (p *PgxFollower) Follow() (result FollowResult)
func (*PgxFollower) Promote ¶
func (p *PgxFollower) Promote()
type PgxFollowerConfig ¶
type PgxFollowerConfig struct { Queue Queue Broadcaster broadcaster.Broadcaster Notifier PgNotifier LeaderChannel string Address string StopChan chan bool Timeout time.Duration }
type PgxLeader ¶
type PgxLeader struct {
// contains filtered or unexported fields
}
func NewPgxLeader ¶
func NewPgxLeader(cfg PgxLeaderConfig) *PgxLeader
type PgxLeaderConfig ¶
type PgxLeaderConfig struct { Store ClusterPgStore Broadcaster broadcaster.Broadcaster Notifier PgNotifier TaskHandler rselection.TaskHandler LeaderChannel string FollowerChannel string MessagesChannel string Address string StopChan chan bool PingInterval time.Duration SweepInterval time.Duration MaxPingAge time.Duration }
type PgxPgNotifier ¶
type PgxPgNotifier struct {
// contains filtered or unexported fields
}
func NewPgxPgNotifier ¶
func NewPgxPgNotifier(cfg PgxPgNotifierConfig) *PgxPgNotifier
type PgxPgNotifierConfig ¶
type Queue ¶
type Queue interface {
Push(assumeLeader electiontypes.AssumeLeader) error
}
Queue is not provided by the election library. Implement this interface. When new leadership is needed, an `electiontypes.AssumeLeader` job will be pushed to the queue.
Click to show internal directories.
Click to hide internal directories.