Class CollectionMessageStore
java.lang.Object
io.fluxzero.sdk.persisting.search.client.CollectionMessageStore
- All Implemented Interfaces:
Monitored<List<SerializedMessage>>, HasMessageStore, MessageStore, AutoCloseable
A
MessageStore implementation backed by a collection in an InMemorySearchStore. This class provides
functionality for tracking updated documents in a specific collection.
Used to support HandleDocument from in-memory search stores.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend(List<SerializedMessage> messages) Appends a list of messages to the store.Retrieves a batch of messages starting from the givenminIndex.registerMonitor(Consumer<List<SerializedMessage>> monitor) Registers a monitor that will be notified when an activity of typeToccurs.scanBatch(Long minIndex, int maxSize, boolean inclusive, long maxBytes, Predicate<? super SerializedMessage> filter, boolean includeDocumentTombstones) Scans messages with optional document tombstones.voidsetRetentionTime(Duration retentionPeriod) Sets the retention period for messages.voidtruncate()Removes all messages from this store while keeping the logical log available for future appends.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface MessageStore
append, close, getBatch, getBatch, getBatch, getMessageStore, scanBatch, unwrap
-
Constructor Details
-
CollectionMessageStore
public CollectionMessageStore()
-
-
Method Details
-
getBatch
Description copied from interface:MessageStoreRetrieves a batch of messages starting from the givenminIndex.- Specified by:
getBatchin interfaceMessageStore- Parameters:
minIndex- minimum message index to start frommaxSize- maximum number of messages to retrieveinclusive- whether to include the message atminIndex- Returns:
- a list of
SerializedMessageinstances
-
scanBatch
public MessageStoreBatch scanBatch(Long minIndex, int maxSize, boolean inclusive, long maxBytes, Predicate<? super SerializedMessage> filter, boolean includeDocumentTombstones) Description copied from interface:MessageStoreScans messages with optional document tombstones. Stores that do not maintain typed graph tombstones retain their ordinary scan behavior.- Specified by:
scanBatchin interfaceMessageStore
-
registerMonitor
Description copied from interface:MonitoredRegisters a monitor that will be notified when an activity of typeToccurs.- Specified by:
registerMonitorin interfaceMonitored<List<SerializedMessage>>- Parameters:
monitor- the callback to invoke with each observed value- Returns:
- a
Registrationthat can be used to cancel the monitoring
-
append
Description copied from interface:MessageStoreAppends a list of messages to the store.- Specified by:
appendin interfaceMessageStore- Parameters:
messages- messages to append- Returns:
- a
CompletableFuturethat completes when the messages have been successfully appended
-
setRetentionTime
Description copied from interface:MessageStoreSets the retention period for messages. Messages older than this duration may be removed depending on the implementation.- Specified by:
setRetentionTimein interfaceMessageStore- Parameters:
retentionPeriod- duration to retain messages
-
truncate
public void truncate()Description copied from interface:MessageStoreRemoves all messages from this store while keeping the logical log available for future appends.- Specified by:
truncatein interfaceMessageStore
-