public class OffHeapIndexingMessageStore extends java.lang.Object implements MessageStore
MessageStore that is storing messages off the heap and supports indexing of messages.
Implementation Hints:
| Constructor and Description |
|---|
OffHeapIndexingMessageStore(java.lang.String name) |
OffHeapIndexingMessageStore(java.lang.String name,
Indexer indexer) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(MessageStoreEntry entry)
Appends the specified element to the end of this list (optional
operation).
|
void |
close() |
java.util.Set<java.lang.String> |
getChannelNames()
Returns a set containing the channel names of the messages contained in the
MessageStore |
com.google.common.collect.ImmutableSet<Index> |
getIndexes() |
ChannelPosition |
getLatestChannelPosition(java.lang.String channelName)
Returns the latest
ChannelPosition of the given channel, derived from the messages contained in this
MessageStore. |
long |
size()
Returns the number of messages contained in the MessageStore.
|
java.util.stream.Stream<MessageStoreEntry> |
stream()
Returns a Stream of all entries contained in the MessageStore.
|
java.util.stream.Stream<MessageStoreEntry> |
stream(Index index,
java.lang.String value)
Returns a Stream of all entries contained in the MessageStore that have are matching the given Index value
(optional operation).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLatestChannelPosition, isCompactingpublic OffHeapIndexingMessageStore(java.lang.String name)
public OffHeapIndexingMessageStore(java.lang.String name,
Indexer indexer)
public java.util.Set<java.lang.String> getChannelNames()
MessageStoreMessageStoregetChannelNames in interface MessageStorepublic com.google.common.collect.ImmutableSet<Index> getIndexes()
getIndexes in interface MessageStorepublic ChannelPosition getLatestChannelPosition(java.lang.String channelName)
MessageStoreChannelPosition of the given channel, derived from the messages contained in this
MessageStore.
The position is calculated by merging the
optional positions of the messages.
Messages without positions will not change the latest ChannelPosition. If no message contains
position information, the returned ChannelPosition is ChannelPosition.fromHorizon()
getLatestChannelPosition in interface MessageStorechannelName - the name of the channelpublic java.util.stream.Stream<MessageStoreEntry> stream()
MessageStoreThe stream will maintain the insertion order of the entries.
stream in interface MessageStorepublic java.util.stream.Stream<MessageStoreEntry> stream(Index index, java.lang.String value)
MessageStoreThe stream will maintain the insertion order of the entries.
stream in interface MessageStoreindex - the Indexvalue - the value identifying the requested messages in the specified indexpublic void add(@Nonnull
MessageStoreEntry entry)
MessageStoreMessageStores that support this operation may place limitations on what
elements may be added to this list. In particular, some
stores will refuse to add entries for more than a single
channel. MessageStore
classes should clearly specify in their documentation any restrictions
on what elements may be added.
add in interface MessageStoreentry - element to be appended to this message storepublic long size()
MessageStorePrimarily used for testing purposes. If the MessageStore can not implement this without major performance impacts (like, for example, having to download and parse huge files from S3), the method is not required to be implemented.
size in interface MessageStorepublic void close()
close in interface MessageStoreclose in interface java.lang.AutoCloseable