pub struct ContextBus { /* private fields */ }Implementations§
Source§impl ContextBus
impl ContextBus
pub fn new() -> Self
Sourcepub fn open_at(path: PathBuf) -> Self
pub fn open_at(path: PathBuf) -> Self
Open a ContextBus backed by the given SQLite path. Useful for tests that need an isolated database to avoid contention on Windows CI.
Sourcepub fn try_open_at(path: PathBuf) -> Result<Self, ObservationPersistenceError>
pub fn try_open_at(path: PathBuf) -> Result<Self, ObservationPersistenceError>
Open without panicking or silently substituting a different data directory.
pub fn subscribe( &self, workspace_id: &str, channel_id: &str, ) -> Option<Receiver<ContextEventV1>>
Sourcepub fn subscribe_filtered(
&self,
workspace_id: &str,
channel_id: &str,
filter: TopicFilter,
) -> Option<FilteredSubscription>
pub fn subscribe_filtered( &self, workspace_id: &str, channel_id: &str, filter: TopicFilter, ) -> Option<FilteredSubscription>
Subscribe with a filter — only events matching the filter are delivered.
Returns (Receiver, TopicFilter) for use in filtered receive loops.
pub fn append( &self, workspace_id: &str, channel_id: &str, kind: &ContextEventKindV1, actor: Option<&str>, payload: Value, ) -> Option<ContextEventV1>
Sourcepub fn append_ocla_observation(
&self,
producer_instance: &str,
record: &OclaBusRecord,
) -> Result<i64, ObservationPersistenceError>
pub fn append_ocla_observation( &self, producer_instance: &str, record: &OclaBusRecord, ) -> Result<i64, ObservationPersistenceError>
Persist an OCLA record in the ContextBus-owned private observation table.
The table is deliberately outside context_events, so normal replay,
search, lineage, and subscriptions cannot expose local observations.
Sourcepub fn append_legacy_observation(
&self,
producer_instance: &str,
event: &LeanCtxEvent,
) -> Result<i64, ObservationPersistenceError>
pub fn append_legacy_observation( &self, producer_instance: &str, event: &LeanCtxEvent, ) -> Result<i64, ObservationPersistenceError>
Persist a legacy event as a compatibility observation without appending to the immutable historical JSONL journal.
Sourcepub fn read_local_observations(
&self,
limit: usize,
) -> Result<Vec<LocalObservationV1>, ObservationPersistenceError>
pub fn read_local_observations( &self, limit: usize, ) -> Result<Vec<LocalObservationV1>, ObservationPersistenceError>
Read private observations for regression and compatibility readers.
pub fn read_legacy_observations( &self, limit: usize, ) -> Result<Vec<LeanCtxEvent>, ObservationPersistenceError>
pub fn append_with_parent( &self, workspace_id: &str, channel_id: &str, kind: &ContextEventKindV1, actor: Option<&str>, payload: Value, parent_id: Option<i64>, ) -> Option<ContextEventV1>
Sourcepub fn append_directed(
&self,
workspace_id: &str,
channel_id: &str,
kind: &ContextEventKindV1,
actor: Option<&str>,
payload: Value,
target_agents: Vec<String>,
) -> Option<ContextEventV1>
pub fn append_directed( &self, workspace_id: &str, channel_id: &str, kind: &ContextEventKindV1, actor: Option<&str>, payload: Value, target_agents: Vec<String>, ) -> Option<ContextEventV1>
Append an event directed at specific agents only.
Only subscribers whose TopicFilter.agent_id matches a target will see it.
pub fn read( &self, workspace_id: &str, channel_id: &str, since: i64, limit: usize, ) -> Vec<ContextEventV1>
Sourcepub fn append_delivery_once(
&self,
workspace_id: &str,
channel_id: &str,
kind: &ContextEventKindV1,
actor: Option<&str>,
payload: Value,
delivery_id: &str,
target_agents: Option<Vec<String>>,
) -> Result<bool, String>
pub fn append_delivery_once( &self, workspace_id: &str, channel_id: &str, kind: &ContextEventKindV1, actor: Option<&str>, payload: Value, delivery_id: &str, target_agents: Option<Vec<String>>, ) -> Result<bool, String>
Atomically append at most one event for an authenticated delivery ID.
target_agents scopes the event like Self::append_directed: when
set, only subscribers and readers identifying as one of the targets see
it, live and on replay.
Sourcepub fn recent_by_kind(
&self,
workspace_id: &str,
channel_id: &str,
kind: &str,
limit: usize,
) -> Vec<ContextEventV1>
pub fn recent_by_kind( &self, workspace_id: &str, channel_id: &str, kind: &str, limit: usize, ) -> Vec<ContextEventV1>
Query recent events of a specific kind (for conflict detection).
Sourcepub fn search(
&self,
workspace_id: &str,
channel_id: Option<&str>,
query: &str,
limit: usize,
) -> Vec<ContextEventV1>
pub fn search( &self, workspace_id: &str, channel_id: Option<&str>, query: &str, limit: usize, ) -> Vec<ContextEventV1>
Full-text search over event payloads via FTS5.
Trait Implementations§
Source§impl Clone for ContextBus
impl Clone for ContextBus
Auto Trait Implementations§
impl Forget for ContextBus
impl Freeze for ContextBus
impl Move for ContextBus
impl RefUnwindSafe for ContextBus
impl Send for ContextBus
impl Sync for ContextBus
impl Unpin for ContextBus
impl UnsafeUnpin for ContextBus
impl UnwindSafe for ContextBus
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more