Store.StoreReplayer| Modifier and Type | Field and Description |
|---|---|
protected int |
_cap |
protected PublishStore |
_fileStore |
protected int |
_lowWatermark |
protected MemoryPublishStore |
_memoryStore |
protected java.lang.String |
_path |
SOWDeleteByBookmark, SOWDeleteByBookmarkCancel, SOWDeleteByData, SOWDeleteByFilter, SOWDeleteByKeys| Constructor and Description |
|---|
HybridPublishStore(java.lang.String path,
int cap)
Constructor for the HybridPublishStore.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes both the memory store and the file store.
|
void |
discardUpTo(long index)
Discards data from both the disk store and memory store up to the specified
index.
|
void |
flush()
Flushes the memory store and, if necessary, the file store.
|
void |
flush(long timeout)
Flushes the memory store and, if necessary, the file store with a specified
timeout.
|
boolean |
getErrorOnPublishGap()
Get whether the Store will throw a PublishGapException from discardUpTo if the
sequence number being discarded is less then the current last persisted.
|
long |
getLastPersisted()
Gets the last persisted sequence number from the file store.
|
long |
getLowestUnpersisted()
Returns the lowest sequence number currently in the store.
|
void |
replay(Store.StoreReplayer replayer)
Replays messages using the provided replayer, ensuring no swapping occurs
during the replay process.
|
boolean |
replaySingle(Store.StoreReplayer replayer,
long index)
Replays a single message using the provided replayer and index.
|
void |
setErrorOnPublishGap(boolean errorOnGap)
Set whether the Store should throw a PublishGapException from discardUpTo if the
sequence number being discarded is less then the current last persisted.
|
void |
setLowWatermark(int lowWatermark_)
Sets the low watermark; once we start swapping out to disk, we
keep going until the number of entries in memory is lower than this.
|
void |
setMessage(Message m)
Sets a message in both the memory store and the disk store.
|
void |
setResizeHandler(PublishStoreResizeHandler handler)
Sets a resize handler for both the file store and the memory store.
|
void |
store(Message message)
Stores a message in the hybrid store, swapping to disk if memory usage
exceeds capacity.
|
long |
unpersistedCount()
Gets the count of unpersisted messages in both the disk store and memory
store
|
protected PublishStore _fileStore
protected MemoryPublishStore _memoryStore
protected int _cap
protected java.lang.String _path
protected int _lowWatermark
public HybridPublishStore(java.lang.String path,
int cap)
throws StoreException
path - The path for the disk-based storage.cap - The maximum number of messages that can be stored in memory. It
is an integer that defines how many messages the in-memory storage
component of the HybridPublishStore can hold before swapping excess
data out to disk.StoreException - Thrown when an operation fails with details of the
failure.public void setLowWatermark(int lowWatermark_)
lowWatermark_ - The number of entries to serve as a low watermark.public long getLowestUnpersisted()
getLowestUnpersisted in interface Storepublic void discardUpTo(long index)
throws StoreException
discardUpTo in interface Storeindex - The index up to which data should be discarded.StoreException - Thrown when an operation fails with details of the
failure.Store.discardUpTo(long)public void replay(Store.StoreReplayer replayer) throws StoreException, DisconnectedException
replay in interface Storereplayer - The replayer used to replay messages.StoreException - Thrown when an operation fails with details of
the failure.DisconnectedException - Thrown when the store is disconnected.Store.replay(com.crankuptheamps.client.Store.StoreReplayer)public boolean replaySingle(Store.StoreReplayer replayer, long index) throws StoreException, DisconnectedException
replaySingle in interface Storereplayer - The replayer used to replay the message.index - The index of the message to replay.StoreException - Thrown when an operation fails with details of
the failure.DisconnectedException - Thrown when the store is disconnected.Store.replaySingle(com.crankuptheamps.client.Store.StoreReplayer,
long)public long unpersistedCount()
unpersistedCount in interface StoreStore.unpersistedCount()public void store(Message message) throws StoreException
store in interface Storemessage - The message to store.StoreException - Thrown when an operation fails with details of the
failure.public void setMessage(Message m)
setMessage in interface Storem - The message to set.public long getLastPersisted()
throws StoreException
getLastPersisted in interface StoreStoreException - Thrown when an operation fails with details of the
failure.public void flush()
throws TimedOutException
flush in interface StoreTimedOutException - Thrown if the flush operation times out.public void flush(long timeout)
throws TimedOutException
flush in interface Storetimeout - The maximum time to wait for the flush operation to complete.TimedOutException - Thrown if the flush operation times out.public void setResizeHandler(PublishStoreResizeHandler handler)
setResizeHandler in interface Storehandler - The resize handler to set.public void close()
throws java.lang.Exception
close in interface java.lang.AutoCloseablejava.lang.Exception - Thrown if an error occurs during closure.public boolean getErrorOnPublishGap()
getErrorOnPublishGap in interface Storepublic void setErrorOnPublishGap(boolean errorOnGap)
setErrorOnPublishGap in interface StoreerrorOnGap - If true, an exception will be thrown during logon if a gap
could be created. If false, allow the logon to proceed.