Skip to content

Commit 72e17dc

Browse files
author
Unmesh Joshi
committed
Added PaxosLog implementation
1 parent 46fd29a commit 72e17dc

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/main/java/replicate/paxos/PaxosState.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import java.util.Optional;
66

7+
//this needs to be persisted.
78
public record PaxosState(
89
//Generation value to avoid concurrent updates
910
//Only the node with the highest generation will be

src/test/java/replicate/paxoslog/PaxosLogTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,14 @@ private LogBuildingResult buildMultiCommandLog() throws IOException {
120120
verifyLogConsistencyAcrossCluster(2, "After two basic commands");
121121

122122
// STEP 3: Failed CAS operation (existing value doesn't match)
123-
CompareAndSwapResult cas1 = executeCompareAndSwap("title", null, "Microservices", athens);
123+
CompareAndSwapResult cas1 = executeCompareAndSwap("title", null,
124+
"Microservices", athens);
124125
assertFalse("CAS should fail when expected value doesn't match", cas1.succeeded);
125126
assertEquals("CAS should return existing value", "Microservices", cas1.returnedValue);
126127

127128
// STEP 4: Successful CAS operation (existing value matches)
128-
CompareAndSwapResult cas2 = executeCompareAndSwap("title", "Microservices", "Event Driven Microservices", byzantium);
129+
CompareAndSwapResult cas2 = executeCompareAndSwap("title", "Microservices",
130+
"Event Driven Microservices", byzantium);
129131
assertTrue("CAS should succeed when expected value matches", cas2.succeeded);
130132
assertEquals("CAS should return previous value", "Microservices", cas2.returnedValue);
131133

0 commit comments

Comments
 (0)