Interface ReadOnlyTStore<T>

  • All Known Subinterfaces:
    TStore<T>
    All Known Implementing Classes:
    AgeOffStore, ReadOnlyStore, ZooStore

    public interface ReadOnlyTStore<T>
    Read only access to a Transaction Store. A transaction consists of a number of operations. Instances of this class may check on the queue of outstanding transactions but may neither modify them nor create new ones.
    • Method Detail

      • reserve

        long reserve()
        Reserve a transaction that is IN_PROGRESS or FAILED_IN_PROGRESS. Reserving a transaction id ensures that nothing else in-process interacting via the same instance will be operating on that transaction id.
        Returns:
        a transaction id that is safe to interact with, chosen by the store.
      • reserve

        void reserve​(long tid)
        Reserve the specific tid. Reserving a transaction id ensures that nothing else in-process interacting via the same instance will be operating on that transaction id.
      • unreserve

        void unreserve​(long tid,
                       long deferTime)
        Return the given transaction to the store. upon successful return the store now controls the referenced transaction id. caller should no longer interact with it.
        Parameters:
        tid - transaction id, previously reserved.
        deferTime - time in millis to keep this transaction out of the pool used in the reserve method. must be non-negative.
      • top

        ReadOnlyRepo<T> top​(long tid)
        Get the current operation for the given transaction id. Caller must have already reserved tid.
        Parameters:
        tid - transaction id, previously reserved.
        Returns:
        a read-only view of the operation
      • getStack

        List<ReadOnlyRepo<T>> getStack​(long tid)
        Get all operations on a transactions stack. Element 0 contains the most recent operation pushed or the top.
      • getStatus

        ReadOnlyTStore.TStatus getStatus​(long tid)
        Get the state of a given transaction. Caller must have already reserved tid.
        Parameters:
        tid - transaction id, previously reserved.
        Returns:
        execution status
      • waitForStatusChange

        ReadOnlyTStore.TStatus waitForStatusChange​(long tid,
                                                   EnumSet<ReadOnlyTStore.TStatus> expected)
        Wait for the status of a transaction to change
        Parameters:
        tid - transaction id, need not have been reserved.
        expected - a set of possible statuses we are interested in being notified about. may not be null.
        Returns:
        execution status.
      • getProperty

        Serializable getProperty​(long tid,
                                 String prop)
        Retrieve a transaction-specific property. Caller must have already reserved tid.
        Parameters:
        tid - transaction id, previously reserved.
        prop - name of property to retrieve.
      • list

        List<Long> list()
        list all transaction ids in store.
        Returns:
        all outstanding transactions, including those reserved by others.