public final class Log
extends java.lang.Object
implements java.io.Closeable
| Modifier and Type | Method and Description |
|---|---|
void |
abortWrite() |
void |
addNewFileListener(@NotNull NewFileListener listener) |
void |
addReadBytesListener(@NotNull ReadBytesListener listener) |
LogTip |
beginWrite() |
LogTip |
clear() |
void |
close() |
LogTip |
compareAndSetTip(LogTip logTip,
LogTip updatedTip) |
LogTip |
endWrite() |
@NotNull BufferedDataWriter |
ensureWriter() |
void |
flush() |
void |
flush(boolean forceSync) |
void |
forgetFile(long address) |
void |
forgetFiles(long[] files) |
long[] |
getAllFileAddresses()
Returns addresses of log files from the newest to the oldest ones.
|
byte[] |
getCachedPage(long pageAddress) |
float |
getCacheHitRate() |
int |
getCachePageSize() |
@NotNull LogConfig |
getConfig() |
long |
getCreated() |
long |
getDiskUsage() |
long |
getFileAddress(long address) |
long |
getFileLengthBound() |
jetbrains.exodus.core.dataStructures.hash.LongIterator |
getFilesFrom(LogTip logTip,
java.lang.Long fileAddress) |
long |
getFileSize(long fileAddress) |
long |
getFileSize(long fileAddress,
LogTip logTip) |
@Nullable Loggable |
getFirstLoggableOfType(int type)
Returns the first loggable in the log of specified type.
|
long |
getHighAddress() |
long |
getHighFileAddress() |
long |
getHighPageAddress(long highAddress) |
int |
getIdentity() |
@Nullable Loggable |
getLastLoggableOfType(int type)
Returns the last loggable in the log of specified type.
|
Loggable |
getLastLoggableOfTypeBefore(int type,
long beforeAddress,
LogTip logTip)
Returns the last loggable in the log of specified type which address is less than beforeAddress.
|
@NotNull java.lang.String |
getLocation() |
LoggableIterator |
getLoggableIterator(long startAddress) |
long |
getLowAddress() |
long |
getNextFileAddress(long fileAddress) |
long |
getNumberOfFiles() |
LogTip |
getTip() |
long |
getWrittenHighAddress() |
byte |
getWrittenLoggableType(long address,
byte max) |
boolean |
hasAddress(long address) |
boolean |
hasAddressRange(long from,
long to) |
static void |
invalidateSharedCache()
For tests only!!!
|
boolean |
isClosing() |
boolean |
isImmutableFile(long fileAddress) |
boolean |
isLastFileAddress(long address,
LogTip logTip) |
boolean |
isLastWrittenFileAddress(long address) |
void |
padWithNulls()
Pad current file with null loggables.
|
@NotNull RandomAccessLoggable |
read(DataIterator it) |
@NotNull RandomAccessLoggable |
read(DataIterator it,
long address) |
@NotNull RandomAccessLoggable |
read(long address)
Reads a random access loggable by specified address in the log.
|
@NotNull RandomAccessLoggable |
readNotNull(DataIterator it,
long address)
Just like read(DataIterator, long) reads loggable which never can be a NullLoggable.
|
void |
release() |
void |
removeFile(long address) |
void |
removeFile(long address,
@NotNull RemoveBlockType rbt) |
void |
removeFile(long address,
@NotNull RemoveBlockType rbt,
jetbrains.exodus.log.LogFileSet.Mutable logFileSetMutable) |
void |
revertWrite(LogTip logTip) |
LogTip |
setHighAddress(LogTip logTip,
long highAddress) |
LogTip |
setHighAddress(LogTip logTip,
long highAddress,
jetbrains.exodus.log.LogFileSet fileSet) |
void |
setLogTestConfig(@Nullable LogTestConfig testConfig)
Sets LogTestConfig.
|
void |
sync() |
long |
tryWrite(byte type,
int structureId,
jetbrains.exodus.ByteIterable data) |
long |
tryWrite(Loggable loggable)
Writes a loggable to the end of the log
If padding is needed, it is performed, but loggable is not written
|
long |
write(byte type,
int structureId,
jetbrains.exodus.ByteIterable data) |
long |
write(Loggable loggable)
Writes a loggable to the end of the log padding the log with nulls if necessary.
|
long |
writeContinuously(byte[] data,
int count) |
long |
writeContinuously(byte type,
int structureId,
jetbrains.exodus.ByteIterable data) |
long |
writeContinuously(Loggable loggable)
Writes specified loggable continuously in a single file.
|
public Log(@NotNull
@NotNull LogConfig config)
@NotNull public @NotNull LogConfig getConfig()
public long getCreated()
@NotNull public @NotNull java.lang.String getLocation()
public long getFileLengthBound()
public long getNumberOfFiles()
public long[] getAllFileAddresses()
public long getHighAddress()
public LogTip setHighAddress(LogTip logTip, long highAddress, jetbrains.exodus.log.LogFileSet fileSet)
public LogTip getTip()
public LogTip beginWrite()
public void abortWrite()
public void revertWrite(LogTip logTip)
public long getWrittenHighAddress()
public LogTip endWrite()
public long getLowAddress()
public long getFileAddress(long address)
public long getHighFileAddress()
public long getNextFileAddress(long fileAddress)
public boolean isLastFileAddress(long address,
LogTip logTip)
public boolean isLastWrittenFileAddress(long address)
public boolean hasAddress(long address)
public boolean hasAddressRange(long from,
long to)
public long getFileSize(long fileAddress)
public long getFileSize(long fileAddress,
LogTip logTip)
public long getDiskUsage()
public byte[] getCachedPage(long pageAddress)
public final int getCachePageSize()
public float getCacheHitRate()
public void addNewFileListener(@NotNull
@NotNull NewFileListener listener)
public void addReadBytesListener(@NotNull
@NotNull ReadBytesListener listener)
@NotNull public @NotNull RandomAccessLoggable read(long address)
address - - location of a loggable in the log.@NotNull public @NotNull RandomAccessLoggable read(DataIterator it)
public byte getWrittenLoggableType(long address,
byte max)
@NotNull public @NotNull RandomAccessLoggable read(DataIterator it, long address)
@NotNull public @NotNull RandomAccessLoggable readNotNull(DataIterator it, long address)
public LoggableIterator getLoggableIterator(long startAddress)
public long tryWrite(Loggable loggable)
loggable - - loggable to write.public long tryWrite(byte type,
int structureId,
jetbrains.exodus.ByteIterable data)
public long write(Loggable loggable)
loggable - - loggable to write.public long write(byte type,
int structureId,
jetbrains.exodus.ByteIterable data)
@Nullable public @Nullable Loggable getFirstLoggableOfType(int type)
type - type of loggable.@Nullable public @Nullable Loggable getLastLoggableOfType(int type)
type - type of loggable.public Loggable getLastLoggableOfTypeBefore(int type, long beforeAddress, LogTip logTip)
type - type of loggable.public boolean isImmutableFile(long fileAddress)
public void flush()
public void flush(boolean forceSync)
public void sync()
public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic boolean isClosing()
public void release()
public LogTip clear()
public void forgetFile(long address)
public void forgetFiles(long[] files)
public void removeFile(long address)
public void removeFile(long address,
@NotNull
@NotNull RemoveBlockType rbt)
public void removeFile(long address,
@NotNull
@NotNull RemoveBlockType rbt,
@Nullable
jetbrains.exodus.log.LogFileSet.Mutable logFileSetMutable)
@NotNull public @NotNull BufferedDataWriter ensureWriter()
public void padWithNulls()
public static void invalidateSharedCache()
public int getIdentity()
public long getHighPageAddress(long highAddress)
public jetbrains.exodus.core.dataStructures.hash.LongIterator getFilesFrom(LogTip logTip, java.lang.Long fileAddress)
public long writeContinuously(Loggable loggable)
loggable - the loggable to write.public long writeContinuously(byte type,
int structureId,
jetbrains.exodus.ByteIterable data)
public long writeContinuously(byte[] data,
int count)
public void setLogTestConfig(@Nullable
@Nullable LogTestConfig testConfig)