-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classLog.Companion
-
Field Summary
Fields Modifier and Type Field Description private final Longcreatedprivate volatile BooleanisClosingprivate Integeridentityprivate final LogTiptipprivate final IntegercachePageSizeprivate final LongfileLengthBoundprivate final Stringlocationprivate final LongnumberOfFilesprivate final LongArrayallFileAddressesprivate final LonghighAddressprivate final LongwrittenHighAddressprivate final LonglowAddressprivate final LonghighFileAddressprivate final LongdiskUsageprivate final FloatcacheHitRateprivate final LogConfigconfig
-
Method Summary
Modifier and Type Method Description final LonggetCreated()final BooleangetIsClosing()final UnitsetIsClosing(Boolean isClosing)final IntegergetIdentity()final UnitsetIdentity(Integer identity)final LogTipgetTip()final IntegergetCachePageSize()Size of single page in log cache. final LonggetFileLengthBound()Size of a single file of the log in bytes. final StringgetLocation()final LonggetNumberOfFiles()final LongArraygetAllFileAddresses()final LonggetHighAddress()final LonggetWrittenHighAddress()final LonggetLowAddress()final LonggetHighFileAddress()final LonggetDiskUsage()final FloatgetCacheHitRate()final LogConfiggetConfig()final LogTipsetHighAddress(LogTip logTip, Long highAddress)final LogTipsetHighAddress(LogTip logTip, Long highAddress, BlockSet.Mutable blockSet)final LogTipbeginWrite()final UnitabortWrite()final UnitrevertWrite(LogTip logTip)final LogTipendWrite()final LogTipcompareAndSetTip(LogTip logTip, LogTip updatedTip)final LonggetFileAddress(Long address)final LonggetNextFileAddress(Long fileAddress)final BooleanisLastFileAddress(Long address, LogTip logTip)final BooleanisLastWrittenFileAddress(Long address)final BooleanhasAddress(Long address)final BooleanhasAddressRange(Long from, Long to)final LonggetFileSize(Long fileAddress, LogTip logTip)final LonggetFileSize(Long fileAddress)final ByteArraygetHighPage(Long alignedAddress)final ByteArraygetCachedPage(Long pageAddress)final UnitaddBlockListener(BlockListener listener)final UnitaddReadBytesListener(ReadBytesListener listener)final RandomAccessLoggableread(Long address)Reads a random access loggable by specified address in the log. final RandomAccessLoggableread(ByteIteratorWithAddress it, Long address)final RandomAccessLoggableread(ByteIteratorWithAddress it)final BytegetWrittenLoggableType(Long address, Byte max)final RandomAccessLoggablereadNotNull(ByteIteratorWithAddress it, Long address)Just like . final LoggableIteratorgetLoggableIterator(Long startAddress)final LongtryWrite(Byte type, Integer structureId, ByteIterable data)final Longwrite(Loggable loggable)Writes a loggable to the end of the log padding the log with nulls if necessary. final Longwrite(Byte type, Integer structureId, ByteIterable data)final LoggablegetFirstLoggableOfType(Integer type)Returns the first loggable in the log of specified type. final LoggablegetLastLoggableOfType(Integer type)Returns the last loggable in the log of specified type. final LoggablegetLastLoggableOfTypeBefore(Integer type, Long beforeAddress, LogTip logTip)Returns the last loggable in the log of specified type which address is less than beforeAddress. final BooleanisImmutableFile(Long fileAddress)final Unitflush(Boolean forceSync)final Unitflush()final Unitsync()Unitclose()final Unitrelease()final LogTipclear()final UnitforgetFile(Long address)final UnitforgetFiles(LongArray files)final UnitremoveFile(Long address, RemoveBlockType rbt, BlockSet.Mutable blockSetMutable)final UnitremoveFile(Long address, RemoveBlockType rbt)final UnitremoveFile(Long address)final BufferedDataWriterensureWriter()final UnitclearFileFromLogCache(Long address, Long offset)final UnitpadWithNulls()Pad current file with null loggables. final UnitdoPadWithNulls()final IntegerreadBytes(ByteArray output, Long address)final DataIteratorreadIteratorFrom(Long address)Returns iterator which reads raw bytes of the log starting from specified address. final LonggetHighPageAddress(Long highAddress)final LongwriteContinuously(Loggable loggable)Writes specified loggable continuously in a single file. final LongwriteContinuously(Byte type, Integer structureId, ByteIterable data)final LongwriteContinuously(ByteArray data, Integer count)final UnitsetLogTestConfig(LogTestConfig testConfig)Sets LogTestConfig. -
-
Constructor Detail
-
Log
Log(LogConfig config)
-
-
Method Detail
-
getCreated
final Long getCreated()
-
getIsClosing
final Boolean getIsClosing()
-
setIsClosing
final Unit setIsClosing(Boolean isClosing)
-
getIdentity
final Integer getIdentity()
-
setIdentity
final Unit setIdentity(Integer identity)
-
getCachePageSize
final Integer getCachePageSize()
Size of single page in log cache.
-
getFileLengthBound
final Long getFileLengthBound()
Size of a single file of the log in bytes.
-
getLocation
final String getLocation()
-
getNumberOfFiles
final Long getNumberOfFiles()
-
getAllFileAddresses
final LongArray getAllFileAddresses()
-
getHighAddress
final Long getHighAddress()
-
getWrittenHighAddress
final Long getWrittenHighAddress()
-
getLowAddress
final Long getLowAddress()
-
getHighFileAddress
final Long getHighFileAddress()
-
getDiskUsage
final Long getDiskUsage()
-
getCacheHitRate
final Float getCacheHitRate()
-
setHighAddress
final LogTip setHighAddress(LogTip logTip, Long highAddress)
-
setHighAddress
final LogTip setHighAddress(LogTip logTip, Long highAddress, BlockSet.Mutable blockSet)
-
beginWrite
final LogTip beginWrite()
-
abortWrite
final Unit abortWrite()
-
revertWrite
final Unit revertWrite(LogTip logTip)
-
compareAndSetTip
final LogTip compareAndSetTip(LogTip logTip, LogTip updatedTip)
-
getFileAddress
final Long getFileAddress(Long address)
-
getNextFileAddress
final Long getNextFileAddress(Long fileAddress)
-
isLastFileAddress
final Boolean isLastFileAddress(Long address, LogTip logTip)
-
isLastWrittenFileAddress
final Boolean isLastWrittenFileAddress(Long address)
-
hasAddress
final Boolean hasAddress(Long address)
-
hasAddressRange
final Boolean hasAddressRange(Long from, Long to)
-
getFileSize
@JvmOverloads() final Long getFileSize(Long fileAddress, LogTip logTip)
-
getFileSize
@JvmOverloads() final Long getFileSize(Long fileAddress)
-
getHighPage
final ByteArray getHighPage(Long alignedAddress)
-
getCachedPage
final ByteArray getCachedPage(Long pageAddress)
-
addBlockListener
final Unit addBlockListener(BlockListener listener)
-
addReadBytesListener
final Unit addReadBytesListener(ReadBytesListener listener)
-
read
final RandomAccessLoggable read(Long address)
Reads a random access loggable by specified address in the log.
- Parameters:
address-location of a loggable in the log.
-
read
@JvmOverloads() final RandomAccessLoggable read(ByteIteratorWithAddress it, Long address)
-
read
@JvmOverloads() final RandomAccessLoggable read(ByteIteratorWithAddress it)
-
getWrittenLoggableType
final Byte getWrittenLoggableType(Long address, Byte max)
-
readNotNull
final RandomAccessLoggable readNotNull(ByteIteratorWithAddress it, Long address)
Just like .read reads loggable which never can be a NullLoggable.
-
getLoggableIterator
final LoggableIterator getLoggableIterator(Long startAddress)
-
write
final Long write(Loggable loggable)
Writes a loggable to the end of the log padding the log with nulls if necessary. So auto-alignment guarantees the loggable to be placed in a single file.
- Parameters:
loggable-loggable to write.
-
getFirstLoggableOfType
final Loggable getFirstLoggableOfType(Integer type)
Returns the first loggable in the log of specified type.
- Parameters:
type- type of loggable.
-
getLastLoggableOfType
final Loggable getLastLoggableOfType(Integer type)
Returns the last loggable in the log of specified type.
- Parameters:
type- type of loggable.
-
getLastLoggableOfTypeBefore
final Loggable getLastLoggableOfTypeBefore(Integer type, Long beforeAddress, LogTip logTip)
Returns the last loggable in the log of specified type which address is less than beforeAddress.
- Parameters:
type- type of loggable.
-
isImmutableFile
final Boolean isImmutableFile(Long fileAddress)
-
flush
@JvmOverloads() final Unit flush(Boolean forceSync)
-
flush
@JvmOverloads() final Unit flush()
-
forgetFile
@Deprecated(message = for tests only) final Unit forgetFile(Long address)
-
forgetFiles
final Unit forgetFiles(LongArray files)
-
removeFile
@JvmOverloads() final Unit removeFile(Long address, RemoveBlockType rbt, BlockSet.Mutable blockSetMutable)
-
removeFile
@JvmOverloads() final Unit removeFile(Long address, RemoveBlockType rbt)
-
removeFile
@JvmOverloads() final Unit removeFile(Long address)
-
ensureWriter
final BufferedDataWriter ensureWriter()
-
clearFileFromLogCache
final Unit clearFileFromLogCache(Long address, Long offset)
-
padWithNulls
final Unit padWithNulls()
Pad current file with null loggables. Null loggable takes only one byte in the log, so each file of the log with arbitrary alignment can be padded with nulls. Padding with nulls is automatically performed when a loggable to be written can't be placed within the appendable file without overcome of the value of fileLengthBound. This feature allows to guarantee that each file starts with a new loggable, no loggable can begin in one file and end in another. Also, this simplifies reading algorithm: if we started reading by address it definitely should finish within current file.
-
doPadWithNulls
final Unit doPadWithNulls()
-
readIteratorFrom
final DataIterator readIteratorFrom(Long address)
Returns iterator which reads raw bytes of the log starting from specified address.
-
getHighPageAddress
final Long getHighPageAddress(Long highAddress)
-
writeContinuously
final Long writeContinuously(Loggable loggable)
Writes specified loggable continuously in a single file.
- Parameters:
loggable- the loggable to write.
-
writeContinuously
final Long writeContinuously(Byte type, Integer structureId, ByteIterable data)
-
writeContinuously
final Long writeContinuously(ByteArray data, Integer count)
-
setLogTestConfig
@Deprecated(message = for tests only) final Unit setLogTestConfig(LogTestConfig testConfig)
Sets LogTestConfig. Is destined for tests only, please don't set a not-null value in application code.
-
-
-
-