AMPS C/C++ Client Class Reference
AMPS C/C++ Client Version 5.3.4.3
AMPS::MMapBookmarkStore Class Reference

A BookmarkStoreImpl implementation that uses a memory mapped file for storage of the bookmarks. More...

#include <MMapBookmarkStore.hpp>

+ Inheritance diagram for AMPS::MMapBookmarkStore:

Public Member Functions

 MMapBookmarkStore (const char *fileName_, bool useLastModifiedTime_=false)
 Create an MMapBookmarkStore that uses fileName_ as its file storage. More...
 
 MMapBookmarkStore (const std::string &fileName_, bool useLastModifiedTime_=false)
 Create an MMapBookmarkStore that uses fileName_ as its file storage. More...
 
 MMapBookmarkStore (const RecoveryPointAdapter &adapter_, const char *fileName_, RecoveryPointFactory factory_=NULL, bool useLastModifiedTime_=false)
 Create an MMapBookmarkStore that uses fileName_ as its file storage. More...
 
 MMapBookmarkStore (const RecoveryPointAdapter &adapter_, const std::string &fileName_, RecoveryPointFactory factory_=NULL, bool useLastModifiedTime_=false)
 Create an MMapBookmarkStore that uses fileName_ as its file storage. More...
 
virtual size_t log (Message &message_)
 Log a bookmark to the persistent log and return the corresponding sequence number for this bookmark. More...
 
virtual void discard (const Message &message_)
 Log a Message as discarded from the store. More...
 
virtual void discard (const Message::Field &subId_, size_t bookmarkSeqNo_)
 Log a discard-bookmark entry to the persistent log based on a bookmark sequence number. More...
 
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_)
 Called for each arriving message to determine if the application has already seen this bookmark and should not be reprocessed. 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...
 
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::MemoryBookmarkStore
 MemoryBookmarkStore ()
 Creates a MemoryBookmarkStore.
 
 MemoryBookmarkStore (const RecoveryPointAdapter &adapter_, RecoveryPointFactory factory_=NULL)
 Creates a MemoryBookmarkStore. More...
 
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...
 
- 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...
 
size_t getMaxSubIdLength () const
 Gets the maximum allowed length for a sub id when recovering a bookmark store from persistent storage. More...
 
void setMaxSubIdLength (size_t maxSubIdLength_)
 Sets the maximum allowed length for a sub id when recovering a bookmark store from persistent storage. More...
 

Detailed Description

A BookmarkStoreImpl implementation that uses a memory mapped file for storage of the bookmarks.

This implementation provides efficient bookmark tracking that persists across application restarts.

Constructor & Destructor Documentation

AMPS::MMapBookmarkStore::MMapBookmarkStore ( const char *  fileName_,
bool  useLastModifiedTime_ = false 
)
inline

Create an MMapBookmarkStore that uses fileName_ as its file storage.

If the file already exists and has bookmarks stored, they will be recovered to determine the most recent bookmark and any messages since then that have been discarded.

Parameters
fileName_The name of the file to use for storage.
useLastModifiedTime_If the file already exists, the last modification time of the file will be included in the bookmark list returned from getMostRecent for any subscription ID that exists in the file upon recovery.
AMPS::MMapBookmarkStore::MMapBookmarkStore ( const std::string &  fileName_,
bool  useLastModifiedTime_ = false 
)
inline

Create an MMapBookmarkStore that uses fileName_ as its file storage.

If the file already exists and has bookmarks stored, they will be recovered to determine the most recent bookmark and any messages since then that have been discarded.

Parameters
fileName_The name of the file to use.
useLastModifiedTime_If the file already exists, the last modification time of the file will be included in the bookmark list returned from getMostRecent for any subscription ID that exists in the file upon recovery.
AMPS::MMapBookmarkStore::MMapBookmarkStore ( const RecoveryPointAdapter adapter_,
const char *  fileName_,
RecoveryPointFactory  factory_ = NULL,
bool  useLastModifiedTime_ = false 
)
inline

Create an MMapBookmarkStore that uses fileName_ as its file storage.

If the file already exists and has bookmarks stored, they will be recovered to determine the most recent bookmark and any messages since then that have been discarded.

Parameters
adapter_The RecoveryPointAdapter to notify about updates.
fileName_The name of the file to use.
factory_An optional factory function to use to create the RecoveryPoint objects sent to the recoveryPointAdapter_.
useLastModifiedTime_If the file already exists, the last modification time of the file will be included in the bookmark list returned from getMostRecent for any subscription ID that exists in the file upon recovery.
AMPS::MMapBookmarkStore::MMapBookmarkStore ( const RecoveryPointAdapter adapter_,
const std::string &  fileName_,
RecoveryPointFactory  factory_ = NULL,
bool  useLastModifiedTime_ = false 
)
inline

Create an MMapBookmarkStore that uses fileName_ as its file storage.

If the file already exists and has bookmarks stored, they will be recovered to determine the most recent bookmark and any messages since then that have been discarded.

Parameters
adapter_The RecoveryPointAdapter to notify about updates.
fileName_The name of the file to use for storage.
factory_An optional factory function to use to create the RecoveryPoint objects sent to the recoveryPointAdapter_.
useLastModifiedTime_If the file already exists, the last modification time of the file will be included in the bookmark list returned from getMostRecent for any subscription ID that exists in the file upon recovery.

Member Function Documentation

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

Log a Message as discarded from the store.

Parameters
message_The Message to discard.

Reimplemented from AMPS::MemoryBookmarkStore.

virtual void AMPS::MMapBookmarkStore::discard ( const Message::Field subId_,
size_t  bookmarkSeqNo_ 
)
inlinevirtual

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

Use the discard(const Message&) function instead when you have the full Message object available..

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::MMapBookmarkStore::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::MMapBookmarkStore::isDiscarded ( Message message_)
inlinevirtual

Called for each arriving message to determine if the application has already seen this bookmark and should not be reprocessed.

Returns 'true' if the bookmark is in the log and should not be re-processed, false otherwise.

Parameters
message_The Message to check.
Returns
Whether or not the Message has been discarded from this store.

Reimplemented from AMPS::MemoryBookmarkStore.

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

Log a bookmark to the persistent log and return the corresponding sequence number for this bookmark.

Parameters
message_The Message to log.

Reimplemented from AMPS::MemoryBookmarkStore.

virtual void AMPS::MMapBookmarkStore::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::MMapBookmarkStore::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.

void AMPS::MMapBookmarkStore::setServerVersion ( const VersionInfo &  version_)
inlinevirtual

Internally used to set the server version so the store knows how to deal with persisted acks and calls to getMostRecent().

Parameters
version_The version of the server being used.

Reimplemented from AMPS::MemoryBookmarkStore.

void AMPS::MMapBookmarkStore::setServerVersion ( size_t  version_)
inlinevirtual

Internally used to set the server version so the store knows how to deal with persisted acks and calls to getMostRecent().

Parameters
version_The version of the server being used.

Reimplemented from AMPS::MemoryBookmarkStore.


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