append(
abortedTxn: AbortedTxn): Unit
TransactionIndex
TransactionIndex
is a transaction index of a LogSegment.
TransactionIndex
is created when:
-
LogSegment
utility is used to open a log segment -
DumpLogSegments tool is used (to dump a transaction index (of a log segment))
Creating TransactionIndex Instance
TransactionIndex
takes the following to be created:
-
Underlying file (Java’s File)
TransactionIndex
initializes the internal properties.
While being created, TransactionIndex
opens a channel to the file if exists already.
append
Method
append
…FIXME
Note
|
|
truncateTo
Method
truncateTo(
offset: Long): Unit
truncateTo
…FIXME
Note
|
truncateTo is used when LogSegment is requested to truncate (to a given offset).
|
deleteIfExists
Method
deleteIfExists(): Boolean
deleteIfExists
…FIXME
Note
|
deleteIfExists is used when LogSegment is requested to deleteIfExists.
|
collectAbortedTxns
Method
collectAbortedTxns(
fetchOffset: Long,
upperBoundOffset: Long): TxnIndexSearchResult
collectAbortedTxns
…FIXME
Note
|
collectAbortedTxns is used when LogSegment is requested to collectAbortedTxns.
|
Opening FileChannel — openChannel
Internal Method
openChannel(): FileChannel
openChannel
uses Java’s FileChannel utility to open a file channel to the underlying file for read and write access (and creating a new file unless it exists already).
openChannel
registers the FileChannel
with the maybeChannel internal registry.
openChannel
sets the file position of the FileChannel
to be the very end of the file.
Note
|
openChannel is used when TransactionIndex is created (and the underlying file is available) and requested for the FileChannel.
|
channel
Internal Method
channel(): FileChannel
channel
takes the FileChannel
out from the maybeChannel internal registry (if available) or opens a new FileChannel.
Note
|
channel is used when TransactionIndex is requested to append and truncateTo.
|