Class BlockMgrJournal

java.lang.Object
org.apache.jena.tdb1.transaction.BlockMgrJournal
All Implemented Interfaces:
org.apache.jena.atlas.lib.Closeable, org.apache.jena.atlas.lib.Sync, BlockMgr, TransactionLifecycle

public class BlockMgrJournal extends Object implements BlockMgr, TransactionLifecycle
Block manager that keeps temporary copies of updated blocks, then writes them to a journal when commitPrepare happens. No work is done in commitEnact because the TransactionManager is responsible to writing the blocks to the main storage.
  • Constructor Details

  • Method Details

    • begin

      public void begin(Transaction txn)
      Description copied from interface: TransactionLifecycle
      Start an update transaction
      Specified by:
      begin in interface TransactionLifecycle
    • commitPrepare

      public void commitPrepare(Transaction txn)
      Description copied from interface: TransactionLifecycle
      Prepare to commit; end of active phase. Make changes safe; do not update the base data.
      Specified by:
      commitPrepare in interface TransactionLifecycle
    • committed

      public void committed(Transaction txn)
      Description copied from interface: TransactionLifecycle
      The commit has happened
      Specified by:
      committed in interface TransactionLifecycle
    • enactCommitted

      public void enactCommitted(Transaction txn)
      Description copied from interface: TransactionLifecycle
      Update the base data - called during journal flush.
      Specified by:
      enactCommitted in interface TransactionLifecycle
    • clearupCommitted

      public void clearupCommitted(Transaction txn)
      Description copied from interface: TransactionLifecycle
      All done - transaction committed and incorporated in the base dataset - can now tidy up - called during journal flush if commiting.
      Specified by:
      clearupCommitted in interface TransactionLifecycle
    • abort

      public void abort(Transaction txn)
      Description copied from interface: TransactionLifecycle
      End of active phase - will not be making these changes.
      Specified by:
      abort in interface TransactionLifecycle
    • allocate

      public Block allocate(int blockSize)
      Description copied from interface: BlockMgr
      Allocate an uninitialized block - writable - call only inside a update sequence. If blockSize is -1, means "default/fixed size" for this BlockMgr
      Specified by:
      allocate in interface BlockMgr
    • getRead

      public Block getRead(long id)
      Description copied from interface: BlockMgr
      Fetch a block, use for read only
      Specified by:
      getRead in interface BlockMgr
    • getReadIterator

      public Block getReadIterator(long id)
      Description copied from interface: BlockMgr
      Fetch a block, use for read only in an iterator
      Specified by:
      getReadIterator in interface BlockMgr
    • getWrite

      public Block getWrite(long id)
      Description copied from interface: BlockMgr
      Fetch a block, use for write and read - only inside "update"
      Specified by:
      getWrite in interface BlockMgr
    • promote

      public Block promote(Block block)
      Description copied from interface: BlockMgr
      Promote to writeable : it's OK to promote an already writeable block
      Specified by:
      promote in interface BlockMgr
    • release

      public void release(Block block)
      Description copied from interface: BlockMgr
      Release a block, unmodified.
      Specified by:
      release in interface BlockMgr
    • write

      public void write(Block block)
      Description copied from interface: BlockMgr
      Write a block back - it still needs releasing.
      Specified by:
      write in interface BlockMgr
    • overwrite

      public void overwrite(Block block)
      Description copied from interface: BlockMgr
      Replace the contents of a block slot with new contents. Block does not need releasing. The write() operation may not do real work if the block is mapped - this operation really does replace the contents with the new contents.
      Specified by:
      overwrite in interface BlockMgr
    • free

      public void free(Block block)
      Description copied from interface: BlockMgr
      Announce a block is no longer in use (i.e it's now freed)
      Specified by:
      free in interface BlockMgr
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: BlockMgr
      Answer whether there are any blocks in the collection being managed
      Specified by:
      isEmpty in interface BlockMgr
    • valid

      public boolean valid(int id)
      Description copied from interface: BlockMgr
      Is this a valid block id? (may be a free block)
      Specified by:
      valid in interface BlockMgr
    • close

      public void close()
      Description copied from interface: BlockMgr
      Close the block manager
      Specified by:
      close in interface BlockMgr
      Specified by:
      close in interface org.apache.jena.atlas.lib.Closeable
    • isClosed

      public boolean isClosed()
      Description copied from interface: BlockMgr
      Is this block manager still usable? Closed block managers can not perform any operations except this one.
      Specified by:
      isClosed in interface BlockMgr
    • sync

      public void sync()
      Description copied from interface: BlockMgr
      Sync the block manager
      Specified by:
      sync in interface BlockMgr
      Specified by:
      sync in interface org.apache.jena.atlas.lib.Sync
    • syncForce

      public void syncForce()
      Description copied from interface: BlockMgr
      Sync the block manager : system operation to ensure sync() is passed down
      Specified by:
      syncForce in interface BlockMgr
    • beginUpdate

      public void beginUpdate()
      Description copied from interface: BlockMgr
      Start of update
      Specified by:
      beginUpdate in interface BlockMgr
    • endUpdate

      public void endUpdate()
      Description copied from interface: BlockMgr
      Completion of update
      Specified by:
      endUpdate in interface BlockMgr
    • beginRead

      public void beginRead()
      Description copied from interface: BlockMgr
      Start of read
      Specified by:
      beginRead in interface BlockMgr
    • endRead

      public void endRead()
      Description copied from interface: BlockMgr
      Completion of read
      Specified by:
      endRead in interface BlockMgr
    • beginIterator

      public void beginIterator(Iterator<?> iterator)
      Description copied from interface: BlockMgr
      Start of iterator
      Specified by:
      beginIterator in interface BlockMgr
    • endIterator

      public void endIterator(Iterator<?> iterator)
      Description copied from interface: BlockMgr
      Completion of iterator
      Specified by:
      endIterator in interface BlockMgr
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getLabel

      public String getLabel()
      Specified by:
      getLabel in interface BlockMgr