Interface TxnResourceApi

All Superinterfaces:
TxnComponent
All Known Implementing Classes:
TxnResourceApiReadUncommitted, TxnResourceApiSerializable

public interface TxnResourceApi extends TxnComponent
View over a resource w.r.t a transaction. This means that most methods such as declareAccess, undeclareAccess and isVisible are interpreted w.r.t. the underlying transaction.
Author:
raven
  • Method Details

    • getResourceKey

      Path<String> getResourceKey()
    • getTxnResourceLock

      ReadWriteLockWithOwnership getTxnResourceLock()
    • getLastModifiedDate

      Instant getLastModifiedDate() throws IOException
      The timestamp of the most recent modificaton to the resource
      Throws:
      IOException
    • declareAccess

      void declareAccess()
      Declare that the txn accessed the resource. Upon recovery the resource will be checked for any uncommitted changes.
    • undeclareAccess

      void undeclareAccess()
      Remove access declaration from the txn to this resource. Recovery related to this txn will not consider the resource.
    • isVisible

      boolean isVisible()
      Whether the resource is visible to the transaction
    • getFileSync

      FileSync getFileSync()
      A container to get/set the new content for the resource Once the transaction completes the old content will be replaced with the new one. On rollback, the new-but-uncommitted content will by discarded
    • lock

      default void lock(boolean write)
      Convenience short hand to lock the resource for this transaction
    • unlock

      default void unlock()
      Convenience short hand to unlock either lock