|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Slot/bin shared-memory store for time-limited DataMessages (the node's "dynamic" memory). More...
Go to the source code of this file.
Classes | |
| struct | cmlabs::SlotEntryStruct |
| Per-message slot record: which bin/blocks hold the message and until when. More... | |
| struct | cmlabs::TemporalMemoryStruct |
| Root header of the temporal-memory segment. More... | |
| struct | cmlabs::BinHeaderStruct |
| Header of one fixed-block-size bin inside the temporal segment. More... | |
| class | cmlabs::TemporalMemory |
| Accessor for the temporal (dynamic) message store in shared memory. More... | |
Namespaces | |
| namespace | cmlabs |
Macros | |
| #define | CHECKTEMPORALMEMORYSERIAL if (serial != master->getDynamicShmemSerial()) {if (!open()) {mutex->leave();return 0;}} |
| Re-open the temporal segment if the master's resize serial no longer matches ours (i.e. | |
Message-id packing macros | |
A 64-bit message id encodes node (16 bits), slot serial (16 bits) and slot index (32 bits). | |
| #define | GETMSGNODE(id) |
| #define | GETMSGSERIAL(id) |
| #define | GETMSGSLOT(id) |
| #define | SETMSGID(id, node, serial, slot) |
Slot/bin shared-memory store for time-limited DataMessages (the node's "dynamic" memory).
Every message published in a Psyclone system carries an end-of-life (EOL) timestamp. TemporalMemory stores such messages in a single shared segment organised as: a TemporalMemoryStruct header, a slot bitfield, an array of SlotEntryStruct (one per stored message), and a series of bins — pools of fixed-size blocks (small bins for small messages, larger bins for big ones). A message occupies contiguous blocks in exactly one bin; the slot records where. Expired slots are reclaimed by maintenance().
Message ids pack node|serial|slot (see GETMSGNODE/GETMSGSERIAL/GETMSGSLOT); the serial guards against reading a slot that has been recycled since the id was issued.
Definition in file TemporalMemory.h.
| #define CHECKTEMPORALMEMORYSERIAL if (serial != master->getDynamicShmemSerial()) {if (!open()) {mutex->leave();return 0;}} |
Re-open the temporal segment if the master's resize serial no longer matches ours (i.e.
another process re-created the segment); bails out of the calling method on failure.
Definition at line 95 of file TemporalMemory.h.
Referenced by cmlabs::TemporalMemory::getCopyOfMessage(), cmlabs::TemporalMemory::getMemoryUsage(), cmlabs::TemporalMemory::insertMessage(), and cmlabs::TemporalMemory::maintenance().
| #define GETMSGNODE | ( | id | ) |
Definition at line 87 of file TemporalMemory.h.
Referenced by cmlabs::TemporalMemory::getCopyOfMessage().
| #define GETMSGSERIAL | ( | id | ) |
Definition at line 88 of file TemporalMemory.h.
| #define GETMSGSLOT | ( | id | ) |
Definition at line 89 of file TemporalMemory.h.
| #define SETMSGID | ( | id, | |
| node, | |||
| serial, | |||
| slot ) |
Definition at line 90 of file TemporalMemory.h.
Referenced by cmlabs::TemporalMemory::insertMessage().