https://github.com/ralgond/paxos
A Java implementation of Paxos algorithm
https://github.com/ralgond/paxos
consensus-algorithm java paxos strong-consistency
Last synced: 2 months ago
JSON representation
A Java implementation of Paxos algorithm
- Host: GitHub
- URL: https://github.com/ralgond/paxos
- Owner: ralgond
- License: mit
- Created: 2024-03-20T14:29:01.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-31T14:01:31.000Z (about 1 year ago)
- Last Synced: 2025-01-09T06:47:02.156Z (4 months ago)
- Topics: consensus-algorithm, java, paxos, strong-consistency
- Language: Java
- Homepage:
- Size: 165 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# paxos
A Java implementation of Paxos algorithm
[](https://codecov.io/github/ralgond/paxos)## Requirements
Java 22## Phases

### Phase 1
(a) A proposer selects a proposal number n and sends a prepare request with number n to a majority of acceptors.(b) If an acceptor receives a prepare request with number n greater than that of any prepare request to which it has
already responded, then it responds to the request with a promise not to accept any more proposals numbered less than n
and with the highest-numbered proposal (if any) that it has accepted.### Phase 2
(a) If the proposer receives a response to its prepare requests
(numbered n) from a majority of acceptors, then it sends an accept
request to each of those acceptors for a proposal numbered n with a
value v, where v is the value of the highest-numbered proposal among
the responses, or is any value if the responses reported no proposals.(b) If an acceptor receives an accept request for a proposal numbered
n, it accepts the proposal unless it has already responded to a prepare
request having a number greater than n.