Abstract base class for storing published messages for an HA publisher client.
More...
#include <ampsplusplus.hpp>
|
| StoreImpl (bool errorOnPublishGap_=false) |
| Default constructor. More...
|
|
virtual amps_uint64_t | store (const Message &message_)=0 |
| Called by Client to store a message being published. More...
|
|
virtual void | discardUpTo (amps_uint64_t index_)=0 |
| Called by Client to indicate that all messages up to and including. More...
|
|
virtual void | replay (StoreReplayer &replayer_)=0 |
| Called by Client to get all stored and non-discarded messages replayed by the store onto the StoreReplayer. More...
|
|
virtual bool | replaySingle (StoreReplayer &replayer_, amps_uint64_t index_)=0 |
| Called by Client to get a single message replayed by the store onto the StoreReplayer. More...
|
|
virtual size_t | unpersistedCount () const =0 |
| 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. More...
|
|
virtual void | flush (long timeout_)=0 |
| Method to wait for the Store to discard everything that has been stored up to the point in time when flush is called. More...
|
|
virtual amps_uint64_t | getLowestUnpersisted () const =0 |
| Get the oldest unpersisted message sequence in the store. More...
|
|
virtual amps_uint64_t | getLastPersisted ()=0 |
| Get the last persisted sequence number. More...
|
|
virtual void | setResizeHandler (PublishStoreResizeHandler handler_, void *userData_) |
| Set a handler to be called if the Store needs to resize in order to keep storing messages. More...
|
|
|
static size_t | getUnsetPosition () |
| Method to return the value used to represent not found or unset.
|
|
static amps_uint64_t | getUnsetSequence () |
| Method to return the value used to represent no such sequence.
|
|
Abstract base class for storing published messages for an HA publisher client.
AMPS::StoreImpl::StoreImpl |
( |
bool |
errorOnPublishGap_ = false | ) |
|
|
inline |
Default constructor.
- 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. |
virtual void AMPS::StoreImpl::discardUpTo |
( |
amps_uint64_t |
index_ | ) |
|
|
pure virtual |
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. |
Implemented in AMPS::BlockPublishStore, and AMPS::HybridPublishStore.
virtual void AMPS::StoreImpl::flush |
( |
long |
timeout_ | ) |
|
|
pure virtual |
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. |
Implemented in AMPS::BlockPublishStore, and AMPS::HybridPublishStore.
virtual amps_uint64_t AMPS::StoreImpl::getLastPersisted |
( |
| ) |
|
|
pure virtual |
virtual amps_uint64_t AMPS::StoreImpl::getLowestUnpersisted |
( |
| ) |
const |
|
pure virtual |
virtual void AMPS::StoreImpl::replay |
( |
StoreReplayer & |
replayer_ | ) |
|
|
pure virtual |
virtual bool AMPS::StoreImpl::replaySingle |
( |
StoreReplayer & |
replayer_, |
|
|
amps_uint64_t |
index_ |
|
) |
| |
|
pure virtual |
virtual void AMPS::StoreImpl::setResizeHandler |
( |
PublishStoreResizeHandler |
handler_, |
|
|
void * |
userData_ |
|
) |
| |
|
inlinevirtual |
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. |
Reimplemented in AMPS::HybridPublishStore.
virtual amps_uint64_t AMPS::StoreImpl::store |
( |
const Message & |
message_ | ) |
|
|
pure virtual |
virtual size_t AMPS::StoreImpl::unpersistedCount |
( |
| ) |
const |
|
pure virtual |
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.
Implemented in AMPS::BlockPublishStore, and AMPS::HybridPublishStore.
The documentation for this class was generated from the following file: