public class SnapshotRegistry extends Object
Modifier and Type | Field and Description |
---|---|
static long |
LATEST_EPOCH |
Constructor and Description |
---|
SnapshotRegistry(org.apache.kafka.common.utils.LogContext logContext) |
Modifier and Type | Method and Description |
---|---|
void |
deleteSnapshot(long targetEpoch)
Deletes the snapshot with the given epoch.
|
void |
deleteSnapshot(org.apache.kafka.timeline.Snapshot snapshot)
Deletes the given snapshot.
|
void |
deleteSnapshotsUpTo(long targetEpoch)
Deletes all the snapshots up to the given epoch
|
List<Long> |
epochsList()
Returns a sorted list of snapshot epochs.
|
org.apache.kafka.timeline.Snapshot |
getOrCreateSnapshot(long epoch)
Creates a new snapshot at the given epoch.
|
org.apache.kafka.timeline.Snapshot |
getSnapshot(long epoch)
Gets the snapshot for a specific epoch.
|
boolean |
hasSnapshot(long epoch) |
Iterator<org.apache.kafka.timeline.Snapshot> |
iterator()
Returns a snapshot iterator that iterates from the snapshots with the
lowest epoch to those with the highest.
|
Iterator<org.apache.kafka.timeline.Snapshot> |
iterator(long epoch)
Returns a snapshot iterator that iterates from the snapshots with the
lowest epoch to those with the highest, starting at the snapshot with the
given epoch.
|
Iterator<org.apache.kafka.timeline.Snapshot> |
iterator(org.apache.kafka.timeline.Snapshot snapshot)
Returns a snapshot iterator that iterates from the snapshots with the
lowest epoch to those with the highest, starting at the given snapshot.
|
long |
latestEpoch()
Return the latest epoch.
|
void |
register(org.apache.kafka.timeline.Revertable revertable)
Associate a revertable with this registry.
|
void |
reset()
Delete all snapshots and resets all of the Revertable object registered.
|
Iterator<org.apache.kafka.timeline.Snapshot> |
reverseIterator()
Returns a reverse snapshot iterator that iterates from the snapshots with the
highest epoch to those with the lowest.
|
void |
revertToSnapshot(long targetEpoch)
Reverts the state of all data structures to the state at the given epoch.
|
public static final long LATEST_EPOCH
public SnapshotRegistry(org.apache.kafka.common.utils.LogContext logContext)
public Iterator<org.apache.kafka.timeline.Snapshot> iterator()
public Iterator<org.apache.kafka.timeline.Snapshot> iterator(long epoch)
public Iterator<org.apache.kafka.timeline.Snapshot> iterator(org.apache.kafka.timeline.Snapshot snapshot)
public Iterator<org.apache.kafka.timeline.Snapshot> reverseIterator()
public boolean hasSnapshot(long epoch)
public org.apache.kafka.timeline.Snapshot getSnapshot(long epoch)
public org.apache.kafka.timeline.Snapshot getOrCreateSnapshot(long epoch)
epoch
already exists and it is the last snapshot then just return that snapshot.epoch
- The epoch to create the snapshot at. The current epoch
will be advanced to one past this epoch.public void revertToSnapshot(long targetEpoch)
targetEpoch
- The epoch of the snapshot to revert to.public void deleteSnapshot(long targetEpoch)
targetEpoch
- The epoch of the snapshot to delete.public void deleteSnapshot(org.apache.kafka.timeline.Snapshot snapshot)
snapshot
- The snapshot to delete.public void deleteSnapshotsUpTo(long targetEpoch)
targetEpoch
- The epoch to delete up to.public long latestEpoch()
public void register(org.apache.kafka.timeline.Revertable revertable)
public void reset()