public class SegmentedJournal<E> extends Object implements Journal<E>
| Modifier and Type | Class and Description |
|---|---|
static class |
SegmentedJournal.Builder<E>
Segmented journal builder.
|
| Constructor and Description |
|---|
SegmentedJournal(String name,
StorageLevel storageLevel,
File directory,
io.atomix.utils.serializer.Serializer serializer,
int maxSegmentSize,
int maxEntriesPerSegment) |
| Modifier and Type | Method and Description |
|---|---|
static <E> SegmentedJournal.Builder<E> |
builder()
Returns a new segmented journal builder.
|
void |
close() |
void |
compact(long index)
Compacts the journal up to the given index.
|
File |
directory()
Returns the storage directory.
|
long |
getCompactableIndex(long index)
Returns the index of the last segment in the log.
|
boolean |
isCompactable(long index)
Returns a boolean indicating whether a segment can be removed from the journal prior to the given index.
|
boolean |
isOpen()
Returns a boolean indicating whether the journal is open.
|
int |
maxEntriesPerSegment()
Returns the maximum number of entries per segment.
|
int |
maxSegmentSize()
Returns the maximum journal segment size.
|
String |
name()
Returns the segment file name prefix.
|
SegmentedJournalReader<E> |
openReader(long index)
Opens a new journal reader.
|
StorageLevel |
storageLevel()
Returns the storage level.
|
SegmentedJournalWriter<E> |
writer()
Returns the journal writer.
|
public SegmentedJournal(String name, StorageLevel storageLevel, File directory, io.atomix.utils.serializer.Serializer serializer, int maxSegmentSize, int maxEntriesPerSegment)
public static <E> SegmentedJournal.Builder<E> builder()
public String name()
public File directory()
The storage directory is the directory to which all segments write files. Segment files
for multiple logs may be stored in the storage directory, and files for each log instance will be identified
by the prefix provided when the log is opened.
public StorageLevel storageLevel()
The storage level dictates how entries within individual journal segments should be stored.
public int maxSegmentSize()
The maximum segment size dictates the maximum size any segment in a segment may consume in bytes.
public int maxEntriesPerSegment()
The maximum entries per segment dictates the maximum number of entries that are allowed to be stored in any segment in a journal.
public SegmentedJournalWriter<E> writer()
Journalpublic SegmentedJournalReader<E> openReader(long index)
JournalopenReader in interface Journal<E>index - The index at which to start the reader.public boolean isOpen()
Journalpublic boolean isCompactable(long index)
index - the index from which to remove segmentspublic long getCompactableIndex(long index)
index - the compaction indexpublic void compact(long index)
The semantics of compaction are not specified by this interface.
index - The index up to which to compact the journal.Copyright © 2013–2018. All rights reserved.