Class TriggerStore

Inheritance Relationships

Derived Type

Class Documentation

class TriggerStore

Abstract trigger persistence backend.

Implementations must be thread-safe. The default implementation is SqliteTriggerStore; gateway plugins may provide alternatives.

Subclassed by ros2_medkit_gateway::SqliteTriggerStore

Public Functions

virtual ~TriggerStore() = default
virtual tl::expected<void, std::string> save(const TriggerInfo &trigger) = 0

Persist a new (or replace an existing) trigger.

virtual tl::expected<void, std::string> update(const std::string &id, const nlohmann::json &fields) = 0

Partially update a trigger by ID. fields is a JSON object whose keys map to TriggerInfo field names (e.g. {“status”:”TERMINATED”}).

virtual tl::expected<void, std::string> remove(const std::string &id) = 0

Remove a trigger by ID.

virtual tl::expected<std::vector<TriggerInfo>, std::string> load_all() = 0

Load every trigger in the store.

virtual tl::expected<void, std::string> save_state(const std::string &trigger_id, const nlohmann::json &previous_value) = 0

Persist opaque evaluator state (e.g. previous value) for a trigger.

virtual tl::expected<std::optional<nlohmann::json>, std::string> load_state(const std::string &trigger_id) = 0

Load evaluator state for a trigger. Returns nullopt when no state exists.