LogCabin
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Public Attributes
LogCabin::Server::RaftConsensusInternal::LocalServer Class Reference

A type of Server for the local process. More...

#include <RaftConsensus.h>

Inheritance diagram for LogCabin::Server::RaftConsensusInternal::LocalServer:
LogCabin::Server::RaftConsensusInternal::Server

List of all members.

Public Member Functions

 LocalServer (uint64_t serverId, RaftConsensus &consensus)
 ~LocalServer ()
void exit ()
 Inform any threads belonging to this Server to exit.
void beginRequestVote ()
 Begin requesting the Server's vote in the current election.
void beginLeadership ()
 Begin replicating to the Server in the current term.
uint64_t getMatchIndex () const
 Return the largest entry ID for which this Server is known to share the same entries up to and including this entry with our log.
bool haveVote () const
 Return true if this Server has awarded us its vote for this term.
uint64_t getLastAckEpoch () const
 Return the latest time this Server acknowledged our current term.
void interrupt ()
 Cancel any outstanding RPCs to this Server.
bool isCaughtUp () const
 Return true once this Server is ready to be added to the cluster.
void scheduleHeartbeat ()
 Make the next heartbeat RPC happen soon.
std::ostream & dumpToStream (std::ostream &os) const
 Virtual method for operator<<.
void updatePeerStats (Protocol::ServerStats::Raft::Peer &peerStats, Core::Time::SteadyTimeConverter &time) const
 Write this Server's state into the given structure.

Public Attributes

RaftConsensusconsensus
uint64_t lastSyncedIndex
 The index of the last log entry that has been flushed to disk.

Detailed Description

A type of Server for the local process.

There will only be one instance of this class. Most of these methods don't do much, but they are needed to satisfy the Server interface.

Definition at line 224 of file RaftConsensus.h.


Constructor & Destructor Documentation

Definition at line 77 of file RaftConsensus.cc.

Definition at line 84 of file RaftConsensus.cc.


Member Function Documentation

Inform any threads belonging to this Server to exit.

Return immediately. The condition variable in RaftConsensus will be notified separately.

Implements LogCabin::Server::RaftConsensusInternal::Server.

Definition at line 100 of file RaftConsensus.cc.

Begin requesting the Server's vote in the current election.

Return immediately. The condition variable in RaftConsensus will be notified separately.

Implements LogCabin::Server::RaftConsensusInternal::Server.

Definition at line 89 of file RaftConsensus.cc.

Begin replicating to the Server in the current term.

Return immediately. The condition variable in RaftConsensus will be notified separately.

Implements LogCabin::Server::RaftConsensusInternal::Server.

Definition at line 94 of file RaftConsensus.cc.

Return the largest entry ID for which this Server is known to share the same entries up to and including this entry with our log.

This is used for advancing the leader's commitIndex. Monotonically increases within a term.

Warning:
Only valid when we're leader.

Implements LogCabin::Server::RaftConsensusInternal::Server.

Definition at line 111 of file RaftConsensus.cc.

Return true if this Server has awarded us its vote for this term.

Implements LogCabin::Server::RaftConsensusInternal::Server.

Definition at line 117 of file RaftConsensus.cc.

Return the latest time this Server acknowledged our current term.

Implements LogCabin::Server::RaftConsensusInternal::Server.

Definition at line 105 of file RaftConsensus.cc.

Cancel any outstanding RPCs to this Server.

The condition variable in RaftConsensus will be notified separately.

Implements LogCabin::Server::RaftConsensusInternal::Server.

Definition at line 123 of file RaftConsensus.cc.

Return true once this Server is ready to be added to the cluster.

This means it has received enough of our log to where it is not expected to cause an availability problem when added to the cluster configuration. Should monotonically change from false to true.

Implements LogCabin::Server::RaftConsensusInternal::Server.

Definition at line 128 of file RaftConsensus.cc.

Make the next heartbeat RPC happen soon.

Return immediately. The condition variable in RaftConsensus will be notified separately.

Implements LogCabin::Server::RaftConsensusInternal::Server.

Definition at line 134 of file RaftConsensus.cc.

std::ostream & LogCabin::Server::RaftConsensusInternal::LocalServer::dumpToStream ( std::ostream &  os) const [virtual]

Virtual method for operator<<.

Implements LogCabin::Server::RaftConsensusInternal::Server.

Definition at line 139 of file RaftConsensus.cc.

void LogCabin::Server::RaftConsensusInternal::LocalServer::updatePeerStats ( Protocol::ServerStats::Raft::Peer &  peerStats,
Core::Time::SteadyTimeConverter time 
) const [virtual]

Write this Server's state into the given structure.

Used for diagnostics.

Implements LogCabin::Server::RaftConsensusInternal::Server.

Definition at line 146 of file RaftConsensus.cc.


Member Data Documentation

Definition at line 240 of file RaftConsensus.h.

The index of the last log entry that has been flushed to disk.

Valid for leaders only. Returned by getMatchIndex() and used to advance the leader's commitIndex.

Definition at line 246 of file RaftConsensus.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines