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

    Constructors
    Constructor
    Description
    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.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
     
    void
     
    boolean
     
    boolean
     
    long
     
    void
     
    int
    read(long posn, byte[] b, int start, int length)
     
    void
     
    void
     
    void
     
    void
    truncate(long size)
    Truncate only supported for an abort - this transactional version of BinaryDataFile will not truncate to earlier than the committed length.
    long
    write(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

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods 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:
      startRecovery in interface org.apache.jena.dboe.transaction.txn.TransactionalComponent
      Specified by:
      startRecovery in class org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle<org.apache.jena.dboe.trans.data.TransBinaryDataFile.TxnBinFile>
    • recover

      public void recover(ByteBuffer ref)
      Specified by:
      recover in interface org.apache.jena.dboe.transaction.txn.TransactionalComponent
      Specified by:
      recover in class org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle<org.apache.jena.dboe.trans.data.TransBinaryDataFile.TxnBinFile>
    • finishRecovery

      public void finishRecovery()
      Specified by:
      finishRecovery in interface org.apache.jena.dboe.transaction.txn.TransactionalComponent
      Specified by:
      finishRecovery in class org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle<org.apache.jena.dboe.trans.data.TransBinaryDataFile.TxnBinFile>
    • cleanStart

      public void cleanStart()
      Specified by:
      cleanStart in interface org.apache.jena.dboe.transaction.txn.TransactionalComponent
    • open

      public void open()
      Specified by:
      open in interface org.apache.jena.dboe.base.file.BinaryDataFile
    • isOpen

      public boolean isOpen()
      Specified by:
      isOpen in interface org.apache.jena.dboe.base.file.BinaryDataFile
    • read

      public int read(long posn, byte[] b, int start, int length)
      Specified by:
      read in interface org.apache.jena.dboe.base.file.BinaryDataFile
    • write

      public long write(byte[] b, int start, int length)
      Specified by:
      write in interface org.apache.jena.dboe.base.file.BinaryDataFile
    • truncate

      public void truncate(long size)
      Truncate only supported for an abort - this transactional version of BinaryDataFile will not truncate to earlier than the committed length.
      Specified by:
      truncate in interface org.apache.jena.dboe.base.file.BinaryDataFile
    • sync

      public void sync()
      Specified by:
      sync in interface org.apache.jena.dboe.base.file.BinaryDataFile
      Specified by:
      sync in interface org.apache.jena.atlas.lib.Sync
    • close

      public void close()
      Specified by:
      close in interface org.apache.jena.dboe.base.file.BinaryDataFile
      Specified by:
      close in interface org.apache.jena.atlas.lib.Closeable
    • length

      public long length()
      Specified by:
      length in interface org.apache.jena.dboe.base.file.BinaryDataFile
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface org.apache.jena.dboe.base.file.BinaryDataFile