Represents a candidate in the leader election
Encapsulates functions towards Consul.
Observer to be notified for changes in election state.
A semaphore is a construction to control access to a common resource in a concurrent system.
A semaphore is a construction to control access to a common resource in a concurrent system. The semaphore in this library allows for creation of a distributed lock. In principle a semaphore is initiated with 1..n permits, instances of a semaphore then try to acquire one permit either succeeding or failing in case there are no more permits left to take. The simplest form is a binary semaphore which has only one permit thus only allowing a single instance to acquire a permit. Semaphores are traditionally used to control access to a protected source like a database or some task that only should be executed by a single process.
Each instance of the Semaphore class can hold exactly 0 or 1 permit thus invoking any of the tryAcquire functions mulitple times will not acquire additional permits.
Companion object to Consul
Factory for creating candidates for leader election
Companion object to Semaphore