Class 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
    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.
    • 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

      • 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