Package

com.github.trex_paxos

library

Permalink

package library

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. library
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. case class Accept(id: Identifier, value: CommandValue) extends PaxosMessage with Product with Serializable

    Permalink

    Accept proposes a value into a log index position.

    Accept proposes a value into a log index position. Followers must:

    1. Nack if a promise has been made to a Prepare request with a higher BallotNumber. 1. Request retransmission of lost messages if the logIndex leads to a gap in log index sequence. 1. If the Ack with a positive response then journal the accept message at the log index if the number is higher than the message currently store at this index.

    id

    Unique identifier for this request.

    value

    The value to accept at the slot position indicated by the id

  2. case class AcceptAck(requestId: Identifier, from: Int, progress: Progress) extends AcceptResponse with Product with Serializable

    Permalink

    Positive acknowledgement that the request has been made durable by the respondent.

    Positive acknowledgement that the request has been made durable by the respondent.

    requestId

    The request being positively acknowledged.

    from

    The unique identifier of the respondent

  3. trait AcceptHandler extends PaxosLenses

    Permalink
  4. case class AcceptNack(requestId: Identifier, from: Int, progress: Progress) extends AcceptResponse with Product with Serializable

    Permalink

    Negative acknowledgement that the request has been rejected by the respondent.

    Negative acknowledgement that the request has been rejected by the respondent. The progress in the reply gives an indication of the reason: either the respondent has made a higher promise else the respondent has committed the proposed slot.

    requestId

    The request being negatively acknowledged

    from

    The unique identifier of the respondent

    progress

    The high commit mark and last promise of the responding node.

  5. trait AcceptResponse extends PaxosMessage

    Permalink

    Base type for a response to an accept message.

  6. trait AcceptResponseHandler extends PaxosLenses with BackdownAgent with CommitHandler

    Permalink
  7. case class AcceptResponsesAndTimeout(timeout: Long, accept: Accept, responses: Map[Int, AcceptResponse]) extends Product with Serializable

    Permalink

    Tracks the responses to an accept message and when we timeout on getting a majority response

    Tracks the responses to an accept message and when we timeout on getting a majority response

    timeout

    The point in time we timeout.

    accept

    The accept that we are awaiting responses.

    responses

    The known responses.

  8. case class AcceptsAndData(accepts: Traversable[Accept], data: PaxosData) extends Product with Serializable

    Permalink
  9. trait BackdownAgent extends AnyRef

    Permalink
  10. case class BallotNumber(counter: Int, nodeIdentifier: Int) extends Product with Serializable

    Permalink

    The logical number used to discriminate messages as either higher or lower.

    The logical number used to discriminate messages as either higher or lower. Numbers must be unique to _both_ the node in the cluster *and* paxos prepare. Physically it is 64bits with high 32bits an epoch number and low 32bits a node unique identifier. The number will be fixed for a stable leader so it also represents a leaders term.

    counter

    Used by candidate leaders to "go higher" than prior or competing leaders. No guarantees are made as to this number; there may be gaps between values issued by a node and there may be collisions between dueling leaders.

    nodeIdentifier

    node unique number which must be unique to an agent within the cluster (e.g. set from unique configuration or parsed from DNS name ’node0’, ’node1'). This value is used to tie break between dueling leaders. Safety of the algorithm requires that this value must be unique per cluster.

  11. class Box[T] extends AnyRef

    Permalink

    codacy.com complains about using var in tests or using '.get' on atomics so this is our own box mainly used for testing purposes as it doesn't seem worth a new module nor a new dependency to avoid having to add this into the main codebase.

  12. trait ClientCommandHandler extends PaxosLenses

    Permalink
  13. trait CommandValue extends PaxosMessage

    Permalink

    We perform consensus over instances of CommandValue.

  14. case class Commit(identifier: Identifier, heartbeat: Long) extends PaxosMessage with Product with Serializable

    Permalink

    Commit messages indicate the highest committed log stream number.

    Commit messages indicate the highest committed log stream number. The leader shall heartbeat this message type to indicate that it is alive. Followers must:

    1. Commit the specified message in the log index if-and-only-if all previous values have been committed in order. 1. Request retransmission of any messages not known to have been committed at lower log index slot.

    Note that the leader must commit messages in log index order itself which implies that any prior slots user the same leader number have also been committed by the leader.

    identifier

    Identifies the unique accept message, and hence unique value, which is being committed into the identified slot.

    heartbeat

    A value which changes for each heartbeat message which indicates that the leader is alive.

  15. trait CommitHandler extends PaxosLenses

    Permalink
  16. case class FailoverResult(failover: Boolean, maxHeartbeat: Long) extends Product with Serializable

    Permalink
  17. trait FollowerHandler extends PaxosLenses with BackdownAgent

    Permalink
  18. case class Identifier(from: Int, number: BallotNumber, logIndex: Long) extends Product with Serializable

    Permalink

    Identifies a unique leader epoch and log index “slot” into which a value may be proposed.

    Identifies a unique leader epoch and log index “slot” into which a value may be proposed. Each leader must only propose a single value into any given slot and must change the BallotNumber to propose a different value at the same slot. The identifier used for a given slot will be shared across prepare, accept and commit messages during a leader take-over. The ordering of identifiers is defined by their log index order which is used to commit accepted values in order. TODO how can from differ from number.nodeIdentifier?

    from

    The node sending the message.

    number

    The paxos proposal number used for comparing messages, or values, as higher or lower than each other. This value will be fixed for a stable leadership.

    logIndex

    The contiguous log stream position, or “slot”, into which values are proposed and committed in order.

  19. trait Journal extends AnyRef

    Permalink

    Durable store for the replicated log.

    Durable store for the replicated log. Methods load and save must make durable the bookwork of the progress made by the given cluster node. The accept and accepted methods store value message at a given log index. An implementation could use a BTree else a local database.

  20. case class JournalBounds(min: Long, max: Long) extends Product with Serializable

    Permalink
  21. case class Lens[A, B](get: (A) ⇒ B, set: (A, B) ⇒ A) extends (A) ⇒ B with Immutable with Product with Serializable

    Permalink

    http://stackoverflow.com/a/5597750/329496

  22. case class NoLongerLeaderException(nodeId: Int, msgId: Long) extends RuntimeException with PaxosMessage with Product with Serializable

    Permalink

    Response to a client when the nodes has lost its leadership whilst servicing a request during a fail-over due to either a network partition or a long stall.

    Response to a client when the nodes has lost its leadership whilst servicing a request during a fail-over due to either a network partition or a long stall. The outcome of the client operation indicated by msgId is unknown as the operation may or may not be committed by the new leader. The application will have to query data to learn whether the operation did actually work. Note that semantically this is no different from sending a tcp request to an open socket and not getting back a response; its not known whether the request was processed as there has been neither positive nor negative acknowledgement. Since we don't know if it is safe to retry the operation nor how to query to check it the host application will have to decided what to do next. Note that this may be thrown for read only work if the application used strong or single reads as those avoid returning stale data which may occur doing a leader failover.

    nodeId

    The node replying that it is has lost the leader.

    msgId

    The client message which the node is responding to.

  23. case class NotFollower(nodeId: Int, msgId: Long) extends PaxosMessage with Product with Serializable

    Permalink

    Response to a client when the nodes is not currently a follower.

    Response to a client when the nodes is not currently a follower. As the leader is write bottleneck applications that can tolerate stale can reads can opt to spread some reads across all the replicas. This message is return in response to such follower reads. The client can retry other nodes (or even this node) until it gets a response.

    nodeId

    The node replying that it is has become the leader.

    msgId

    The client message which the node is responding to.

  24. case class NotLeader(nodeId: Int, msgId: Long) extends PaxosMessage with Product with Serializable

    Permalink

    Response to a client when the node is not currently the leader.

    Response to a client when the node is not currently the leader. The client should retry the message to another node in the cluster. Note the leader may have crashed and the responding node may become the leader next.

    nodeId

    The node replying that it is not the leader.

    msgId

    The client message identifier which the node is responding to.

  25. case class PaxosAgent(nodeUniqueId: Int, role: PaxosRole, data: PaxosData) extends Product with Serializable

    Permalink
  26. class PaxosAlgorithm extends PaxosLenses with CommitHandler with FollowerHandler with RetransmitHandler with PrepareHandler with AcceptHandler with PrepareResponseHandler with AcceptResponseHandler with ResendHandler with ReturnToFollowerHandler with ClientCommandHandler

    Permalink
  27. case class PaxosData(progress: Progress, leaderHeartbeat: Long, timeout: Long, clusterSize: Int, prepareResponses: SortedMap[Identifier, Map[Int, PrepareResponse]] = PaxosData.emptyPrepares, epoch: Option[BallotNumber] = None, acceptResponses: SortedMap[Identifier, AcceptResponsesAndTimeout] = PaxosData.emptyAccepts, clientCommands: Map[Identifier, (CommandValue, String)] = Map.empty) extends Product with Serializable

    Permalink

    This algebraic type holds the state of a node in the cluster.

    This algebraic type holds the state of a node in the cluster.

    progress

    The highest promised and highest committed progress of a node in the cluster.

    leaderHeartbeat

    The last heartbeat value seen from a leader. Note that clocks are not synced so this value is only used as evidence that a stable leader is up whereas the paxos number and committed slot are taken as authoritative that a new leader is making progress.

    timeout

    The next randomised point in time that this node will timeout. Followers timeout on Commit messages and become a Recoverer. Recoverers timeout on PrepareResponses and AcceptResponses. Leaders timeout on AcceptResponses.

    clusterSize

    The current size of the cluster.

    prepareResponses

    The outstanding uncommitted proposed work of the leader take over phase during the recovery of a leader failover. Each key is an identifier of a prepare for which we are collecting a majority response to determine the highest proposed value of the previous leader if any.

    epoch

    The leaders paxos number when leading.

    acceptResponses

    Tracking of responses to accept messages when Recoverer or Leader. Each key is an identifier of the command we want to commit. Each value is a map of the ack/nacks of each cluster node with a timeout.

    clientCommands

    The client work outstanding with the leader. The map key is the accept identifier and the value is a tuple of the client command and the client ref.

  28. case class PaxosEvent(io: PaxosIO, agent: PaxosAgent, message: PaxosMessage) extends Product with Serializable

    Permalink
  29. trait PaxosIO extends AnyRef

    Permalink
  30. trait PaxosLenses extends AnyRef

    Permalink
  31. trait PaxosLogging extends AnyRef

    Permalink

    We would like to log per agent rather than per class/trait so we pass the logger around.

    We would like to log per agent rather than per class/trait so we pass the logger around. This API happens to follow Akka logging

  32. sealed trait PaxosMessage extends AnyRef

    Permalink

    Marker trait for messages

  33. sealed trait PaxosRole extends AnyRef

    Permalink

    Paxos process roles

  34. case class Payload(deduplicationId: Long, command: CommandValue) extends Product with Serializable

    Permalink

    Once consensus has been reached we deliver CommandValues in consensus order with the possibility of repeats during crash recovery.

    Once consensus has been reached we deliver CommandValues in consensus order with the possibility of repeats during crash recovery.

    deduplicationId

    An id number which can be use dto deduplicate repeated deliveries that may happen during crash recovery.

    command

    The value which has been chosen by the consensus protocol.

  35. case class Prepare(id: Identifier) extends PaxosMessage with Product with Serializable

    Permalink

    Prepare is only sent to either establish a leader else to probe for the uncommitted values of a previous leader during the leader take-over phase.

    Prepare is only sent to either establish a leader else to probe for the uncommitted values of a previous leader during the leader take-over phase. Followers must:

    1. Check the BallotNumber of the Identifier against the highest value previously acknowledged; if the request is lower acknowledged negatively acknowledge (“nack") it. 1. Check the logIndex of the Identifier against the highest committed logIndex; if the request is lower nack it. 1. If the BallotNumber of the Identifier is higher the then previously acknowledged the node must make the new number durable and promise to nack any messages with a lower BallotNumber The positive acknowledgement ("ack") must return the highest uncommitted Accept message with the same log index or None if there is no uncommitted value at that slot.

  36. case class PrepareAck(requestId: Identifier, from: Int, progress: Progress, highestAcceptedIndex: Long, leaderHeartbeat: Long, highestUncommitted: Option[Accept]) extends PrepareResponse with Product with Serializable

    Permalink

    Positively acknowledge a Prepare message.

    Positively acknowledge a Prepare message. See PrepareResponse

    highestAcceptedIndex

    The highest uncommitted log index accepted by the responding node.

  37. trait PrepareHandler extends PaxosLenses with BackdownAgent

    Permalink
  38. case class PrepareNack(requestId: Identifier, from: Int, progress: Progress, highestAcceptedIndex: Long, leaderHeartbeat: Long) extends PrepareResponse with Product with Serializable

    Permalink

    Negatively acknowledge a Prepare message.

    Negatively acknowledge a Prepare message. See PrepareResponse

  39. trait PrepareResponse extends PaxosMessage

    Permalink

    Base type for a response to a prepare message.

    Base type for a response to a prepare message. It provides additional information beyond that prescribed by the core Paxos alogirth which is used during the leader takeover protocol and to prevent unnecessary leader failover attempts.

  40. trait PrepareResponseHandler extends PaxosLenses with BackdownAgent

    Permalink
  41. case class Progress(highestPromised: BallotNumber, highestCommitted: Identifier) extends Product with Serializable

    Permalink

    The progress of a node is the highest promise number and the highest committed message.

    The progress of a node is the highest promise number and the highest committed message.

    highestPromised

    Highest promise made by a node

    highestCommitted

    Highest position and highest number committed by a node

  42. trait ResendHandler extends PaxosLenses

    Permalink
  43. case class Retransmission(newProgress: Progress, accepts: Seq[Accept], committed: Seq[(Long, CommandValue)]) extends Product with Serializable

    Permalink
  44. trait RetransmitHandler extends PaxosLenses

    Permalink
  45. case class RetransmitRequest(from: Int, to: Int, logIndex: Long) extends PaxosMessage with Product with Serializable

    Permalink

    Requests retransmission of accept messages higher than a given log message

    Requests retransmission of accept messages higher than a given log message

    from

    The node unique id which is sending the request

    to

    The node unique id to which the request is to be routed

    logIndex

    The log index last committed by the requester

  46. case class RetransmitResponse(from: Int, to: Int, committed: Seq[Accept], uncommitted: Seq[Accept]) extends PaxosMessage with Product with Serializable

    Permalink

    Response to a retransmit request

    Response to a retransmit request

    from

    The node unique id which is sending the response

    to

    The node unique id to which the request is to be routed

    committed

    A contiguous sequence of committed accept messages in ascending order

    uncommitted

    A contiguous sequence of proposed but uncommitted accept messages in ascending order

  47. trait ReturnToFollowerHandler extends PaxosLenses with BackdownAgent

    Permalink
  48. case class SelfAckOrNack(response: AcceptResponse, acceptResponses: SortedMap[Identifier, AcceptResponsesAndTimeout]) extends Product with Serializable

    Permalink
  49. case class ServerResponse(id: Long, response: Option[AnyRef]) extends Product with Serializable

    Permalink

    id

    The id of the ClientRequestCommandValue being responded to.

    response

    The

  50. trait UnhandledHandler extends AnyRef

    Permalink

Value Members

  1. object AcceptResponseHandler

    Permalink
  2. object Box

    Permalink
  3. object CheckTimeout extends PaxosMessage with Product with Serializable

    Permalink

    Scheduled message used to trigger timeout work.

  4. object ClientCommandHandler

    Permalink
  5. object Commit extends Serializable

    Permalink
  6. object CommitHandler

    Permalink
  7. object Follower extends PaxosRole with Product with Serializable

    Permalink
  8. object FollowerHandler

    Permalink
  9. object HeartBeat extends PaxosMessage with Product with Serializable

    Permalink

    Scheduled message use by a leader to heatbeat commit messages.

  10. object HighestCommittedIndex

    Permalink
  11. object Journal

    Permalink
  12. object Leader extends PaxosRole with Product with Serializable

    Permalink
  13. object NoOperationCommandValue extends CommandValue with Product with Serializable

    Permalink
  14. object Ordering

    Permalink
  15. object PaxosAlgorithm

    Permalink
  16. object PaxosData extends Serializable

    Permalink
  17. object PrepareResponseHandler

    Permalink
  18. object Progress extends Serializable

    Permalink
  19. object Recoverer extends PaxosRole with Product with Serializable

    Permalink
  20. object ResendHandler

    Permalink
  21. object RetransmitHandler

    Permalink
  22. object Vote

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped