lc_event_emitter (faber_neuroevolution v1.2.4)
View SourceZero-config event emitter for Liquid Conglomerate silos.
Provides fire-and-forget event emission that automatically uses esdb_lineage_backend when available. If the backend is not installed, events are silently dropped (no-op).
Auto-detects if faber_neuroevolution_esdb is available. If the esdb_lineage_backend module exists, events are persisted. Otherwise, emit/3 returns ok immediately (no-op).
Event emission never blocks the silo. Backend state is cached in persistent_term for efficiency. The backend uses spawn for async writes and errors are logged, not propagated.
Events are routed to streams using the pattern: lc-REALM.SILO_TYPE
Summary
Functions
Emit a single LC silo event (fire-and-forget). Uses the default realm from the event payload or "default".
Emit a single LC silo event with explicit realm (fire-and-forget).
Emit a batch of LC silo events (fire-and-forget). Each event map should have keys: silo, event_type, realm (optional), payload.
Get the cached backend state.
Check if the event store backend is available.
Functions
-spec emit(SiloType, EventType, Payload) -> ok when SiloType :: atom(), EventType :: atom(), Payload :: map().
Emit a single LC silo event (fire-and-forget). Uses the default realm from the event payload or "default".
-spec emit(SiloType, EventType, Realm, Payload) -> ok when SiloType :: atom(), EventType :: atom(), Realm :: binary(), Payload :: map().
Emit a single LC silo event with explicit realm (fire-and-forget).
-spec emit_batch(Events) -> ok when Events :: [map()].
Emit a batch of LC silo events (fire-and-forget). Each event map should have keys: silo, event_type, realm (optional), payload.
-spec get_backend_state() -> term() | undefined.
Get the cached backend state.
Initializes the backend on first call if available. Returns undefined if backend is not available.
-spec is_backend_available() -> boolean().
Check if the event store backend is available.
Result is cached after first check.