Class MemoryStoreRevisions

  • All Implemented Interfaces:
    Revisions

    public class MemoryStoreRevisions
    extends java.lang.Object
    implements Revisions
    This is a simple in memory Revisions implementation. It is non blocking and does not support any Revisions.Options.
    • Nested Class Summary

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void bind​(MemoryStore store)
      Bind this instance to a store.
      @NotNull RecordId getHead()
      Returns the record id of the head state.
      @NotNull RecordId getPersistedHead()
      Returns the persisted to disk record id of the head state.
      RecordId setHead​(@NotNull org.apache.jackrabbit.guava.common.base.Function<RecordId,​RecordId> newHead, @NotNull Revisions.Option... options)
      Not supported: throws UnsupportedOperationException
      boolean setHead​(@NotNull RecordId expected, @NotNull RecordId head, @NotNull Revisions.Option... options)
      Atomically set the record id of the current head state to the given head state if the current head state matches the expected value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MemoryStoreRevisions

        public MemoryStoreRevisions()
    • Method Detail

      • bind

        public void bind​(MemoryStore store)
                  throws java.io.IOException
        Bind this instance to a store.
        Throws:
        java.io.IOException
      • 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)
        Description copied from interface: Revisions
        Atomically set the record id of the current head state to the given head state if the current head state matches the expected value.

        All record ids must be valid ids for SegmentNodeStates.

        The locking behaviour of this method regarding implementation specific.

        Specified by:
        setHead in interface Revisions
        Parameters:
        expected - the expected head for the update to take place
        head - the new head to update to
        options - implementation specific options
        Returns:
        true if the current head was successfully updated, false otherwise.
      • 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
        Not supported: throws UnsupportedOperationException
        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.
        options - implementation specific options
        Returns:
        the record id of the root node if the current head was successfully updated, null otherwise.
        Throws:
        java.lang.UnsupportedOperationException - always
        java.lang.InterruptedException - Blocking implementations may throw this exception whe interrupted.