Handle class for StoreImpl classes that track publish messages.
More...
#include <ampsplusplus.hpp>
Handle class for StoreImpl classes that track publish messages.
void AMPS::Store::discardUpTo |
( |
amps_uint64_t |
index_ | ) |
|
|
inline |
Called by Client to indicate that all messages up to and including.
- Parameters
-
index_ | have been successfully published to the server and are no longer required to be in the store. |
- Exceptions
-
PublishStoreGapException | If index_ < getLastPersisted() which could leave a gap on the server of missing messages from this Client. |
void AMPS::Store::flush |
( |
long |
timeout_ = 0 | ) |
|
|
inline |
Method to wait for the Store to discard everything that has been stored up to the point in time when flush is called.
It will get the current max and wait up to timeout for that message to be discarded
- Parameters
-
timeout_ | The number of milliseconds to wait for the messages to be acknowledged by AMPS and discarded by the Store. 0 indicates no timeout. |
- Exceptions
-
DisconnectedException | The Client is no longer connected to a server. |
ConnectionException | An error occurred while sending the message. |
TimedOutException | The publish command was not acked in the allowed time. |
Used to get a pointer to the implementation.
- Returns
- The StoreImpl* for this store's implementation.
bool AMPS::Store::getErrorOnPublishGap |
( |
| ) |
const |
|
inline |
Called to check if the Store will throw PublishStoreGapException.
- Returns
- If true, PublishStoreGapException can be thrown by the store if the client logs onto a server that appears to be missing messages no longer held in the store.
amps_uint64_t AMPS::Store::getLastPersisted |
( |
void |
| ) |
|
|
inline |
Get the last persisted message sequence in the store.
- Returns
- The sequence of the last persisted message.
amps_uint64_t AMPS::Store::getLowestUnpersisted |
( |
| ) |
|
|
inline |
Get the oldest unpersisted message sequence in the store.
- Returns
- The sequence of the oldest message.
bool AMPS::Store::isValid |
( |
| ) |
const |
|
inline |
Method to return if there is an underlying implementation for the Store.
- Returns
- Returns true if there is an implementation or false if an empty handle.
Called by Client to get all stored and non-discarded messages replayed by the store onto the StoreReplayer.
- Parameters
-
bool AMPS::Store::replaySingle |
( |
StoreReplayer & |
replayer_, |
|
|
amps_uint64_t |
index_ |
|
) |
| |
|
inline |
Called by Client to get a single message replayed by the store onto the StoreReplayer.
- Parameters
-
replayer_ | The StoreReplayer to be used to replay the messages. |
index_ | The index of the message to replay. |
- Returns
- Returns true for success, false for failure such as an invalid index.
void AMPS::Store::setErrorOnPublishGap |
( |
bool |
errorOnPublishGap_ | ) |
|
|
inline |
Called to enable or disable throwing PublishStoreGapException.
- Parameters
-
errorOnPublishGap_ | If true, PublishStoreGapException can be thrown by the store if the client logs onto a server that appears to be missing messages no longer held in the store. |
void AMPS::Store::setResizeHandler |
( |
PublishStoreResizeHandler |
handler_, |
|
|
void * |
userData_ |
|
) |
| |
|
inline |
Set a handler to be called if the Store needs to resize in order to keep storing messages.
Resize could be caused by not being connected to the server, publishing messages faster than the network or AMPS can keep up, not properly discarding messages when receiving persisted acks, or AMPS being unable to complete persistence such as when its connection to a sync replication destination is unavailable.
- Parameters
-
handler_ | The handler to be called when a resize event is required. |
userData_ | The data to pass to the handler each time it is called. |
amps_uint64_t AMPS::Store::store |
( |
const Message & |
message_ | ) |
|
|
inline |
Called by Client to store a message being published.
- Parameters
-
message_ | The message to store. |
size_t AMPS::Store::unpersistedCount |
( |
| ) |
const |
|
inline |
Method to return how many messages are in the store that have not been discarded, indicating that they are not yet persisted by the AMPS server.
- Returns
- The number of messages not yet persisted by the AMPS server.
The documentation for this class was generated from the following file: