Class TarRevisions

    • Field Detail

      • EXPEDITE_OPTION

        public static final Revisions.Option EXPEDITE_OPTION
        Option to cause set head calls to be expedited. That is, cause them to skip the queue of any other callers waiting to complete that don't have this option specified.
      • INFINITY

        public static final Revisions.Option INFINITY
        Timeout option approximating no time out (Long.MAX_VALUE days).
    • Constructor Detail

      • TarRevisions

        public TarRevisions​(SegmentNodeStorePersistence persistence)
                     throws java.io.IOException
        Create a new instance placing the journal log file into the passed directory.
        Parameters:
        persistence - object representing the segment persistence
        Throws:
        java.io.IOException
    • Method Detail

      • timeout

        public static Revisions.Option timeout​(long time,
                                               java.util.concurrent.TimeUnit unit)
        Factory method for creating a timeout option.
      • getHead

        @NotNull
        public @NotNull RecordId getHead()
        Description copied from interface: Revisions
        Returns the record id of the head state. The returned id is a valid id for a SegmentNodeState.
        Specified by:
        getHead in interface Revisions
        Returns:
        id of the head state
      • getPersistedHead

        @NotNull
        public @NotNull RecordId getPersistedHead()
        Description copied from interface: Revisions
        Returns the persisted to disk record id of the head state. The returned id is a valid id for a SegmentNodeState.
        Specified by:
        getPersistedHead in interface Revisions
        Returns:
        id of the head state
      • setHead

        public boolean setHead​(@NotNull
                               @NotNull RecordId expected,
                               @NotNull
                               @NotNull RecordId head,
                               @NotNull
                               @NotNull Revisions.Option... options)
        This implementation blocks if a concurrent call to setHead(Function, Option...) is already in progress.
        Specified by:
        setHead in interface Revisions
        Parameters:
        options - zero or one expedite option for expediting this call
        expected - the expected head for the update to take place
        head - the new head to update to
        Returns:
        true if the current head was successfully updated, false otherwise.
        Throws:
        java.lang.IllegalArgumentException - on any non recognised option.
        See Also:
        EXPEDITE_OPTION
      • setHead

        public RecordId setHead​(@NotNull
                                @NotNull org.apache.jackrabbit.guava.common.base.Function<RecordId,​RecordId> newHead,
                                @NotNull
                                @NotNull Revisions.Option... options)
                         throws java.lang.InterruptedException
        This implementation blocks if a concurrent call is already in progress.
        Specified by:
        setHead in interface Revisions
        Parameters:
        newHead - function mapping an record id to the record id to which the current head id should be set. If it returns null the head remains unchanged and setHead returns false.
        options - zero or one timeout options specifying how long to block
        Returns:
        the record id of the root node if the current head was successfully updated, null otherwise.
        Throws:
        java.lang.InterruptedException
        java.lang.IllegalArgumentException - on any non recognised option.
        See Also:
        timeout(long, TimeUnit), INFINITY
      • close

        public void close()
                   throws java.io.IOException
        Close the underlying journal file.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException