Interface RaftNodeApi

All Known Implementing Classes:
RaftNode

public interface RaftNodeApi
Narrow query/submit interface over a Raft consensus node.

Consumers that only need to query Raft state or submit commands — metrics collectors, distributed primitives, tracers, handlers — depend on this interface rather than on the concrete RaftNode. Tests substitute a Mockito mock of this interface; mocking the concrete RaftNode is forbidden by the project testing policy (see CLAUDE.md "mocking Raft/Kryo/JPA internals").

Lifecycle management (start/stop, configuration setters, WAL/metadata store wiring, snapshot application) intentionally does not appear on this interface. Those operations belong to the owner of the Raft node — CacheNode — which keeps a concrete RaftNode reference.

  • Method Details

    • getNodeId

      String getNodeId()
    • getGroupName

      String getGroupName()
    • getState

      RaftState getState()
    • getCurrentTerm

      long getCurrentTerm()
    • getCommitIndex

      long getCommitIndex()
    • getLastApplied

      long getLastApplied()
    • getLogSize

      long getLogSize()
    • getLeaderId

      @Nullable String getLeaderId()
    • isLeader

      boolean isLeader()
    • isRunning

      boolean isRunning()
    • isRaftFaulted

      boolean isRaftFaulted()
    • getClusterMembers

      Set<String> getClusterMembers()
    • getVoters

      Set<String> getVoters()
    • getLearners

      Set<String> getLearners()
    • getTimeSinceLastHeartbeatMs

      long getTimeSinceLastHeartbeatMs()
    • isLeaseValid

      boolean isLeaseValid()
    • canServeLocalRead

      boolean canServeLocalRead()
    • awaitLinearizableReadToken

      long awaitLinearizableReadToken() throws InterruptedException, TimeoutException
      Throws:
      InterruptedException
      TimeoutException
    • awaitLinearizableReadToken

      long awaitLinearizableReadToken(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException
      Throws:
      InterruptedException
      TimeoutException
    • isLinearizableReadTokenValid

      boolean isLinearizableReadTokenValid(long readToken)
    • submitCommand

      CompletableFuture<Object> submitCommand(byte[] command)
    • submitConfigChange

      CompletableFuture<Object> submitConfigChange(ConfigChange change)
    • awaitReplicationDrained

      boolean awaitReplicationDrained(long timeout, TimeUnit unit) throws InterruptedException
      Throws:
      InterruptedException
    • getReplicationLag

      long getReplicationLag()
    • getFollowerLagMetrics

      Map<String,Long> getFollowerLagMetrics()
    • getFollowerMatchIndexMetrics

      Map<String,Long> getFollowerMatchIndexMetrics()
    • getElectionsStarted

      long getElectionsStarted()
    • getCommandsSubmitted

      long getCommandsSubmitted()
    • getCommandsCommitted

      long getCommandsCommitted()
    • getStateApplyErrors

      long getStateApplyErrors()
    • getRaftLog

      RaftLog getRaftLog()