AMPS C/C++ Client Class Reference
AMPS C/C++ Client Version 5.3.4.4
|
An implementation of StoreImpl for publication. More...
#include <HybridPublishStore.hpp>
Public Member Functions | |
HybridPublishStore (const char *fileName_, size_t maxMemoryCapacity_, bool errorOnPublishGap_=false) | |
Create a HybridPublishStore that will use fileName_ as its file storage and stores at most maxMemoryCapacity_ messages in memory before offloading some messages to the file. More... | |
HybridPublishStore (const std::string &fileName_, size_t maxMemoryCapacity_, bool errorOnPublishGap_=false) | |
Create a HybridPublishStore that will use fileName_ as its file storage and stores at most maxMemoryCapacity_ messages in memory before offloading some messages to the file. More... | |
void | setLowWatermark (size_t lowWatermark_) |
Set how many messags remain in memory after messages get offlined. More... | |
size_t | getLowWatermark () |
Get how many messags remain in memory after messages get offlined. More... | |
void | discardUpTo (amps_uint64_t index_) |
Discard all messages in the store up to and including index_. More... | |
void | replay (StoreReplayer &replayer_) |
Used internally by Client to replay messages in the store to AMPS after a successful connection. More... | |
size_t | unpersistedCount () const |
The number of messages in the Store that have not been discarded. More... | |
virtual void | flush (long timeout_) |
Method to wait for the Store to discard everything that has been stored up to the point in time when flush is called. More... | |
bool | replaySingle (StoreReplayer &replayer_, amps_uint64_t index_) |
Called by Client to get a single message replayed by the store onto the StoreReplayer. More... | |
amps_uint64_t | store (const Message &message_) |
Used internally by Client to put messages into the Store. More... | |
void | setResizeHandler (PublishStoreResizeHandler handler_, void *data_) |
Set a handler to be called if the Store needs to resize in order to keep storing messages. More... | |
amps_uint64_t | getLowestUnpersisted () const |
Get the oldest unpersisted message sequence in the store. More... | |
amps_uint64_t | getLastPersisted (void) |
Get the last persisted sequence number. More... | |
Public Member Functions inherited from AMPS::StoreImpl | |
StoreImpl (bool errorOnPublishGap_=false) | |
Default constructor. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from AMPS::StoreImpl | |
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. | |
An implementation of StoreImpl for publication.
This store uses memory up to a specified capacity, then starts using a file if it will exceed the set maximum memory capacity. This store does not provide guaranteed durable publication if the application is restarted. However, this store does help to limit the amount of memory consumed by a publisher when the publisher cannot connect to AMPS.
|
inline |
Create a HybridPublishStore that will use fileName_ as its file storage and stores at most maxMemoryCapacity_ messages in memory before offloading some messages to the file.
fileName_ | The name to use for the file-based storage. |
maxMemoryCapacity_ | The maximum number of messages to store in in memory before starting to use a file. |
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. |
|
inline |
Create a HybridPublishStore that will use fileName_ as its file storage and stores at most maxMemoryCapacity_ messages in memory before offloading some messages to the file.
fileName_ | The name to use for the file-based storage. |
maxMemoryCapacity_ | The maximum number of messages to store in in memory before starting to use a file. |
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. |
|
inlinevirtual |
Discard all messages in the store up to and including index_.
index_ | The maximum index to remove from storage. |
Implements AMPS::StoreImpl.
|
inlinevirtual |
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
timeout_ | The number of milliseconds to wait. |
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. |
Implements AMPS::StoreImpl.
|
inlinevirtual |
Get the last persisted sequence number.
Implements AMPS::StoreImpl.
|
inlinevirtual |
Get the oldest unpersisted message sequence in the store.
Implements AMPS::StoreImpl.
|
inline |
Get how many messags remain in memory after messages get offlined.
When memory storage reaches its cap, it will write its oldest messages to its file until it is holding only lowWatermark_ messages.
|
inlinevirtual |
Used internally by Client to replay messages in the store to AMPS after a successful connection.
replayer_ | The StoreReplayer that replays the messages. |
Implements AMPS::StoreImpl.
|
inlinevirtual |
Called by Client to get a single message replayed by the store onto the StoreReplayer.
replayer_ | The StoreReplayer to be used to replay the messages. |
index_ | The index of the message to replay. |
Implements AMPS::StoreImpl.
|
inline |
Set how many messags remain in memory after messages get offlined.
When memory storage reaches its cap, it will write its oldest messages to its file until it is holding only lowWatermark_ messages.
lowWatermark_ | The number of messages that remain in memory after offlining completes. |
|
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.
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 from AMPS::StoreImpl.
|
inlinevirtual |
Used internally by Client to put messages into the Store.
message_ | The Message to be stored. |
Implements AMPS::StoreImpl.
|
inlinevirtual |
The number of messages in the Store that have not been discarded.
Implements AMPS::StoreImpl.