Documentation
¶
Index ¶
Constants ¶
View Source
const ( // misoconfig-prop: enable zk client | false PropZkEnabled = "zk.enabled" // misoconfig-prop: zk server host (slice of string) | localhost PropZkHost = "zk.hosts" // misoconfig-prop: zk server session timeout (seconds) | 5 PropZkSessionTimeout = "zk.session-timeout" )
misoconfig-section: Zookeeper Configuration
Variables ¶
This section is empty.
Functions ¶
func CreateEphNode ¶
func CreatePerNode ¶
Types ¶
type LeaderElection ¶
type LeaderElection struct {
// contains filtered or unexported fields
}
func NewLeaderElection ¶
func NewLeaderElection(rootPath string) *LeaderElection
Create LeaderElection.
For the same rootPath, only one *LeaderElection should be created and used.
func (*LeaderElection) Elect ¶
func (l *LeaderElection) Elect(rail miso.Rail, leaderDo func()) (bool, error)
Elect leader.
If current node becomes the leader, leaderDo is called exactly one time.
If current node fails to become the leader, it blocks indefinitively until it becomes the leader.
You can cancel the election, using Rail.WithCancel() or Rail.WithTimeout().
Click to show internal directories.
Click to hide internal directories.