Package com.sodius.oslc.server.trs.store
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 Summary
Modifier and TypeMethodDescriptionvoidcommit()Includes all the events stored by this instance in the scope of theTrsStore.synchronizeResourceEvents()method.voiddiscard()Removes all the staging events stored by this instance.getId()Gets the id of this staging store.voidstore(Function<Consumer<ResourceEvent>, ?> eventsProvider) Stores staging events on this store.
-
Method Details
-
getId
String getId()Gets the id of this staging store.- Returns:
- the id of this staging store.
-
store
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 thecommit()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, aConsumerto get notified of events. Implementation is advised to use aBufferedConsumerfor optimal performance.- Parameters:
eventsProvider- a function that provides access to change events to become part of thetrs:ChangeLog.- Throws:
TrsStoreException- if events cannot be stored.- See Also:
-
discard
Removes all the staging events stored by this instance.- Throws:
TrsStoreException- if events cannot be removed.
-
commit
Includes all the events stored by this instance in the scope of theTrsStore.synchronizeResourceEvents()method.- Throws:
TrsStoreException- if events cannot be moved to included in the scope.
-