AMPS C/C++ Client Class Reference
AMPS C/C++ Client Version 5.3.0.2
AMPS::RingBookmarkStore Class Reference

A BookmarkStoreImpl that stores only the MOST_RECENT bookmark to a file for recovery and keeps any bookmarks later than most recent in memory. More...

#include <RingBookmarkStore.hpp>

+ Inheritance diagram for AMPS::RingBookmarkStore:

Public Member Functions

 RingBookmarkStore (const char *fileName_)
 Create a RingBookmarkStore using fileName_ for storage of most recent. More...
 
virtual size_t log (Message &message_)
 Return the corresponding sequence number for this bookmark. More...
 
virtual void discard (const Message &message_)
 Log a discard-bookmark entry to the persistent log based on a bookmark sequence number. More...
 
virtual void discard (const Message::Field &subId_, size_t bookmarkSeqNo_)
 
virtual Message::Field getMostRecent (const Message::Field &subId_)
 Returns the most recent bookmark from the log that ought to be used for (re-)subscriptions. More...
 
virtual bool isDiscarded (Message &message_)
 Since we don't persist discarded messages after the most recently logged bookmark, we always assume any message tested for should be delivered and is not discarded. More...
 
virtual void purge ()
 Called to purge the contents of this store. More...
 
virtual void purge (const Message::Field &subId_)
 Called to purge the contents of this store for particular subId. More...
 
virtual void noPersistedAcks (const Message::Field &subId_)
 RingBookmarkStore never uses persisted acks so this is a no-op. More...
 
- Public Member Functions inherited from AMPS::MemoryBookmarkStore
virtual size_t getOldestBookmarkSeq (const Message::Field &subId_)
 Called to find the oldest bookmark in the store. More...
 
virtual void persisted (const Message::Field &subId_, const Message::Field &bookmark_)
 Mark the bookmark provided as replicated to all sync replication destinations for the given subscription. More...
 
virtual Message::Field persisted (const Message::Field &subId_, size_t bookmark_)
 Mark the bookmark provided as replicated to all sync replication destinations for the given subscription. More...
 
void setServerVersion (const VersionInfo &version_)
 Internally used to set the server version so the store knows how to deal with persisted acks and calls to getMostRecent(). More...
 
void setServerVersion (size_t version_)
 Internally used to set the server version so the store knows how to deal with persisted acks and calls to getMostRecent(). More...
 
- Public Member Functions inherited from AMPS::BookmarkStoreImpl
virtual void setResizeHandler (BookmarkStoreResizeHandler handler_, void *userData_)
 Set a handler on the bookmark store that will get called whenever a resize of the store is required due to the number of stored bookmarks exceeding the currently allocated storage to hold them. More...
 

Detailed Description

A BookmarkStoreImpl that stores only the MOST_RECENT bookmark to a file for recovery and keeps any bookmarks later than most recent in memory.

This class is best used when you want permanent storage for recovery on the client side, but expect to process all messages in order. It will not protect you from possibly missing or duplicate bookmarks that can occur if you are using a bookmark live subscription and you have to fail over to another AMPS instance which receives messages in a different order. The storage actually has 3 storage positons to allow for protection against crashes while updating storage.

Constructor & Destructor Documentation

AMPS::RingBookmarkStore::RingBookmarkStore ( const char *  fileName_)
inline

Create a RingBookmarkStore using fileName_ for storage of most recent.

If the file exists and has a valid bookmark, it will be recovered.

Parameters
fileName_The name of the file to use for storage.

Member Function Documentation

virtual void AMPS::RingBookmarkStore::discard ( const Message message_)
inlinevirtual

Log a discard-bookmark entry to the persistent log based on a bookmark sequence number.

Parameters
message_The Message to discard.

Reimplemented from AMPS::MemoryBookmarkStore.

virtual void AMPS::RingBookmarkStore::discard ( const Message::Field subId_,
size_t  bookmarkSeqNo_ 
)
inlinevirtual
Deprecated:
Use the discard(const Message&) function instead.

Log a discard-bookmark entry to the persistent log based on a bookmark sequence number.

Parameters
subId_The id of the subscription to which the bookmark applies.
bookmarkSeqNo_The bookmark sequence number to discard.

Reimplemented from AMPS::MemoryBookmarkStore.

virtual Message::Field AMPS::RingBookmarkStore::getMostRecent ( const Message::Field subId_)
inlinevirtual

Returns the most recent bookmark from the log that ought to be used for (re-)subscriptions.

Parameters
subId_The id of the subscription to check.

Reimplemented from AMPS::MemoryBookmarkStore.

virtual bool AMPS::RingBookmarkStore::isDiscarded ( Message message_)
inlinevirtual

Since we don't persist discarded messages after the most recently logged bookmark, we always assume any message tested for should be delivered and is not discarded.

Parameters
message_The Message to check.

Reimplemented from AMPS::MemoryBookmarkStore.

virtual size_t AMPS::RingBookmarkStore::log ( Message message_)
inlinevirtual

Return the corresponding sequence number for this bookmark.

Parameters
message_The Message to check.

Reimplemented from AMPS::MemoryBookmarkStore.

virtual void AMPS::RingBookmarkStore::noPersistedAcks ( const Message::Field subId_)
inlinevirtual

RingBookmarkStore never uses persisted acks so this is a no-op.

Parameters
subId_The subscription id of the subscription without persisted acks.

Reimplemented from AMPS::MemoryBookmarkStore.

virtual void AMPS::RingBookmarkStore::purge ( )
inlinevirtual

Called to purge the contents of this store.

Removes any tracking history associated with publishers and received messages, and may delete or truncate on-disk representations as well.

Reimplemented from AMPS::MemoryBookmarkStore.

virtual void AMPS::RingBookmarkStore::purge ( const Message::Field subId_)
inlinevirtual

Called to purge the contents of this store for particular subId.

Removes any tracking history associated with publishers and received messages, and will remove the subId from the file as well.

Reimplemented from AMPS::MemoryBookmarkStore.


The documentation for this class was generated from the following file: