public interface LogManager extends Lifecycle<LogManagerOptions>, Describer
| 限定符和类型 | 接口和说明 |
|---|---|
static interface |
LogManager.LastLogIndexListener
Listen on last log index change event, but it's not reliable,
the user should not count on this listener to receive all changed events.
|
static interface |
LogManager.NewLogCallback
New log notifier callback.
|
static class |
LogManager.StableClosure
Closure to to run in stable state.
|
Describer.DefaultPrinter, Describer.Printer| 限定符和类型 | 方法和说明 |
|---|---|
void |
addLastLogIndexListener(LogManager.LastLogIndexListener listener)
Adds a last log index listener
|
void |
appendEntries(List<LogEntry> entries,
LogManager.StableClosure done)
Append log entry vector and wait until it's stable (NOT COMMITTED!)
|
ConfigurationEntry |
checkAndSetConfiguration(ConfigurationEntry current)
Check if |current| should be updated to the latest configuration
Returns the latest configuration, otherwise null.
|
Status |
checkConsistency()
Check log consistency, returns the status
|
void |
clearBufferedLogs()
We don't delete all the logs before last snapshot to avoid installing
snapshot on slow replica.
|
ConfigurationEntry |
getConfiguration(long index)
Get the configuration at index.
|
LogEntry |
getEntry(long index)
Get the log entry at index.
|
long |
getFirstLogIndex()
Get the first log index of log
|
LogId |
getLastLogId(boolean isFlush)
Return the id the last log.
|
long |
getLastLogIndex()
Get the last log index of log
|
long |
getLastLogIndex(boolean isFlush)
Get the last log index of log
|
long |
getTerm(long index)
Get the log term at index.
|
void |
join()
Wait the log manager to be shut down.
|
void |
removeLastLogIndexListener(LogManager.LastLogIndexListener listener)
Remove the last log index listener.
|
boolean |
removeWaiter(long id)
Remove a waiter.
|
void |
setAppliedId(LogId appliedId)
Set the applied id, indicating that the log before applied_id (included)
can be dropped from memory logs.
|
void |
setSnapshot(RaftOutter.SnapshotMeta meta)
Notify the log manager about the latest snapshot, which indicates the
logs which can be safely truncated.
|
long |
wait(long expectedLastLogIndex,
LogManager.NewLogCallback cb,
Object arg)
Wait until there are more logs since |last_log_index| and |on_new_log|
would be called after there are new logs or error occurs, return the waiter id.
|
void addLastLogIndexListener(LogManager.LastLogIndexListener listener)
void removeLastLogIndexListener(LogManager.LastLogIndexListener listener)
void join() throws InterruptedException
InterruptedException - if the current thread is interrupted
while waitingvoid appendEntries(List<LogEntry> entries, LogManager.StableClosure done)
entries - log entriesdone - callbackvoid setSnapshot(RaftOutter.SnapshotMeta meta)
meta - snapshot metadatavoid clearBufferedLogs()
LogEntry getEntry(long index)
index - the index of log entryindexlong getTerm(long index)
index - the index of log entrylong getFirstLogIndex()
long getLastLogIndex()
long getLastLogIndex(boolean isFlush)
isFlush - whether to flush from disk.LogId getLastLogId(boolean isFlush)
isFlush - whether to flush all pending task.ConfigurationEntry getConfiguration(long index)
ConfigurationEntry checkAndSetConfiguration(ConfigurationEntry current)
long wait(long expectedLastLogIndex,
LogManager.NewLogCallback cb,
Object arg)
expectedLastLogIndex - expected last index of logcb - callbackarg - the waiter pass-in argumentboolean removeWaiter(long id)
id - waiter idvoid setAppliedId(LogId appliedId)
Status checkConsistency()
Copyright © 2021. All rights reserved.