Interface ILock
ILock offers a common interface for locking on arbitrary resources used in leader election. The Interface is used to hide the details on specific implementations in order to allow them to change over time.
Namespace: k8s.LeaderElection
Assembly: KubernetesClient.dll
Syntax
public interface ILock
Properties
View SourceIdentity
the locks Identity
Declaration
string Identity { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
View SourceCreateAsync(LeaderElectionRecord, CancellationToken)
Create attempts to create a LeaderElectionRecord
Declaration
Task<bool> CreateAsync(LeaderElectionRecord record, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| LeaderElectionRecord | record | record to create |
| CancellationToken | cancellationToken | token to cancel the task |
Returns
| Type | Description |
|---|---|
| Task<bool> | true if created |
Describe()
Describe is used to convert details on current resource lock into a string
Declaration
string Describe()
Returns
| Type | Description |
|---|---|
| string | resource lock description |
GetAsync(CancellationToken)
Get returns the LeaderElectionRecord
Declaration
Task<LeaderElectionRecord> GetAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | token to cancel the task |
Returns
| Type | Description |
|---|---|
| Task<LeaderElectionRecord> | the record |
UpdateAsync(LeaderElectionRecord, CancellationToken)
Update will update and existing LeaderElectionRecord
Declaration
Task<bool> UpdateAsync(LeaderElectionRecord record, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| LeaderElectionRecord | record | record to create |
| CancellationToken | cancellationToken | token to cancel the task |
Returns
| Type | Description |
|---|---|
| Task<bool> | true if updated |