public class LinkedCloudObject extends Object
Every object file has the following properties: epoch: writers epoch seqNumber: seq number for any given object file for a given epoch. Starts with 0. prevEpoch: epoch of the previous file prevSeqNumber: seq number of previous object file.
Approach: 1. On new leadership, we simply take the latest committed (epoch, seqNumber) file. The overall approach works on the fact that there can be redundant files due to zombie leaders but never inconsistent files. The latest committed file is used for restoring the last known state.
2. During fetch / read period there may be multiple redundant files hence are filtered out using back tracking the latest committed file via its previous object ref.
Constructor and Description |
---|
LinkedCloudObject() |
Modifier and Type | Method and Description |
---|---|
static List<SequencedObject> |
getOptimalChain(List<SequencedObject> objects)
For a given list of SequencedObject objects, filter based on lineage tracking from previous object details to
construct the optimal chain.
|
static Optional<SequencedObject> |
latestCommittedObject(List<SequencedObject> objects)
Get the last committed object from the object store.
|
public static List<SequencedObject> getOptimalChain(List<SequencedObject> objects)
Example snapshot: ((currentEpoch, currentSeqNumber), (previousEpoch, previousSeqNumber)) snapshot_1: ((0, 1), (0, 0)) snapshot_2: ((1, 0), (0, 0)) snapshot_3: ((1, 1), (1, 0)) snapshot_4: ((2, 0), (0, 1))
The optimal chain here would be (snapshot_4, snapshot_1) as snapshot_4 is the latest object and snapshot_4 is derived from snapshot_1
objects
- List of objects from which stale entry needs to be droppedpublic static Optional<SequencedObject> latestCommittedObject(List<SequencedObject> objects)