public class Journal extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Journal.DataFileRemovedListener |
static class |
Journal.JournalDiskSyncStrategy |
static class |
Journal.PreallocationScope |
static class |
Journal.PreallocationStrategy |
static class |
Journal.WriteCommand |
static class |
Journal.WriteKey |
Constructor and Description |
---|
Journal() |
public static final String CALLER_BUFFER_APPENDER
public static final boolean callerBufferAppender
public static final int RECORD_HEAD_SPACE
public static final byte USER_RECORD_TYPE
public static final byte BATCH_CONTROL_RECORD_TYPE
public static final byte[] BATCH_CONTROL_RECORD_MAGIC
public static final int BATCH_CONTROL_RECORD_SIZE
public static final byte[] BATCH_CONTROL_RECORD_HEADER
public static final byte[] EMPTY_BATCH_CONTROL_RECORD
public static final int EOF_INT
public static final byte EOF_EOT
public static final byte[] EOF_RECORD
public static final String DEFAULT_DIRECTORY
public static final String DEFAULT_ARCHIVE_DIRECTORY
public static final String DEFAULT_FILE_PREFIX
public static final String DEFAULT_FILE_SUFFIX
public static final int DEFAULT_MAX_FILE_LENGTH
public static final int DEFAULT_CLEANUP_INTERVAL
public static final int DEFAULT_MAX_WRITE_BATCH_SIZE
protected final Map<Journal.WriteKey,Journal.WriteCommand> inflightWrites
protected File directoryArchive
protected String filePrefix
protected String fileSuffix
protected boolean started
protected int maxFileLength
protected int writeBatchSize
protected FileAppender appender
protected DataFileAccessorPool accessorPool
protected Map<File,DataFile> fileByFileMap
protected LinkedNodeList<DataFile> dataFiles
protected final AtomicReference<Location> lastAppendLocation
protected ScheduledFuture cleanupTask
protected AtomicLong totalLength
protected boolean archiveDataLogs
protected boolean checksum
protected boolean checkForCorruptionOnStartup
protected boolean enableAsyncDiskSync
protected Journal.PreallocationScope preallocationScope
protected Journal.PreallocationStrategy preallocationStrategy
protected Journal.JournalDiskSyncStrategy journalDiskSyncStrategy
public Journal()
public void corruptRecoveryLocation(Location recoveryPosition) throws IOException
IOException
public DataFileAccessorPool getAccessorPool()
public void allowIOResumption()
public void start() throws IOException
IOException
public void preallocateEntireJournalDataFile(RecoverableRandomAccessFile file)
public boolean isUnusedPreallocated(DataFile dataFile) throws IOException
IOException
protected Location recoveryCheck(DataFile dataFile) throws IOException
IOException
public long length()
public DataFile reserveDataFile()
public void close() throws IOException
IOException
public void cleanup()
public boolean delete() throws IOException
IOException
public void removeDataFiles(Set<Integer> files) throws IOException
IOException
public int getMaxFileLength()
public void setMaxFileLength(int maxFileLength)
maxFileLength
- the maxFileLength to setpublic Location getNextLocation(Location location) throws IOException, IllegalStateException
IOException
IllegalStateException
public Location getNextLocation(Location location, Location limit) throws IOException, IllegalStateException
IOException
IllegalStateException
public ByteSequence read(Location location) throws IOException, IllegalStateException
IOException
IllegalStateException
public Location write(ByteSequence data, boolean sync) throws IOException, IllegalStateException
IOException
IllegalStateException
public Location write(ByteSequence data, Runnable onComplete) throws IOException, IllegalStateException
IOException
IllegalStateException
public void update(Location location, ByteSequence data, boolean sync) throws IOException
IOException
public Journal.PreallocationStrategy getPreallocationStrategy()
public void setPreallocationStrategy(Journal.PreallocationStrategy preallocationStrategy)
public Journal.PreallocationScope getPreallocationScope()
public void setPreallocationScope(Journal.PreallocationScope preallocationScope)
public File getDirectory()
public void setDirectory(File directory)
public String getFilePrefix()
public void setFilePrefix(String filePrefix)
public Map<Journal.WriteKey,Journal.WriteCommand> getInflightWrites()
public Location getLastAppendLocation()
public void setLastAppendLocation(Location lastSyncedLocation)
public File getDirectoryArchive()
public void setDirectoryArchive(File directoryArchive)
public boolean isArchiveDataLogs()
public void setArchiveDataLogs(boolean archiveDataLogs)
public DataFile getDataFileById(int dataFileId)
public DataFile getCurrentDataFile(int capacity) throws IOException
IOException
public Integer getCurrentDataFileId()
public Set<File> getFiles()
public Map<Integer,DataFile> getFileMap()
public long getDiskSize()
public void setReplicationTarget(ReplicationTarget replicationTarget)
public ReplicationTarget getReplicationTarget()
public String getFileSuffix()
public void setFileSuffix(String fileSuffix)
public boolean isChecksum()
public void setChecksum(boolean checksumWrites)
public boolean isCheckForCorruptionOnStartup()
public void setCheckForCorruptionOnStartup(boolean checkForCorruptionOnStartup)
public void setWriteBatchSize(int writeBatchSize)
public int getWriteBatchSize()
public void setSizeAccumulator(AtomicLong storeSizeAccumulator)
public void setEnableAsyncDiskSync(boolean val)
public boolean isEnableAsyncDiskSync()
public Journal.JournalDiskSyncStrategy getJournalDiskSyncStrategy()
public void setJournalDiskSyncStrategy(Journal.JournalDiskSyncStrategy journalDiskSyncStrategy)
public boolean isJournalDiskSyncPeriodic()
public void setDataFileRemovedListener(Journal.DataFileRemovedListener dataFileRemovedListener)
Copyright © 2005–2019 The Apache Software Foundation. All rights reserved.