Documentation ¶
Index ¶
Constants ¶
View Source
const ( CHECKER state = iota PRETENDER USURPER LEADER STOPPED )
Variables ¶
View Source
var (
IndexName = common.IndexName(".tasques_leader_locks")
)
Functions ¶
func NewLeaderLock ¶
func NewLeaderLock(leaderLockDocId common.DocumentID, client *elasticsearch.Client, loopInterval time.Duration, leaderReportLagTolerance time.Duration, tracer tracing.Tracer) leader.Lock
NewLeaderLock returns a new leader.Lock
Generates a random process id for the returned instance.
Types ¶
type EsLock ¶
type EsLock struct {
// contains filtered or unexported fields
}
* EsLock implements a very basic state machine for checking if the current `EsLock` process * is the leader based on what is stored inside the document in the leader index, as identified * by ID. * * It does this by using a simple polling mechanism along with a looping FSM that makes use of * The concurrent locking mechanisms in ES to figure out it should attempt to become the leader. * * Limitations: * - Not real time (polling..) * - Depends on not having too much drift in machine clock between all servers (time diff).
func (*EsLock) SetUTCGetter ¶
Ignore: this is for tests
Click to show internal directories.
Click to hide internal directories.