Memory based message persister.
More...
#include <persist.hpp>
|
| MemoryPersister () |
| Ctor. More...
|
|
virtual | ~MemoryPersister () |
| Dtor. More...
|
|
virtual F8API bool | put (const unsigned seqnum, const f8String &what) |
|
virtual F8API bool | put (const unsigned sender_seqnum, const unsigned target_seqnum) |
|
virtual F8API bool | get (const unsigned seqnum, f8String &to) const |
|
virtual F8API unsigned | get (const unsigned from, const unsigned to, Session &session, bool(Session::*)(const Session::SequencePair &with, Session::RetransmissionContext &rctx)) const |
|
virtual F8API unsigned | get_last_seqnum (unsigned &to) const |
|
virtual F8API bool | get (unsigned &sender_seqnum, unsigned &target_seqnum) const |
|
virtual F8API unsigned | find_nearest_highest_seqnum (const unsigned requested, const unsigned last) const |
|
| Persister ()=default |
| Ctor. More...
|
|
virtual | ~Persister () |
| Dtor. More...
|
|
| Persister (const Persister &)=delete |
|
Persister & | operator= (const Persister &)=delete |
|
virtual bool | put (const f8String &key, const f8String &what) |
|
virtual bool | get (const f8String &key, f8String &to) const |
|
virtual bool | del (const f8String &key) |
|
virtual bool | purge () |
|
virtual void | stop () |
| Stop the persister thread. More...
|
|
Memory based message persister.
Definition at line 292 of file persist.hpp.
FIX8::MemoryPersister::MemoryPersister |
( |
| ) |
|
|
inline |
virtual FIX8::MemoryPersister::~MemoryPersister |
( |
| ) |
|
|
inlinevirtual |
unsigned MemoryPersister::find_nearest_highest_seqnum |
( |
const unsigned |
requested, |
|
|
const unsigned |
last |
|
) |
| const |
|
virtual |
Find the nearest highest sequence number from the sequence to last provided.
- Parameters
-
requested | sequence number to start |
last | highest sequence |
- Returns
- the nearest sequence number or 0 if not found
Implements FIX8::Persister.
Definition at line 401 of file persist.cpp.
405 for (
unsigned startseqnum(requested); startseqnum <= last; ++startseqnum)
407 Store::const_iterator itr(
_store.find(startseqnum));
bool MemoryPersister::get |
( |
const unsigned |
seqnum, |
|
|
f8String & |
to |
|
) |
| const |
|
virtual |
Retrieve a persisted message.
- Parameters
-
seqnum | sequence number of message |
to | target message string |
- Returns
- true on success
Implements FIX8::Persister.
Definition at line 389 of file persist.cpp.
393 Store::const_iterator itr(
_store.find(seqnum));
Retrieve a range of persisted messages.
- Parameters
-
from | start at sequence number |
to | end sequence number |
session | session containing callback method |
callback | method to call with each retrieved message |
- Returns
- number of messages retrieved
Implements FIX8::Persister.
Definition at line 322 of file persist.cpp.
References FIX8::Session::RetransmissionContext::_no_more_records, FIX8::Session::get_next_send_seq(), glout_error, and glout_warn.
325 unsigned last_seq(0);
328 const unsigned finish(to == 0 ? last_seq : to);
331 if (!startSeqNum || from > finish)
334 rctx._no_more_records =
true;
339 Store::const_iterator itr(
_store.find(startSeqNum));
344 if (!itr->first || itr->first > finish)
348 if (!(session.*callback)(result, rctx))
351 while(++itr !=
_store.end());
354 rctx._no_more_records =
true;
355 (session.*callback)(result, rctx);
358 glout_error <<
"record not found (" << startSeqNum <<
')';
virtual F8API unsigned find_nearest_highest_seqnum(const unsigned requested, const unsigned last) const
virtual F8API unsigned get_last_seqnum(unsigned &to) const
std::pair< const unsigned, const f8String > SequencePair
Provides context to your retrans handler.
unsigned get_next_send_seq() const
bool MemoryPersister::get |
( |
unsigned & |
sender_seqnum, |
|
|
unsigned & |
target_seqnum |
|
) |
| const |
|
virtual |
Retrieve a sequence control record.
- Parameters
-
sender_seqnum | sequence number of last sent message |
target_seqnum | sequence number of last received message |
- Returns
- true on success
Implements FIX8::Persister.
Definition at line 377 of file persist.cpp.
379 Store::const_iterator itr(
_store.find(0));
382 const unsigned *loc(reinterpret_cast<const unsigned *>(&itr->second));
383 sender_seqnum = *loc++;
384 target_seqnum = *loc;
unsigned MemoryPersister::get_last_seqnum |
( |
unsigned & |
to | ) |
const |
|
virtual |
Retrieve sequence number of last peristed message.
- Parameters
-
- Returns
- sequence number of last peristed message on success
Implements FIX8::Persister.
Definition at line 417 of file persist.cpp.
419 return to = (
_store.empty() ? 0 :
_store.rbegin()->first);
bool MemoryPersister::put |
( |
const unsigned |
seqnum, |
|
|
const f8String & |
what |
|
) |
| |
|
virtual |
Persist a message.
- Parameters
-
seqnum | sequence number of message |
what | message string |
- Returns
- true on success
Implements FIX8::Persister.
Definition at line 371 of file persist.cpp.
373 return !seqnum ?
false :
_store.insert({seqnum, what}).second;
bool MemoryPersister::put |
( |
const unsigned |
sender_seqnum, |
|
|
const unsigned |
target_seqnum |
|
) |
| |
|
virtual |
Persist a sequence control record.
- Parameters
-
sender_seqnum | sequence number of last sent message |
target_seqnum | sequence number of last received message |
- Returns
- true on success
Implements FIX8::Persister.
Definition at line 364 of file persist.cpp.
366 const unsigned arr[2] { sender_seqnum, target_seqnum };
367 return _store.insert({0,
f8String(reinterpret_cast<const char *>(arr),
sizeof(arr))}).second;
Store FIX8::MemoryPersister::_store |
|
private |
The documentation for this class was generated from the following files: