Package org.apache.jena.dboe.trans.data
Class TransBinaryDataFile
- java.lang.Object
-
- org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle<org.apache.jena.dboe.trans.data.TransBinaryDataFile.TxnBinFile>
-
- org.apache.jena.dboe.trans.data.TransBinaryDataFile
-
- All Implemented Interfaces:
org.apache.jena.atlas.lib.Closeable,org.apache.jena.atlas.lib.Sync,org.apache.jena.dboe.base.file.BinaryDataFile,TransactionalComponent
public class TransBinaryDataFile extends TransactionalComponentLifecycle<org.apache.jena.dboe.trans.data.TransBinaryDataFile.TxnBinFile> implements org.apache.jena.dboe.base.file.BinaryDataFile
TransactionalBinaryDataFile. A binary file that is append-only and allows only one writer at a time. All readers see the file up to the last commit point at the time they started. The sole writer sees more of the file.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle
TransactionalComponentLifecycle.ComponentState<X extends java.lang.Object>
-
-
Constructor Summary
Constructors Constructor Description TransBinaryDataFile(org.apache.jena.dboe.base.file.BinaryDataFile binFile, ComponentId cid, org.apache.jena.dboe.base.file.BufferChannel bufferChannel)Create a transactional BinaryDataFile over a base implementation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanStart()voidclose()voidfinishRecovery()booleanisEmpty()booleanisOpen()longlength()voidopen()intread(long posn, byte[] b, int start, int length)voidrecover(java.nio.ByteBuffer ref)voidstartRecovery()voidsync()voidtruncate(long size)Truncate only supported for an abort - this transactional version ofBinaryDataFilewill not truncate to earlier than the committed length.longwrite(byte[] b, int start, int length)-
Methods inherited from class org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle
abort, attach, begin, commit, commitEnd, commitPrepare, complete, detach, getComponentId, getComponentState, promote, setComponentState, shutdown
-
-
-
-
Constructor Detail
-
TransBinaryDataFile
public TransBinaryDataFile(org.apache.jena.dboe.base.file.BinaryDataFile binFile, ComponentId cid, org.apache.jena.dboe.base.file.BufferChannel bufferChannel)Create a transactional BinaryDataFile over a base implementation. The base file must provide thread-safe operation.
-
-
Method Detail
-
startRecovery
public void startRecovery()
- Specified by:
startRecoveryin interfaceTransactionalComponent- Specified by:
startRecoveryin classTransactionalComponentLifecycle<org.apache.jena.dboe.trans.data.TransBinaryDataFile.TxnBinFile>
-
recover
public void recover(java.nio.ByteBuffer ref)
- Specified by:
recoverin interfaceTransactionalComponent- Specified by:
recoverin classTransactionalComponentLifecycle<org.apache.jena.dboe.trans.data.TransBinaryDataFile.TxnBinFile>
-
finishRecovery
public void finishRecovery()
- Specified by:
finishRecoveryin interfaceTransactionalComponent- Specified by:
finishRecoveryin classTransactionalComponentLifecycle<org.apache.jena.dboe.trans.data.TransBinaryDataFile.TxnBinFile>
-
cleanStart
public void cleanStart()
- Specified by:
cleanStartin interfaceTransactionalComponent
-
open
public void open()
- Specified by:
openin interfaceorg.apache.jena.dboe.base.file.BinaryDataFile
-
isOpen
public boolean isOpen()
- Specified by:
isOpenin interfaceorg.apache.jena.dboe.base.file.BinaryDataFile
-
read
public int read(long posn, byte[] b, int start, int length)- Specified by:
readin interfaceorg.apache.jena.dboe.base.file.BinaryDataFile
-
write
public long write(byte[] b, int start, int length)- Specified by:
writein interfaceorg.apache.jena.dboe.base.file.BinaryDataFile
-
truncate
public void truncate(long size)
Truncate only supported for an abort - this transactional version ofBinaryDataFilewill not truncate to earlier than the committed length.- Specified by:
truncatein interfaceorg.apache.jena.dboe.base.file.BinaryDataFile
-
sync
public void sync()
- Specified by:
syncin interfaceorg.apache.jena.dboe.base.file.BinaryDataFile- Specified by:
syncin interfaceorg.apache.jena.atlas.lib.Sync
-
close
public void close()
- Specified by:
closein interfaceorg.apache.jena.dboe.base.file.BinaryDataFile- Specified by:
closein interfaceorg.apache.jena.atlas.lib.Closeable
-
length
public long length()
- Specified by:
lengthin interfaceorg.apache.jena.dboe.base.file.BinaryDataFile
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceorg.apache.jena.dboe.base.file.BinaryDataFile
-
-