public abstract class AbstractReplicatedLogImpl extends Object implements ReplicatedLog
NO_MAX_SIZE| Modifier | Constructor and Description |
|---|---|
protected |
AbstractReplicatedLogImpl() |
protected |
AbstractReplicatedLogImpl(long snapshotIndex,
long snapshotTerm,
List<ReplicatedLogEntry> unAppliedEntries,
String logContext) |
| Modifier and Type | Method and Description |
|---|---|
protected int |
adjustedIndex(long logEntryIndex) |
boolean |
append(ReplicatedLogEntry replicatedLogEntry)
Appends an entry to the log.
|
void |
clear(int startIndex,
int endIndex)
Clears the journal entries with startIndex (inclusive) and endIndex (exclusive).
|
int |
dataSize()
Returns the size of the data in the log (in bytes).
|
ReplicatedLogEntry |
get(long logEntryIndex)
Return the replicated log entry at the specified index.
|
List<ReplicatedLogEntry> |
getFrom(long logEntryIndex)
Returns a list of log entries starting from the given index to the end of the log.
|
List<ReplicatedLogEntry> |
getFrom(long logEntryIndex,
int maxEntries,
long maxDataSize)
Returns a list of log entries starting from the given index up to the given maximum of entries or
the given maximum accumulated size, whichever comes first.
|
long |
getSnapshotIndex()
Returns the index of the snapshot.
|
long |
getSnapshotTerm()
Returns the term of the snapshot.
|
void |
increaseJournalLogCapacity(int amount)
Optimization method to increase the capacity of the journal log prior to appending entries.
|
boolean |
isInSnapshot(long logEntryIndex)
Checks if the entry is present in a snapshot.
|
boolean |
isPresent(long logEntryIndex)
Checks if the entry at the specified index is present or not.
|
ReplicatedLogEntry |
last()
Return the last replicated log entry in the log or null of not found.
|
long |
lastIndex()
Return the index of the last entry in the log or -1 if the log is empty.
|
long |
lastTerm()
Return the term of the last entry in the log or -1 if the log is empty.
|
long |
removeFrom(long logEntryIndex)
Removes entries from the in-memory log starting at the given index.
|
void |
setSnapshotIndex(long snapshotIndex)
Sets the snapshot index in the replicated log.
|
void |
setSnapshotTerm(long snapshotTerm)
Sets snapshot term.
|
long |
size()
Returns the number of entries in the journal.
|
void |
snapshotCommit()
Sets the Replicated log to state after snapshot success.
|
void |
snapshotPreCommit(long snapshotCapturedIndex,
long snapshotCapturedTerm)
Handles all the bookkeeping in order to perform a rollback in the event of SaveSnapshotFailure.
|
void |
snapshotRollback()
Restores the replicated log to a state in the event of a save snapshot failure.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitappendAndPersist, captureSnapshotIfReady, removeFromAndPersist, shouldCaptureSnapshotprotected AbstractReplicatedLogImpl(long snapshotIndex,
long snapshotTerm,
List<ReplicatedLogEntry> unAppliedEntries,
String logContext)
protected AbstractReplicatedLogImpl()
protected int adjustedIndex(long logEntryIndex)
public ReplicatedLogEntry get(long logEntryIndex)
ReplicatedLogget in interface ReplicatedLoglogEntryIndex - the index of the log entrypublic ReplicatedLogEntry last()
ReplicatedLoglast in interface ReplicatedLogpublic long lastIndex()
ReplicatedLoglastIndex in interface ReplicatedLogpublic long lastTerm()
ReplicatedLoglastTerm in interface ReplicatedLogpublic long removeFrom(long logEntryIndex)
ReplicatedLogremoveFrom in interface ReplicatedLoglogEntryIndex - the index of the first log entry to removepublic boolean append(ReplicatedLogEntry replicatedLogEntry)
ReplicatedLogappend in interface ReplicatedLogreplicatedLogEntry - the entry to appendpublic void increaseJournalLogCapacity(int amount)
ReplicatedLogincreaseJournalLogCapacity in interface ReplicatedLogamount - the amount to increase bypublic List<ReplicatedLogEntry> getFrom(long logEntryIndex)
ReplicatedLoggetFrom in interface ReplicatedLoglogEntryIndex - the index of the first log entry to get.public List<ReplicatedLogEntry> getFrom(long logEntryIndex, int maxEntries, long maxDataSize)
ReplicatedLoggetFrom in interface ReplicatedLoglogEntryIndex - the index of the first log entry to getmaxEntries - the maximum number of entries to getmaxDataSize - the maximum accumulated size of the log entries to getpublic long size()
ReplicatedLogsize in interface ReplicatedLogpublic int dataSize()
ReplicatedLogdataSize in interface ReplicatedLogpublic boolean isPresent(long logEntryIndex)
ReplicatedLogisPresent in interface ReplicatedLoglogEntryIndex - the index of the log entrypublic boolean isInSnapshot(long logEntryIndex)
ReplicatedLogisInSnapshot in interface ReplicatedLoglogEntryIndex - the index of the log entrypublic long getSnapshotIndex()
ReplicatedLoggetSnapshotIndex in interface ReplicatedLogpublic long getSnapshotTerm()
ReplicatedLoggetSnapshotTerm in interface ReplicatedLogpublic void setSnapshotIndex(long snapshotIndex)
ReplicatedLogsetSnapshotIndex in interface ReplicatedLogsnapshotIndex - the index to setpublic void setSnapshotTerm(long snapshotTerm)
ReplicatedLogsetSnapshotTerm in interface ReplicatedLogsnapshotTerm - the term to setpublic void clear(int startIndex,
int endIndex)
ReplicatedLogclear in interface ReplicatedLogstartIndex - the start index (inclusive)endIndex - the end index (exclusive)public void snapshotPreCommit(long snapshotCapturedIndex,
long snapshotCapturedTerm)
ReplicatedLogsnapshotPreCommit in interface ReplicatedLogsnapshotCapturedIndex - the new snapshot indexsnapshotCapturedTerm - the new snapshot termpublic void snapshotCommit()
ReplicatedLogsnapshotCommit in interface ReplicatedLogpublic void snapshotRollback()
ReplicatedLogsnapshotRollback in interface ReplicatedLogCopyright © 2019 OpenDaylight. All rights reserved.