CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
Subscriptions.h File Reference

Subscription, trigger, retrieval, query, post and signal specifications — the declarative wiring of a Psyclone system. More...

#include "PsyTime.h"
#include "Utils.h"
#include "HTML.h"
#include "ObjectIDs.h"
#include "xml_parser.h"
#include "DataMessage.h"
Include dependency graph for Subscriptions.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  cmlabs::FilterSpec
 One filter condition attached to a TriggerSpec: a test on a user entry of the candidate message. More...
struct  cmlabs::QuerySpec
 Specification of a query against a catalog/service/feed, attached to a TriggerSpec. More...
struct  cmlabs::RetrieveSpec
 Specification of a whiteboard retrieval attached to a TriggerSpec. More...
struct  cmlabs::PostSpec
 Specification of a message to post when a trigger fires (or a crank completes). More...
struct  cmlabs::SignalSpec
 Specification of a signal (a typed notification without payload) emitted when a trigger fires. More...
struct  cmlabs::TriggerSpec
 A complete trigger definition: what fires a component's crank and what happens then. More...
struct  cmlabs::ComponentSetup
 Complete static setup for one component, as parsed from the system specification. More...
struct  cmlabs::CustomView
 A custom UI view registered for a component (local configuration; never transmitted). More...
class  cmlabs::ComponentSpec
 In-memory aggregate of a component's setup, triggers and custom views. More...

Namespaces

namespace  cmlabs

Macros

#define MESSAGE_NON_GUARANTEED   1
 Delivery policy flag: message delivery is not guaranteed (may be dropped under load).
Component types

Kinds of components a Psyclone system can host: whiteboards (message stores), catalogs (keyed data stores), streams/feeds (continuous data), services, and modules (user processing code, internal or external).

Note COMP_INTERNAL deliberately aliases COMP_MODULE.

#define COMP_WHITEBOARD   1
 Whiteboard: publish/subscribe message store with retention.
#define COMP_CATALOG   2
 Catalog: keyed/queryable data store.
#define COMP_STREAM   3
 Stream: continuous binary/media data channel.
#define COMP_FEED   4
 Feed: external data feed.
#define COMP_SERVICE   5
 Service: request/response provider.
#define COMP_MODULE   6
 Module: user processing component.
#define COMP_INTERNAL   6
 Internal module (same id as COMP_MODULE).
#define COMP_EXTERNAL   7
 External module running outside the node process.
Migration types

Whether a component may be migrated to another node at runtime.

#define COMP_MIGRATE_NO   0
 Component must stay on its assigned node.
#define COMP_MIGRATE_ALLOW   1
 Component may be migrated between nodes.
Trigger filter operations

Operation codes for FilterSpec::filter — how a candidate message's user entry is tested before a trigger fires.

#define TRIGGERFILTER_HASKEY   1
 Fire only if the message has the named key.
#define TRIGGERFILTER_EQUALS   2
 String equality between entry value and filter value.
#define TRIGGERFILTER_NOTEQUALS   3
 String inequality.
#define TRIGGERFILTER_EQUALSNUMERIC   4
 Numeric equality.
#define TRIGGERFILTER_NOTEQUALSNUMERIC   5
 Numeric inequality.
#define TRIGGERFILTER_GREATERTHAN   6
 Numeric greater-than.
#define TRIGGERFILTER_LESSTHAN   7
 Numeric less-than.
#define TRIGGERFILTER_MAXAGE   8
 Message must be younger than FilterSpec::time (microseconds).
Index key types

Value interpretations for indexed user entries (see MessageIndex::addIndexKey and RetrieveSpec::keytype).

#define INDEX_TIME   1
 Index the entry as a time (uint64 microseconds).
#define INDEX_STRING   2
 Index the entry as a string.
#define INDEX_INTEGER   3
 Index the entry as an int64.
#define INDEX_FLOAT   4
 Index the entry as a float64.

Detailed Description

Subscription, trigger, retrieval, query, post and signal specifications — the declarative wiring of a Psyclone system.

A Psyclone system is configured by declaring, per component, WHAT it reacts to and what it then does. Those declarations are held in the flat POD spec structs in this file: a TriggerSpec (what type/context/filters fire a crank), with attached FilterSpec, RetrieveSpec, QuerySpec, PostSpec and SignalSpec records laid out back-to-back in the same memory block so a complete trigger definition can be copied through shared memory verbatim. Each spec can be serialised to/from the system XML specification (toXML()/fromXML()).

Note
Time fields such as maxage are stored in MICROSECONDS internally; the XML system specification expresses them in milliseconds and the parser multiplies by 1000 when filling in these structs.
Warning
All spec structs are fixed-layout binary contracts shared across processes — do not change field order, sizes or the MAX...LEN buffer sizes.

Definition in file Subscriptions.h.

Macro Definition Documentation

◆ COMP_CATALOG

#define COMP_CATALOG   2

Catalog: keyed/queryable data store.

Definition at line 38 of file Subscriptions.h.

Referenced by cmlabs::ComponentMemory::getAllCatalogs().

◆ COMP_EXTERNAL

#define COMP_EXTERNAL   7

External module running outside the node process.

Definition at line 44 of file Subscriptions.h.

Referenced by cmlabs::ComponentMemory::getAllModules().

◆ COMP_FEED

#define COMP_FEED   4

Feed: external data feed.

Definition at line 40 of file Subscriptions.h.

◆ COMP_INTERNAL

#define COMP_INTERNAL   6

Internal module (same id as COMP_MODULE).

Definition at line 43 of file Subscriptions.h.

Referenced by cmlabs::ComponentMemory::getAllModules(), and cmlabs::ComponentMemory::UnitTest().

◆ COMP_MIGRATE_ALLOW

#define COMP_MIGRATE_ALLOW   1

Component may be migrated between nodes.

Definition at line 51 of file Subscriptions.h.

◆ COMP_MIGRATE_NO

#define COMP_MIGRATE_NO   0

Component must stay on its assigned node.

Definition at line 50 of file Subscriptions.h.

◆ COMP_MODULE

#define COMP_MODULE   6

Module: user processing component.

Definition at line 42 of file Subscriptions.h.

◆ COMP_SERVICE

#define COMP_SERVICE   5

Service: request/response provider.

Definition at line 41 of file Subscriptions.h.

◆ COMP_STREAM

#define COMP_STREAM   3

Stream: continuous binary/media data channel.

Definition at line 39 of file Subscriptions.h.

◆ COMP_WHITEBOARD

#define COMP_WHITEBOARD   1

Whiteboard: publish/subscribe message store with retention.

Definition at line 37 of file Subscriptions.h.

Referenced by cmlabs::ComponentMemory::getAllCatalogs().

◆ INDEX_FLOAT

#define INDEX_FLOAT   4

Index the entry as a float64.

Definition at line 78 of file Subscriptions.h.

Referenced by cmlabs::MessageIndex::addIndexKey(), cmlabs::MessageIndex::queryMessages(), and cmlabs::MessageIndex::removeIndexKey().

◆ INDEX_INTEGER

#define INDEX_INTEGER   3

◆ INDEX_STRING

#define INDEX_STRING   2

◆ INDEX_TIME

#define INDEX_TIME   1

Index the entry as a time (uint64 microseconds).

Definition at line 75 of file Subscriptions.h.

Referenced by cmlabs::MessageIndex::addIndexKey(), cmlabs::MessageIndex::queryMessages(), cmlabs::MessageIndex::removeIndexKey(), and cmlabs::MessageIndex::UnitTest().

◆ MESSAGE_NON_GUARANTEED

#define MESSAGE_NON_GUARANTEED   1

Delivery policy flag: message delivery is not guaranteed (may be dropped under load).

Definition at line 259 of file Subscriptions.h.

Referenced by cmlabs::PsyAPI::waitForNewMessage().

◆ TRIGGERFILTER_EQUALS

#define TRIGGERFILTER_EQUALS   2

String equality between entry value and filter value.

Definition at line 62 of file Subscriptions.h.

Referenced by cmlabs::TriggerSpec::UnitTest().

◆ TRIGGERFILTER_EQUALSNUMERIC

#define TRIGGERFILTER_EQUALSNUMERIC   4

Numeric equality.

Definition at line 64 of file Subscriptions.h.

◆ TRIGGERFILTER_GREATERTHAN

#define TRIGGERFILTER_GREATERTHAN   6

Numeric greater-than.

Definition at line 66 of file Subscriptions.h.

◆ TRIGGERFILTER_HASKEY

#define TRIGGERFILTER_HASKEY   1

Fire only if the message has the named key.

Definition at line 61 of file Subscriptions.h.

Referenced by cmlabs::TriggerSpec::UnitTest().

◆ TRIGGERFILTER_LESSTHAN

#define TRIGGERFILTER_LESSTHAN   7

Numeric less-than.

Definition at line 67 of file Subscriptions.h.

◆ TRIGGERFILTER_MAXAGE

#define TRIGGERFILTER_MAXAGE   8

Message must be younger than FilterSpec::time (microseconds).

Definition at line 68 of file Subscriptions.h.

◆ TRIGGERFILTER_NOTEQUALS

#define TRIGGERFILTER_NOTEQUALS   3

String inequality.

Definition at line 63 of file Subscriptions.h.

◆ TRIGGERFILTER_NOTEQUALSNUMERIC

#define TRIGGERFILTER_NOTEQUALSNUMERIC   5

Numeric inequality.

Definition at line 65 of file Subscriptions.h.