public class RocksDBSegmentLogStorage extends RocksDBLogStorage
| Modifier and Type | Class and Description |
|---|---|
static class |
RocksDBSegmentLogStorage.BarrierWriteContext |
static class |
RocksDBSegmentLogStorage.Builder
RocksDBSegmentLogStorage builder
|
RocksDBLogStorage.EmptyWriteContext, RocksDBLogStorage.WriteContextDescriber.DefaultPrinter, Describer.PrinterFIRST_LOG_IDX_KEY, PART_ROCKSDB_OPTIONS_KEY| Constructor and Description |
|---|
RocksDBSegmentLogStorage(String path,
RaftOptions raftOptions) |
RocksDBSegmentLogStorage(String path,
RaftOptions raftOptions,
int valueSizeThreshold,
int maxSegmentFileSize) |
RocksDBSegmentLogStorage(String path,
RaftOptions raftOptions,
int valueSizeThreshold,
int maxSegmentFileSize,
int preAllocateSegmentCount,
int keepInMemorySegmentCount,
int checkpointIntervalMs,
ThreadPoolExecutor writeExecutor) |
| Modifier and Type | Method and Description |
|---|---|
static RocksDBSegmentLogStorage.Builder |
builder(String uri,
RaftOptions raftOptions)
Creates a RocksDBSegmentLogStorage builder.
|
SegmentFile |
getLastSegmentFileForRead() |
protected RocksDBLogStorage.WriteContext |
newWriteContext() |
protected byte[] |
onDataAppend(long logIndex,
byte[] value,
RocksDBLogStorage.WriteContext ctx)
Called before appending data entry.
|
protected byte[] |
onDataGet(long logIndex,
byte[] value)
Called after getting data from rocksdb.
|
protected boolean |
onInitLoaded()
Called after opening RocksDB and loading configuration into conf manager.
|
protected void |
onReset(long nextLogIndex)
Called after resetting db.
|
protected void |
onShutdown()
Called after closing db.
|
protected void |
onSync()
Called when sync data into file system.
|
protected void |
onTruncatePrefix(long startIndex,
long firstIndexKept)
Called after truncating prefix logs in rocksdb.
|
protected void |
onTruncateSuffix(long lastIndexKept)
Called after truncating suffix logs in rocksdb.
|
appendEntries, appendEntry, describe, getEntry, getFirstLogIndex, getKeyBytes, getLastLogIndex, getTerm, getValueFromRocksDB, init, isSync, reset, shutdown, truncatePrefix, truncateSuffixpublic RocksDBSegmentLogStorage(String path, RaftOptions raftOptions)
public RocksDBSegmentLogStorage(String path, RaftOptions raftOptions, int valueSizeThreshold, int maxSegmentFileSize)
public RocksDBSegmentLogStorage(String path, RaftOptions raftOptions, int valueSizeThreshold, int maxSegmentFileSize, int preAllocateSegmentCount, int keepInMemorySegmentCount, int checkpointIntervalMs, ThreadPoolExecutor writeExecutor)
public static final RocksDBSegmentLogStorage.Builder builder(String uri, RaftOptions raftOptions)
protected void onSync()
throws IOException,
InterruptedException
RocksDBLogStorageonSync in class RocksDBLogStorageIOExceptionInterruptedExceptionprotected boolean onInitLoaded()
RocksDBLogStorageonInitLoaded in class RocksDBLogStorageprotected void onShutdown()
RocksDBLogStorageonShutdown in class RocksDBLogStoragepublic SegmentFile getLastSegmentFileForRead() throws IOException, InterruptedException
IOExceptionInterruptedExceptionprotected void onReset(long nextLogIndex)
RocksDBLogStorageonReset in class RocksDBLogStoragenextLogIndex - next log indexprotected void onTruncatePrefix(long startIndex,
long firstIndexKept)
throws org.rocksdb.RocksDBException,
IOException
RocksDBLogStorageonTruncatePrefix in class RocksDBLogStoragestartIndex - the start indexfirstIndexKept - the first index to keptorg.rocksdb.RocksDBExceptionIOExceptionprotected void onTruncateSuffix(long lastIndexKept)
throws org.rocksdb.RocksDBException,
IOException
RocksDBLogStorageonTruncateSuffix in class RocksDBLogStoragelastIndexKept - the last index to keptorg.rocksdb.RocksDBExceptionIOExceptionprotected RocksDBLogStorage.WriteContext newWriteContext()
newWriteContext in class RocksDBLogStorageprotected byte[] onDataAppend(long logIndex,
byte[] value,
RocksDBLogStorage.WriteContext ctx)
throws IOException,
InterruptedException
RocksDBLogStorageonDataAppend in class RocksDBLogStoragelogIndex - the log indexvalue - the data value in log entry.IOExceptionInterruptedExceptionprotected byte[] onDataGet(long logIndex,
byte[] value)
throws IOException
RocksDBLogStorageonDataGet in class RocksDBLogStoragelogIndex - the log indexvalue - the value in rocksdbIOExceptionCopyright © 2024. All rights reserved.