Interface Lock
- All Known Implementing Classes:
ConfigMapLock,LeaseLock
public interface Lock
-
Field Summary
Fields Modifier and Type Field Description static StringLEADER_ELECTION_RECORD_ANNOTATION_KEY -
Method Summary
Modifier and Type Method Description <C extends Namespaceable<C> & KubernetesClient>
voidcreate(C client, LeaderElectionRecord leaderElectionRecord)Attempt to create a newLeaderElectionRecord.Stringdescribe()Full description of the current lock.<C extends Namespaceable<C> & KubernetesClient>
LeaderElectionRecordget(C client)Returns the currentLeaderElectionRecordor null if none.Stringidentity()Returns the unique id of the lock holder.<C extends Namespaceable<C> & KubernetesClient>
voidupdate(C client, LeaderElectionRecord leaderElectionRecord)Attempts to update the currentLeaderElectionRecord.
-
Field Details
-
Method Details
-
get
Returns the currentLeaderElectionRecordor null if none.- Type Parameters:
C- Type parameter for the Client- Parameters:
client- used to retrieve the LeaderElectionRecord- Returns:
- the current LeaderElectionRecord or null if none
-
create
<C extends Namespaceable<C> & KubernetesClient> void create(C client, LeaderElectionRecord leaderElectionRecord) throws LockExceptionAttempt to create a newLeaderElectionRecord.- Type Parameters:
C- Type parameter for the Client- Parameters:
client- used to retrieve the LeaderElectionRecordleaderElectionRecord- to update- Throws:
LockException- if update was not possible
-
update
<C extends Namespaceable<C> & KubernetesClient> void update(C client, LeaderElectionRecord leaderElectionRecord) throws LockExceptionAttempts to update the currentLeaderElectionRecord.- Type Parameters:
C- Type parameter for the Client- Parameters:
client- used to retrieve the LeaderElectionRecordleaderElectionRecord- to update- Throws:
LockException- if update was not possible
-
identity
String identity()Returns the unique id of the lock holder. This id is to compare ids with currentLeaderElectionRecord.getHolderIdentity()to check for leadership.- Returns:
- unique id for the lock
-
describe
String describe()Full description of the current lock.- Returns:
- lock description
-