Interface StagingResourceEventStore


public interface StagingResourceEventStore
A store for resource events that need to be committed before adding them to the store.
Since:
3.11.0
  • Method Details

    • getId

      String getId()
      Gets the id of this staging store.
      Returns:
      the id of this staging store.
    • store

      void store(Function<Consumer<ResourceEvent>,?> eventsProvider) throws TrsStoreException
      Stores staging events on this store.

      Implementations MUST store events without blocking the application, and must keep them hidden from the scope of the TrsStore.synchronizeResourceEvents() method up to the commit() method is called.

      The function argument provides access to change events to be added in this store. Implementation must call the apply() method of this function and use, as argument, a Consumer to get notified of events. Implementation is advised to use a BufferedConsumer for optimal performance.

      Parameters:
      eventsProvider - a function that provides access to change events to become part of the trs:ChangeLog.
      Throws:
      TrsStoreException - if events cannot be stored.
      See Also:
    • discard

      void discard() throws TrsStoreException
      Removes all the staging events stored by this instance.
      Throws:
      TrsStoreException - if events cannot be removed.
    • commit

      void commit() throws TrsStoreException
      Includes all the events stored by this instance in the scope of the TrsStore.synchronizeResourceEvents() method.
      Throws:
      TrsStoreException - if events cannot be moved to included in the scope.