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

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

A StoreImpl implementation that uses MemoryStoreBuffer as its buffer to hold published messages in memory. More...

`#include <MemoryPublishStore.hpp>`

Inheritance diagram for AMPS::MemoryPublishStore:

## Public Member Functions
| MemoryPublishStore (size_t blockPerRealloc_, bool errorOnPublishGap_=false)
| Create a MemoryPublishStore with a specified initial capacity in bytes. More...
| MemoryPublishStore (size_t blocksPerRealloc_, amps_uint32_t blockSize_, bool errorOnPublishGap_=false)
| Create a MemoryPublishStore with a specified initial capacity in bytes. More...
virtual void | discardUpTo (amps_uint64_t index_)
| Remove all messages with an index up to and including index_. More...
Public Member Functions inherited from AMPS::BlockPublishStore
amps_uint32_t | getBlockSize ()
| Return the size left in a block for data when it has a header in it. More...
amps_uint32_t | getBlockDataSize ()
| Return the size left in a block for data when it has a header in it. More...
| BlockPublishStore (Buffer *buffer_, amps_uint32_t blocksPerRealloc_=1000, bool isFile_=false, bool errorOnPublishGap_=false, amps_uint32_t blockSize_=DEFAULT_BLOCK_SIZE)
| Create a BlockPublishStore using buffer_, that grows by blocksPerRealloc_ blocks when it must grow. More...
virtual | ~BlockPublishStore ()
| Destructor that cleans up the buffer and other associated memory.
virtual amps_uint64_t | store (const Message &message_)
| Store a given message that will be delivered to AMPS. More...
amps_uint64_t | store (const Message &message_, bool assignSequence_)
| Store a given message that will be delivered to AMPS. More...
void | replay (StoreReplayer &replayer_)
| Replay all messages in the Store onto the given StoreReplayer. More...
bool | replaySingle (StoreReplayer &replayer_, amps_uint64_t index_)
| Replay one message in the Store onto the given StoreReplayer. More...
size_t | unpersistedCount () const
| Method to return the count of messages that currently in the Store because they have not been discarded, presumably because AMPS has not yet acknowledged them. 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...
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...
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...

## Additional Inherited Members
Public Types inherited from AMPS::BlockPublishStore
enum | Constants : amps_uint32_t
| Default constant values for BlockPublishStore.
Static Public Member Functions inherited from AMPS::BlockPublishStore
static amps_uint32_t | getBlockHeaderSize ()
| Block header is number of blocks, total length, sequence number, crc, next in chain offset. More...
static amps_uint32_t | getBlockChainHeaderSize ()
| Block chain header is operation, command id length, correlation id length, expiration length, sow key length, topic length, sow delete flag, ack types. More...
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.

## Detailed Description

A StoreImpl implementation that uses MemoryStoreBuffer as its buffer to hold published messages in memory.

This store does not persist the published messages, so this store cannot be used to guarantee message publication if the application restarts.

## Constructor & Destructor Documentation

## ◆ MemoryPublishStore() [1/2]

AMPS::MemoryPublishStore::MemoryPublishStore | ( | size_t | blockPerRealloc_,
|  | bool | errorOnPublishGap_ = `false`
| ) |  |
| inline

Create a MemoryPublishStore with a specified initial capacity in bytes.

Parameters

  blockPerRealloc_ | The number of blocks to grow by when capacity has been exceeded.
  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.

## ◆ MemoryPublishStore() [2/2]

AMPS::MemoryPublishStore::MemoryPublishStore | ( | size_t | blocksPerRealloc_,
|  | amps_uint32_t | blockSize_,
|  | bool | errorOnPublishGap_ = `false`
| ) |  |
| inline

Create a MemoryPublishStore with a specified initial capacity in bytes.

Parameters

  blocksPerRealloc_ | The number of blocks to grow by when capacity has been exceeded.
  blockSize_ | The size of each block, default is 2KB. Should be a 64-byte aligned value that is > 64 + expected message size. Larger messages can span blocks but 1 block per message is most efficient.
  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.

## Member Function Documentation

## ◆ discardUpTo()

virtual void AMPS::MemoryPublishStore::discardUpTo | ( | amps_uint64_t | index_ | ) |
| inline virtual

Remove all messages with an index up to and including index_.

This method is used internally by the Client to remove messages once they have been acknowledged by AMPS as stored on the server side.

Parameters

  index_ | The highest index to remove.

Exceptions

  PublishStoreGapException | If index_ < getLastPersisted() which could leave a gap on the server of missing messages from this Client.

Reimplemented from AMPS::BlockPublishStore.

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

- include/amps/MemoryPublishStore.hpp