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,org.apache.jena.dboe.transaction.txn.TransactionalComponent
public class TransBinaryDataFile
extends org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle<org.apache.jena.dboe.trans.data.TransBinaryDataFile.TxnBinFile>
implements org.apache.jena.dboe.base.file.BinaryDataFile
Transactional
BinaryDataFile.
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
org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle.ComponentState<X extends Object> -
Constructor Summary
ConstructorsConstructorDescriptionTransBinaryDataFile(org.apache.jena.dboe.base.file.BinaryDataFile binFile, org.apache.jena.dboe.transaction.txn.ComponentId cid, org.apache.jena.dboe.base.file.BufferChannel bufferChannel) Create a transactional BinaryDataFile over a base implementation. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclose()voidbooleanisEmpty()booleanisOpen()longlength()voidopen()intread(long posn, byte[] b, int start, int length) voidrecover(ByteBuffer ref) voidvoidsync()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, shutdownMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.jena.dboe.base.file.BinaryDataFile
read, write
-
Constructor Details
-
TransBinaryDataFile
public TransBinaryDataFile(org.apache.jena.dboe.base.file.BinaryDataFile binFile, org.apache.jena.dboe.transaction.txn.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 Details
-
startRecovery
public void startRecovery()- Specified by:
startRecoveryin interfaceorg.apache.jena.dboe.transaction.txn.TransactionalComponent- Specified by:
startRecoveryin classorg.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle<org.apache.jena.dboe.trans.data.TransBinaryDataFile.TxnBinFile>
-
recover
- Specified by:
recoverin interfaceorg.apache.jena.dboe.transaction.txn.TransactionalComponent- Specified by:
recoverin classorg.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle<org.apache.jena.dboe.trans.data.TransBinaryDataFile.TxnBinFile>
-
finishRecovery
public void finishRecovery()- Specified by:
finishRecoveryin interfaceorg.apache.jena.dboe.transaction.txn.TransactionalComponent- Specified by:
finishRecoveryin classorg.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle<org.apache.jena.dboe.trans.data.TransBinaryDataFile.TxnBinFile>
-
cleanStart
public void cleanStart()- Specified by:
cleanStartin interfaceorg.apache.jena.dboe.transaction.txn.TransactionalComponent
-
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
-