Interface CoordinationService

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
CoordinationServiceImpl

public interface CoordinationService extends AutoCloseable
Interface for the coordination service. Provides abstraction for distributed locks and leader election.
  • Method Details

    • getLeaderElection

      <T> LeaderElection<T> getLeaderElection(Class<T> clazz, String path, Consumer<LeaderElectionState> stateChangesListener)
      Create a new LeaderElection controller.
      Parameters:
      clazz - the class type to be used for serialization/deserialization
      path - the path to use for the leader election
      stateChangesListener - a listener that will be passed all the state changes
      Returns:
    • getLockManager

      <T> LockManager<T> getLockManager(Class<T> clazz)
    • getLockManager

      <T> LockManager<T> getLockManager(MetadataSerde<T> serde)
    • getNextCounterValue

      CompletableFuture<Long> getNextCounterValue(String path)
      Increment a counter identified by the specified path and return the current value. The counter value will be guaranteed to be unique within the context of the path. It will retry when MetadataStoreException happened. If the maximum number of retries is reached and still failed, the feature will complete with exception MetadataStoreException.
      Parameters:
      path - the path that identifies a particular counter
      Returns:
      a future that will track the completion of the operation
      Throws:
      CoordinationServiceException - if there's a failure in incrementing the counter