AMPS C/C++ Client Class Reference AMPS C/C++ Client Version 5.3.5.1

Public Member Functions | List of all members
AMPS::MemoryBookmarkStore Class Reference

A BookmarkStoreImpl implementation that stores bookmarks in memory. More...

`#include <MemoryBookmarkStore.hpp>`

Inheritance diagram for AMPS::MemoryBookmarkStore:

## Public Member Functions
| MemoryBookmarkStore ()
| Creates a MemoryBookmarkStore.
| MemoryBookmarkStore (const RecoveryPointAdapter &adapter_, RecoveryPointFactory factory_=NULL)
| Creates a MemoryBookmarkStore. 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 discard-bookmark entry to the persistent log based on a bookmark sequence number. 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...
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...
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 stores bookmarks in memory.

This store protects against connectivity failures. This store does not persist the bookmark store, so this store cannot be used to resume subscriptions after application restart.

## Constructor & Destructor Documentation

## ◆ MemoryBookmarkStore()

AMPS::MemoryBookmarkStore::MemoryBookmarkStore | ( | const RecoveryPointAdapter & | adapter_,
|  | RecoveryPointFactory | factory_ = `NULL`
| ) |  |
| inline

Creates a MemoryBookmarkStore.

Parameters

  adapter_ | The RecoveryPointAdapter to notify about updates.
  factory_ | An optional factory function to use to create the RecoveryPoint objects sent to the recoveryPointAdapter_.

## Member Function Documentation

## ◆ discard() [1/2]

virtual void AMPS::MemoryBookmarkStore::discard | ( | const Message & | message_ | ) |
| inline virtual

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

Parameters

  message_ | The Message to discard.

Implements AMPS::BookmarkStoreImpl.

Reimplemented in AMPS::RingBookmarkStore, AMPS::MMapBookmarkStore, and AMPS::LoggedBookmarkStore.

## ◆ discard() [2/2]

virtual void AMPS::MemoryBookmarkStore::discard | ( | const Message::Field & | subId_,
|  | size_t | bookmarkSeqNo_
| ) |  |
| inline virtual

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.

Implements AMPS::BookmarkStoreImpl.

Reimplemented in AMPS::RingBookmarkStore, AMPS::MMapBookmarkStore, and AMPS::LoggedBookmarkStore.

## ◆ getMostRecent()

virtual Message::Field AMPS::MemoryBookmarkStore::getMostRecent | ( | const Message::Field & | subId_ | ) |
| inline virtual

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.

Implements AMPS::BookmarkStoreImpl.

Reimplemented in AMPS::RingBookmarkStore, AMPS::MMapBookmarkStore, and AMPS::LoggedBookmarkStore.

## ◆ getOldestBookmarkSeq()

virtual size_t AMPS::MemoryBookmarkStore::getOldestBookmarkSeq | ( | const Message::Field & | subId_ | ) |
| inline virtual

Called to find the oldest bookmark in the store.

Parameters

  subId_ | The subscription ID on which to find the oldest bookmark.

Returns
  The bookmark that is oldest in the store for subId_

Implements AMPS::BookmarkStoreImpl.

## ◆ isDiscarded()

virtual bool AMPS::MemoryBookmarkStore::isDiscarded | ( | Message & | message_ | ) |
| inline virtual

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.

Implements AMPS::BookmarkStoreImpl.

Reimplemented in AMPS::MMapBookmarkStore, and AMPS::LoggedBookmarkStore.

## ◆ log()

virtual size_t AMPS::MemoryBookmarkStore::log | ( | Message & | message_ | ) |
| inline virtual

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

Parameters

  message_ | The Message to log.

Implements AMPS::BookmarkStoreImpl.

Reimplemented in AMPS::RingBookmarkStore, AMPS::MMapBookmarkStore, and AMPS::LoggedBookmarkStore.

## ◆ persisted() [1/2]

virtual void AMPS::MemoryBookmarkStore::persisted | ( | const Message::Field & | subId_,
|  | const Message::Field & | bookmark_
| ) |  |
| inline virtual

Mark the bookmark provided as replicated to all sync replication destinations for the given subscription.

Parameters

  subId_ | The subscription Id to which the bookmark applies.
  bookmark_ | The most recent replicated bookmark.

Implements AMPS::BookmarkStoreImpl.

Reimplemented in AMPS::RingBookmarkStore.

## ◆ persisted() [2/2]

virtual Message::Field AMPS::MemoryBookmarkStore::persisted | ( | const Message::Field & | subId_,
|  | size_t | bookmark_
| ) |  |
| inline virtual

Mark the bookmark provided as replicated to all sync replication destinations for the given subscription.

Parameters

  subId_ | The subscription Id to which the bookmark applies.
  bookmark_ | The most recent bookmark's sequence number.

Returns
  The bookmark field that was just marked persisted.

Implements AMPS::BookmarkStoreImpl.

## ◆ purge() [1/2]

virtual void AMPS::MemoryBookmarkStore::purge | ( |  | ) |
| inline virtual

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.

Implements AMPS::BookmarkStoreImpl.

Reimplemented in AMPS::RingBookmarkStore, AMPS::MMapBookmarkStore, and AMPS::LoggedBookmarkStore.

## ◆ purge() [2/2]

virtual void AMPS::MemoryBookmarkStore::purge | ( | const Message::Field & | subId_ | ) |
| inline virtual

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.

Implements AMPS::BookmarkStoreImpl.

Reimplemented in AMPS::RingBookmarkStore, AMPS::MMapBookmarkStore, and AMPS::LoggedBookmarkStore.

## ◆ setServerVersion() [1/2]

void AMPS::MemoryBookmarkStore::setServerVersion | ( | const VersionInfo & | version_ | ) |
| inline virtual

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.

Implements AMPS::BookmarkStoreImpl.

Reimplemented in AMPS::MMapBookmarkStore.

## ◆ setServerVersion() [2/2]

void AMPS::MemoryBookmarkStore::setServerVersion | ( | size_t | version_ | ) |
| inline virtual

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.

Implements AMPS::BookmarkStoreImpl.

Reimplemented in AMPS::MMapBookmarkStore.

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

- include/amps/MemoryBookmarkStore.hpp