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

A StoreImpl implementation that uses a memory-mapped file to provide a publish store that persists across application restarts. More...

#include <PublishStore.hpp>

+ Inheritance diagram for AMPS::PublishStore:

Public Member Functions

 PublishStore (const std::string &fileName_, bool errorOnPublishGap_=false)
 Create a PublishStore that uses fileName_ for the storage. More...
 
 PublishStore (const std::string &fileName_, size_t blocksPerRealloc_, bool errorOnPublishGap_=false)
 Create a PublishStore that uses fileName_ for the storage. More...
 
void truncateOnClose (bool truncate_)
 Tell the PublishStore if it should return the file to its initial capacity when the store is closed if there are no messages stored in it. More...
 
void close ()
 Close the PublishStore and associated file.
 
void sync ()
 Force the PublishStore to sync to disk.
 
- 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...
 
virtual void discardUpTo (amps_uint64_t index_)
 Remove all messages with an index up to and including index_. 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
- 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 a memory-mapped file to provide a publish store that persists across application restarts.

Constructor & Destructor Documentation

AMPS::PublishStore::PublishStore ( const std::string &  fileName_,
bool  errorOnPublishGap_ = false 
)
inline

Create a PublishStore that uses fileName_ for the storage.

If the file exists and has valid messages, they will be recovered.

Parameters
fileName_The name of the file to use for mmap storage.
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.
AMPS::PublishStore::PublishStore ( const std::string &  fileName_,
size_t  blocksPerRealloc_,
bool  errorOnPublishGap_ = false 
)
inline

Create a PublishStore that uses fileName_ for the storage.

If the file exists and has valid messages, they will be recovered.

Parameters
fileName_The name of the file to use for mmap storage.
blocksPerRealloc_The number of new blocks to create each resize.
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

void AMPS::PublishStore::truncateOnClose ( bool  truncate_)
inline

Tell the PublishStore if it should return the file to its initial capacity when the store is closed if there are no messages stored in it.

Parameters
truncate_If true, the file will be truncated.

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