pub struct Store { /* private fields */ }Expand description
Persistent memory store backed by SQLite.
Implementations§
Source§impl Store
impl Store
Sourcepub async fn upsert_phase_checkpoint(
&self,
run_id: &str,
topology_name: &str,
phase_name: &str,
sender_id: &str,
project: &str,
status: &str,
output: Option<&str>,
error_message: Option<&str>,
attempt: i64,
) -> Result<(), MemoryError>
pub async fn upsert_phase_checkpoint( &self, run_id: &str, topology_name: &str, phase_name: &str, sender_id: &str, project: &str, status: &str, output: Option<&str>, error_message: Option<&str>, attempt: i64, ) -> Result<(), MemoryError>
Create or update a checkpoint for one phase within a run.
Uses INSERT OR REPLACE keyed on (run_id, phase_name), so calling
this multiple times as the phase progresses is safe and idempotent.
Sourcepub async fn get_phase_checkpoint(
&self,
run_id: &str,
phase_name: &str,
) -> Result<Option<PhaseCheckpoint>, MemoryError>
pub async fn get_phase_checkpoint( &self, run_id: &str, phase_name: &str, ) -> Result<Option<PhaseCheckpoint>, MemoryError>
Fetch the checkpoint for a specific phase within a run.
Sourcepub async fn get_run_checkpoints(
&self,
run_id: &str,
) -> Result<Vec<PhaseCheckpoint>, MemoryError>
pub async fn get_run_checkpoints( &self, run_id: &str, ) -> Result<Vec<PhaseCheckpoint>, MemoryError>
Fetch all phase checkpoints for a run, ordered by creation time.
Use this to inspect which phases have already completed when resuming a failed run.
Sourcepub async fn clear_run_checkpoints(
&self,
run_id: &str,
) -> Result<(), MemoryError>
pub async fn clear_run_checkpoints( &self, run_id: &str, ) -> Result<(), MemoryError>
Delete all checkpoints for a run.
Call this after a pipeline run completes successfully to reclaim space, or before re-running a pipeline from scratch.
Source§impl Store
impl Store
Sourcepub async fn build_context(
&self,
channel: &str,
incoming: &Request,
base_system_prompt: &str,
needs: &ContextNeeds,
active_project: Option<&str>,
summarizer: Option<&dyn Summarizer>,
) -> Result<Context, MemoryError>
pub async fn build_context( &self, channel: &str, incoming: &Request, base_system_prompt: &str, needs: &ContextNeeds, active_project: Option<&str>, summarizer: Option<&dyn Summarizer>, ) -> Result<Context, MemoryError>
Build a conversation context from memory for the provider.
The channel parameter identifies the communication channel since
Request is channel-agnostic.
When needs.compact is CompactionStrategy::Summarize and a
summarizer is provided, overflow messages (those beyond
max_context_messages) are summarized and prepended to the system
prompt instead of being silently dropped.
Source§impl Store
impl Store
Sourcepub async fn find_idle_conversations(
&self,
) -> Result<Vec<(String, String, String, String)>, MemoryError>
pub async fn find_idle_conversations( &self, ) -> Result<Vec<(String, String, String, String)>, MemoryError>
Find active conversations that have been idle beyond the timeout.
Sourcepub async fn find_all_active_conversations(
&self,
) -> Result<Vec<(String, String, String, String)>, MemoryError>
pub async fn find_all_active_conversations( &self, ) -> Result<Vec<(String, String, String, String)>, MemoryError>
Find all active conversations (for shutdown).
Sourcepub async fn get_conversation_messages(
&self,
conversation_id: &str,
) -> Result<Vec<(String, String)>, MemoryError>
pub async fn get_conversation_messages( &self, conversation_id: &str, ) -> Result<Vec<(String, String)>, MemoryError>
Get all messages for a conversation (for summarization).
Sourcepub async fn close_conversation(
&self,
conversation_id: &str,
summary: &str,
) -> Result<(), MemoryError>
pub async fn close_conversation( &self, conversation_id: &str, summary: &str, ) -> Result<(), MemoryError>
Close a conversation with a summary.
Sourcepub async fn close_current_conversation(
&self,
channel: &str,
sender_id: &str,
project: &str,
) -> Result<bool, MemoryError>
pub async fn close_current_conversation( &self, channel: &str, sender_id: &str, project: &str, ) -> Result<bool, MemoryError>
Close the current active conversation for a sender + project.
Sourcepub async fn get_recent_summaries(
&self,
channel: &str,
sender_id: &str,
limit: i64,
) -> Result<Vec<(String, String)>, MemoryError>
pub async fn get_recent_summaries( &self, channel: &str, sender_id: &str, limit: i64, ) -> Result<Vec<(String, String)>, MemoryError>
Get recent closed conversation summaries for a sender.
Sourcepub async fn get_all_recent_summaries(
&self,
limit: i64,
) -> Result<Vec<(String, String)>, MemoryError>
pub async fn get_all_recent_summaries( &self, limit: i64, ) -> Result<Vec<(String, String)>, MemoryError>
Get recent conversation summaries across all users.
Sourcepub async fn get_history(
&self,
channel: &str,
sender_id: &str,
limit: i64,
) -> Result<Vec<HistoryRow>, MemoryError>
pub async fn get_history( &self, channel: &str, sender_id: &str, limit: i64, ) -> Result<Vec<HistoryRow>, MemoryError>
Get conversation history (summaries with timestamps) for a sender.
Surfaces conversation_id alongside the summary so consumers can
dispatch follow-up reads (get_message_by_id,
get_recent_summaries) by id rather than by string match.
Sourcepub async fn get_memory_stats(
&self,
sender_id: &str,
) -> Result<(i64, i64, i64, i64), MemoryError>
pub async fn get_memory_stats( &self, sender_id: &str, ) -> Result<(i64, i64, i64, i64), MemoryError>
Get memory statistics for a sender. Tuple shape:
(conversations, messages, observations, facts).
All four counts filter WHERE deleted_at IS NULL where the
underlying table supports soft-delete (facts, observations).
conversations and messages do not (today) carry soft-delete
columns; their counts include every row.
Breaking change (kernex-memory 0.8.0): prior versions
returned a 3-tuple (conversations, messages, facts).
Consumers must destructure four elements after the bump. The
agent-side StatsRecord::observations field now reflects the
true observation count instead of aliasing message count.
Source§impl Store
impl Store
Sourcepub async fn store_fact(
&self,
sender_id: &str,
key: &str,
value: &str,
) -> Result<(), MemoryError>
pub async fn store_fact( &self, sender_id: &str, key: &str, value: &str, ) -> Result<(), MemoryError>
Store a fact (upsert by sender_id + key). If the row was previously
soft-deleted, re-storing clears deleted_at so the value is visible
again to default-filtered reads.
Sourcepub async fn get_fact(
&self,
sender_id: &str,
key: &str,
) -> Result<Option<String>, MemoryError>
pub async fn get_fact( &self, sender_id: &str, key: &str, ) -> Result<Option<String>, MemoryError>
Get a single fact by sender and key. Returns None if the row is
soft-deleted.
Sourcepub async fn delete_fact(
&self,
sender_id: &str,
key: &str,
) -> Result<bool, MemoryError>
pub async fn delete_fact( &self, sender_id: &str, key: &str, ) -> Result<bool, MemoryError>
Hard-delete a single fact by sender and key. Returns true if a row
was deleted. Emergency cleanup only — not exposed on the
MemoryStore trait. Default consumer paths should call
Self::soft_delete_fact.
Sourcepub async fn soft_delete_fact(
&self,
sender_id: &str,
key: &str,
) -> Result<bool, MemoryError>
pub async fn soft_delete_fact( &self, sender_id: &str, key: &str, ) -> Result<bool, MemoryError>
Soft-delete a single fact by setting its deleted_at timestamp.
Returns true if a row transitioned from active to deleted.
Sourcepub async fn get_facts(
&self,
sender_id: &str,
) -> Result<Vec<(String, String)>, MemoryError>
pub async fn get_facts( &self, sender_id: &str, ) -> Result<Vec<(String, String)>, MemoryError>
Get all active (not soft-deleted) facts for a sender.
Sourcepub async fn delete_facts(
&self,
sender_id: &str,
key: Option<&str>,
) -> Result<u64, MemoryError>
pub async fn delete_facts( &self, sender_id: &str, key: Option<&str>, ) -> Result<u64, MemoryError>
Hard-delete facts for a sender — all if key is None, specific
fact if key is Some. Emergency cleanup only — not exposed on the
MemoryStore trait. Default consumer paths should call
Self::soft_delete_facts.
Sourcepub async fn soft_delete_facts(
&self,
sender_id: &str,
key: Option<&str>,
) -> Result<u64, MemoryError>
pub async fn soft_delete_facts( &self, sender_id: &str, key: Option<&str>, ) -> Result<u64, MemoryError>
Soft-delete facts for a sender — every active fact if key is
None, only the matching active fact if key is Some. Returns
the count of rows that transitioned from active to deleted.
Sourcepub async fn list_soft_deleted_facts(
&self,
sender_id: &str,
) -> Result<Vec<(String, String, String)>, MemoryError>
pub async fn list_soft_deleted_facts( &self, sender_id: &str, ) -> Result<Vec<(String, String, String)>, MemoryError>
Read soft-deleted facts for a sender (debug / recovery helper).
Returns (key, value, deleted_at) rows ordered by deletion time
descending.
Sourcepub async fn get_all_facts(&self) -> Result<Vec<(String, String)>, MemoryError>
pub async fn get_all_facts(&self) -> Result<Vec<(String, String)>, MemoryError>
Get all active facts across all users (excluding the welcomed
marker key).
Sourcepub async fn get_all_facts_by_key(
&self,
key: &str,
) -> Result<Vec<(String, String)>, MemoryError>
pub async fn get_all_facts_by_key( &self, key: &str, ) -> Result<Vec<(String, String)>, MemoryError>
Get all active (sender_id, value) pairs for a given fact key
across all users.
Sourcepub async fn is_new_user(&self, sender_id: &str) -> Result<bool, MemoryError>
pub async fn is_new_user(&self, sender_id: &str) -> Result<bool, MemoryError>
Check if a sender has never been welcomed (no active welcomed
fact).
Sourcepub async fn resolve_sender_id(
&self,
sender_id: &str,
) -> Result<String, MemoryError>
pub async fn resolve_sender_id( &self, sender_id: &str, ) -> Result<String, MemoryError>
Resolve a sender_id to its canonical form via the user_aliases table.
Sourcepub async fn create_alias(
&self,
alias_id: &str,
canonical_id: &str,
) -> Result<(), MemoryError>
pub async fn create_alias( &self, alias_id: &str, canonical_id: &str, ) -> Result<(), MemoryError>
Create an alias mapping: alias_id → canonical_id.
Sourcepub async fn find_canonical_user(
&self,
exclude_sender_id: &str,
) -> Result<Option<String>, MemoryError>
pub async fn find_canonical_user( &self, exclude_sender_id: &str, ) -> Result<Option<String>, MemoryError>
Find an existing welcomed user different from sender_id. Skips
soft-deleted welcomed markers.
Sourcepub async fn store_limitation(
&self,
title: &str,
description: &str,
proposed_plan: &str,
) -> Result<bool, MemoryError>
pub async fn store_limitation( &self, title: &str, description: &str, proposed_plan: &str, ) -> Result<bool, MemoryError>
Store a limitation (deduplicates by title, case-insensitive).
Sourcepub async fn get_open_limitations(
&self,
) -> Result<Vec<(String, String, String)>, MemoryError>
pub async fn get_open_limitations( &self, ) -> Result<Vec<(String, String, String)>, MemoryError>
Get all open limitations: (title, description, proposed_plan).
Source§impl Store
impl Store
Sourcepub async fn store_exchange(
&self,
channel: &str,
incoming: &Request,
response: &Response,
project: &str,
) -> Result<(), MemoryError>
pub async fn store_exchange( &self, channel: &str, incoming: &Request, response: &Response, project: &str, ) -> Result<(), MemoryError>
Store a user message and assistant response.
The channel parameter identifies the communication channel (e.g. “api”,
“slack”) since Request is channel-agnostic.
Sourcepub async fn get_message_by_id(
&self,
id: &str,
) -> Result<Option<MessageRow>, MemoryError>
pub async fn get_message_by_id( &self, id: &str, ) -> Result<Option<MessageRow>, MemoryError>
Fetch a single message row by its UUID. Returns None when the
id is missing. The MemoryStore trait method
get_message_by_id delegates here.
Sourcepub async fn search_messages(
&self,
query: &str,
exclude_conversation_id: &str,
sender_id: &str,
limit: i64,
since: Option<SystemTime>,
) -> Result<Vec<MessageRow>, MemoryError>
pub async fn search_messages( &self, query: &str, exclude_conversation_id: &str, sender_id: &str, limit: i64, since: Option<SystemTime>, ) -> Result<Vec<MessageRow>, MemoryError>
Search past messages across all conversations using FTS5 full-text search.
Honors an optional since recency cutoff: when Some, only
messages with timestamp >= since are returned, and limit
applies after the filter (resolves the S-search-2 ambiguity
flagged in the kx-mem-cli-promotion spec).
Source§impl Store
impl Store
Sourcepub async fn save_observation(
&self,
entry: SaveEntry,
) -> Result<Observation, MemoryError>
pub async fn save_observation( &self, entry: SaveEntry, ) -> Result<Observation, MemoryError>
Persist a typed observation. Generates a fresh UUIDv4 id and
sets created_at == updated_at == now. Returns the saved row.
The DB enforces two CHECK constraints that surface as
MemoryError::Sqlite { source: sqlx::Error::Database(..), .. }:
length(title) > 0type IN (<seven enum strings>)(only reachable if the caller bypassesObservationTypeand writes a raw string)
Sourcepub async fn get_observation_by_id(
&self,
id: &str,
) -> Result<Option<Observation>, MemoryError>
pub async fn get_observation_by_id( &self, id: &str, ) -> Result<Option<Observation>, MemoryError>
Fetch an active observation by id. Returns None when the id
is missing OR the row is soft-deleted (CC-9 invariant).
Sourcepub async fn search_observations(
&self,
query: &str,
sender_id: &str,
limit: i64,
since: Option<SystemTime>,
kind: Option<ObservationType>,
) -> Result<Vec<Observation>, MemoryError>
pub async fn search_observations( &self, query: &str, sender_id: &str, limit: i64, since: Option<SystemTime>, kind: Option<ObservationType>, ) -> Result<Vec<Observation>, MemoryError>
FTS5 search across title, what, why, where_field,
learned. Optional since filters by created_at >=; optional
kind narrows to a single observation type. Soft-deleted rows
never appear (the FTS5 triggers on observations_au /
observations_ad keep the mirror in sync).
Result order: FTS5 rank ascending (best match first), then
created_at descending tiebreaker.
Sourcepub async fn soft_delete_observation(
&self,
id: &str,
) -> Result<bool, MemoryError>
pub async fn soft_delete_observation( &self, id: &str, ) -> Result<bool, MemoryError>
Soft-delete an observation by setting deleted_at to “now”.
Returns Ok(true) if a row transitioned from active to deleted,
Ok(false) if the row was already deleted, missing, or never
existed (matches the soft_delete_fact contract).
The observations_au trigger drops the row from
observations_fts automatically; consumers do not need to
touch the FTS mirror.
Sourcepub async fn list_soft_deleted_observations(
&self,
sender_id: &str,
) -> Result<Vec<Observation>, MemoryError>
pub async fn list_soft_deleted_observations( &self, sender_id: &str, ) -> Result<Vec<Observation>, MemoryError>
Read soft-deleted observations for a sender. Recovery helper;
the trait exposes this so future tooling can offer an
“undelete” surface without dropping back to the inherent
Store. Order: most-recently-deleted first.
Source§impl Store
impl Store
Sourcepub async fn store_outcome(
&self,
sender_id: &str,
domain: &str,
score: i32,
lesson: &str,
source: &str,
project: &str,
) -> Result<(), MemoryError>
pub async fn store_outcome( &self, sender_id: &str, domain: &str, score: i32, lesson: &str, source: &str, project: &str, ) -> Result<(), MemoryError>
Store a raw outcome from a REWARD marker.
Sourcepub async fn get_recent_outcomes(
&self,
sender_id: &str,
limit: i64,
project: Option<&str>,
) -> Result<Vec<(i32, String, String, String)>, MemoryError>
pub async fn get_recent_outcomes( &self, sender_id: &str, limit: i64, project: Option<&str>, ) -> Result<Vec<(i32, String, String, String)>, MemoryError>
Get recent outcomes for a sender.
When project is Some, returns only outcomes for that project.
When project is None, returns all outcomes.
Sourcepub async fn get_all_recent_outcomes(
&self,
hours: i64,
limit: i64,
project: Option<&str>,
) -> Result<Vec<(i32, String, String, String)>, MemoryError>
pub async fn get_all_recent_outcomes( &self, hours: i64, limit: i64, project: Option<&str>, ) -> Result<Vec<(i32, String, String, String)>, MemoryError>
Get recent outcomes across all users.
Sourcepub async fn store_lesson(
&self,
sender_id: &str,
domain: &str,
rule: &str,
project: &str,
) -> Result<(), MemoryError>
pub async fn store_lesson( &self, sender_id: &str, domain: &str, rule: &str, project: &str, ) -> Result<(), MemoryError>
Store a distilled lesson with content-based deduplication.
Multiple lessons can exist per (sender_id, domain, project). If the exact
same rule text already exists, its occurrences counter is bumped instead
of creating a duplicate. After insertion, a cap of 10 lessons per
(sender_id, domain, project) is enforced — oldest are pruned.
Sourcepub async fn get_lessons(
&self,
sender_id: &str,
project: Option<&str>,
) -> Result<Vec<(String, String, String)>, MemoryError>
pub async fn get_lessons( &self, sender_id: &str, project: Option<&str>, ) -> Result<Vec<(String, String, String)>, MemoryError>
Get lessons for a sender.
When project is Some, returns project-specific lessons first, then general.
When project is None, returns general lessons only (project = ‘’).
Sourcepub async fn get_all_lessons(
&self,
project: Option<&str>,
) -> Result<Vec<(String, String, String)>, MemoryError>
pub async fn get_all_lessons( &self, project: Option<&str>, ) -> Result<Vec<(String, String, String)>, MemoryError>
Get all lessons across all users.
Source§impl Store
impl Store
Sourcepub async fn store_session(
&self,
channel: &str,
sender_id: &str,
project: &str,
session_id: &str,
) -> Result<(), MemoryError>
pub async fn store_session( &self, channel: &str, sender_id: &str, project: &str, session_id: &str, ) -> Result<(), MemoryError>
Upsert a CLI session for a (channel, sender_id, project) tuple.
Sourcepub async fn get_session(
&self,
channel: &str,
sender_id: &str,
project: &str,
) -> Result<Option<String>, MemoryError>
pub async fn get_session( &self, channel: &str, sender_id: &str, project: &str, ) -> Result<Option<String>, MemoryError>
Look up the CLI session_id for a (channel, sender_id, project) tuple.
Sourcepub async fn clear_session(
&self,
channel: &str,
sender_id: &str,
project: &str,
) -> Result<(), MemoryError>
pub async fn clear_session( &self, channel: &str, sender_id: &str, project: &str, ) -> Result<(), MemoryError>
Delete the CLI session for a specific (channel, sender_id, project).
Sourcepub async fn clear_all_sessions_for_sender(
&self,
sender_id: &str,
) -> Result<(), MemoryError>
pub async fn clear_all_sessions_for_sender( &self, sender_id: &str, ) -> Result<(), MemoryError>
Delete all CLI sessions for a sender.
Source§impl Store
impl Store
Sourcepub async fn create_task(
&self,
channel: &str,
sender_id: &str,
reply_target: &str,
description: &str,
due_at: &str,
repeat: Option<&str>,
task_type: &str,
project: &str,
) -> Result<String, MemoryError>
pub async fn create_task( &self, channel: &str, sender_id: &str, reply_target: &str, description: &str, due_at: &str, repeat: Option<&str>, task_type: &str, project: &str, ) -> Result<String, MemoryError>
Create a scheduled task. Deduplicates on two levels:
- Exact match: same sender + description + normalized due_at.
- Fuzzy match: same sender + similar description + due_at within 30 min.
Sourcepub async fn get_due_tasks(&self) -> Result<Vec<DueTask>, MemoryError>
pub async fn get_due_tasks(&self) -> Result<Vec<DueTask>, MemoryError>
Get tasks that are due for delivery.
Sourcepub async fn claim_due_tasks(&self) -> Result<Vec<DueTask>, MemoryError>
pub async fn claim_due_tasks(&self) -> Result<Vec<DueTask>, MemoryError>
Atomically claim every task that is due: status flips
‘pending’ -> ‘claimed’ and the claimed rows are returned in the same
statement, so when several pollers (an HTTP server, an open REPL, a
one-shot drain) share a store, each due task is handed to exactly one
of them. Claims left behind by a dead claimer become reclaimable
after [CLAIM_STALE_MINUTES].
The claim is released by Store::complete_task (recurring tasks
return to ‘pending’ at the next due time) or Store::fail_task
(retries return to ‘pending’).
Sourcepub async fn record_task_run(
&self,
task_id: &str,
started_at: &str,
status: &str,
result: Option<&str>,
error: Option<&str>,
tokens_used: Option<u64>,
) -> Result<String, MemoryError>
pub async fn record_task_run( &self, task_id: &str, started_at: &str, status: &str, result: Option<&str>, error: Option<&str>, tokens_used: Option<u64>, ) -> Result<String, MemoryError>
Record one execution of a scheduled task. status must be
"completed" or "failed" (DB CHECK); finished_at is stamped
server-side. Returns the new run id.
Sourcepub async fn list_task_runs(
&self,
task_id_prefix: &str,
limit: u32,
) -> Result<Vec<TaskRunRecord>, MemoryError>
pub async fn list_task_runs( &self, task_id_prefix: &str, limit: u32, ) -> Result<Vec<TaskRunRecord>, MemoryError>
Recorded runs for tasks whose id starts with task_id_prefix,
newest first, capped at limit.
Sourcepub async fn complete_task(
&self,
id: &str,
repeat: Option<&str>,
) -> Result<(), MemoryError>
pub async fn complete_task( &self, id: &str, repeat: Option<&str>, ) -> Result<(), MemoryError>
Complete a task: one-shot tasks become ‘delivered’, recurring tasks advance due_at.
Sourcepub async fn fail_task(
&self,
id: &str,
error: &str,
max_retries: u32,
) -> Result<bool, MemoryError>
pub async fn fail_task( &self, id: &str, error: &str, max_retries: u32, ) -> Result<bool, MemoryError>
Fail an action task: increment retry count and either reschedule or permanently fail.
Returns true if the task will be retried, false if permanently failed.
Sourcepub async fn get_tasks_for_sender(
&self,
sender_id: &str,
) -> Result<Vec<(String, String, String, Option<String>, String, String)>, MemoryError>
pub async fn get_tasks_for_sender( &self, sender_id: &str, ) -> Result<Vec<(String, String, String, Option<String>, String, String)>, MemoryError>
Get pending tasks for a sender.
Sourcepub async fn cancel_task(
&self,
id_prefix: &str,
sender_id: &str,
) -> Result<bool, MemoryError>
pub async fn cancel_task( &self, id_prefix: &str, sender_id: &str, ) -> Result<bool, MemoryError>
Cancel a task by ID prefix (must match sender).
Sourcepub async fn update_task(
&self,
id_prefix: &str,
sender_id: &str,
description: Option<&str>,
due_at: Option<&str>,
repeat: Option<&str>,
) -> Result<bool, MemoryError>
pub async fn update_task( &self, id_prefix: &str, sender_id: &str, description: Option<&str>, due_at: Option<&str>, repeat: Option<&str>, ) -> Result<bool, MemoryError>
Update fields of a pending task by ID prefix (must match sender).
Sourcepub async fn defer_task(
&self,
id: &str,
new_due_at: &str,
) -> Result<(), MemoryError>
pub async fn defer_task( &self, id: &str, new_due_at: &str, ) -> Result<(), MemoryError>
Defer a pending task to a new due_at time (by exact ID).
Source§impl Store
impl Store
Sourcepub async fn record_usage(
&self,
sender_id: &str,
session_id: &str,
tokens: u64,
model: &str,
) -> Result<(), MemoryError>
pub async fn record_usage( &self, sender_id: &str, session_id: &str, tokens: u64, model: &str, ) -> Result<(), MemoryError>
Record token usage for a completed API request, total tokens only.
Thin wrapper over Store::record_usage_full for callers that do not
have a per-dimension breakdown. Cost is estimated using known per-model
pricing; unrecognized models record cost as 0.0.
Sourcepub async fn record_usage_full(
&self,
sender_id: &str,
session_id: &str,
tokens: u64,
model: &str,
breakdown: UsageBreakdown,
) -> Result<(), MemoryError>
pub async fn record_usage_full( &self, sender_id: &str, session_id: &str, tokens: u64, model: &str, breakdown: UsageBreakdown, ) -> Result<(), MemoryError>
Record token usage with a per-dimension breakdown.
tokens is the authoritative total used for cost estimation and
summary aggregation. The breakdown columns are stored verbatim and
surface in UsageSummary for cost telemetry (e.g. cache hit ratio).
Sourcepub async fn get_session_usage(
&self,
session_id: &str,
) -> Result<UsageSummary, MemoryError>
pub async fn get_session_usage( &self, session_id: &str, ) -> Result<UsageSummary, MemoryError>
Get aggregated token usage for a session.
Sourcepub async fn get_total_usage(&self) -> Result<UsageSummary, MemoryError>
pub async fn get_total_usage(&self) -> Result<UsageSummary, MemoryError>
Get aggregated token usage across all sessions in the store.
Useful for project-wide cost reporting (e.g. the kx /cost
command) when callers do not maintain a stable session id.
Source§impl Store
impl Store
Sourcepub async fn new(config: &MemoryConfig) -> Result<Self, MemoryError>
pub async fn new(config: &MemoryConfig) -> Result<Self, MemoryError>
Create a new store, running migrations on first use.
Sourcepub fn pool(&self) -> &SqlitePool
pub fn pool(&self) -> &SqlitePool
Get a reference to the underlying connection pool.
Trait Implementations§
Source§impl MemoryStore for Store
impl MemoryStore for Store
Source§fn close_current_conversation<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
channel: &'life1 str,
sender_id: &'life2 str,
project: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<bool, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn close_current_conversation<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
channel: &'life1 str,
sender_id: &'life2 str,
project: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<bool, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
(channel, sender_id, project) as
closed. Returns true if a row transitioned from active to closed.Source§fn get_memory_stats<'life0, 'life1, 'async_trait>(
&'life0 self,
sender_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(i64, i64, i64, i64), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_memory_stats<'life0, 'life1, 'async_trait>(
&'life0 self,
sender_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(i64, i64, i64, i64), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
(conversation_count, message_count, observation_count, fact_count). Read moreSource§fn db_size<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn db_size<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get_total_usage<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<UsageSummary, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_total_usage<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<UsageSummary, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get_history<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
channel: &'life1 str,
sender_id: &'life2 str,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<HistoryRow>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_history<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
channel: &'life1 str,
sender_id: &'life2 str,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<HistoryRow>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
limit.Source§fn search_messages<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
query: &'life1 str,
exclude_conversation_id: &'life2 str,
sender_id: &'life3 str,
limit: i64,
since: Option<SystemTime>,
) -> Pin<Box<dyn Future<Output = Result<Vec<MessageRow>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn search_messages<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
query: &'life1 str,
exclude_conversation_id: &'life2 str,
sender_id: &'life3 str,
limit: i64,
since: Option<SystemTime>,
) -> Pin<Box<dyn Future<Output = Result<Vec<MessageRow>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
since is Some, only rows with
timestamp >= since are returned and limit applies after the
recency filter.Source§fn get_message_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<MessageRow>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_message_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<MessageRow>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
None when the
id is missing.Source§fn store_fact<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sender_id: &'life1 str,
key: &'life2 str,
value: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn store_fact<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sender_id: &'life1 str,
key: &'life2 str,
value: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
(sender_id, key). If the row was previously
soft-deleted, this clears deleted_at so the value is visible
again to default-filtered reads.Source§fn get_fact<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sender_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_fact<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sender_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
(sender_id, key). Returns None if
the row is soft-deleted, missing, or never existed.Source§fn get_facts<'life0, 'life1, 'async_trait>(
&'life0 self,
sender_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_facts<'life0, 'life1, 'async_trait>(
&'life0 self,
sender_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
sender_id.Source§fn soft_delete_fact<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sender_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<bool, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn soft_delete_fact<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sender_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<bool, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
deleted_at timestamp.
Returns true if a row transitioned from active to deleted; false
if the row was already deleted, missing, or never existed.Source§fn soft_delete_facts<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sender_id: &'life1 str,
key: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<u64, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn soft_delete_facts<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sender_id: &'life1 str,
key: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<u64, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Some(key), soft-deletes that
specific key. With None, soft-deletes every active fact for the
sender. Returns the count of rows that transitioned from active to
deleted.Source§fn list_soft_deleted_facts<'life0, 'life1, 'async_trait>(
&'life0 self,
sender_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String, String)>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_soft_deleted_facts<'life0, 'life1, 'async_trait>(
&'life0 self,
sender_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String, String)>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
(key, value, deleted_at) rows for sender_id.Source§fn save_observation<'life0, 'async_trait>(
&'life0 self,
entry: SaveEntry,
) -> Pin<Box<dyn Future<Output = Result<Observation, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn save_observation<'life0, 'async_trait>(
&'life0 self,
entry: SaveEntry,
) -> Pin<Box<dyn Future<Output = Result<Observation, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
created_at == updated_at == now. The
DB enforces length(title) > 0 and the seven-value type CHECK
constraint; violations surface as MemoryError::Sqlite.Source§fn get_observation_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Observation>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_observation_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Observation>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
None when the id is
missing OR the row is soft-deleted (CC-9 invariant). Mirrors the
get_message_by_id shape introduced in 0.7.0.Source§fn search_observations<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
sender_id: &'life2 str,
limit: i64,
since: Option<SystemTime>,
kind: Option<ObservationType>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Observation>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn search_observations<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
sender_id: &'life2 str,
limit: i64,
since: Option<SystemTime>,
kind: Option<ObservationType>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Observation>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
since filters by created_at >=; optional kind
narrows to a single type. Soft-deleted rows never appear.Source§fn soft_delete_observation<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn soft_delete_observation<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Ok(true) on
transition from active to deleted; Ok(false) when the row was
already deleted, missing, or never existed (matches the
soft_delete_fact contract).Source§fn list_soft_deleted_observations<'life0, 'life1, 'async_trait>(
&'life0 self,
sender_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Observation>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_soft_deleted_observations<'life0, 'life1, 'async_trait>(
&'life0 self,
sender_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Observation>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Store.Source§fn create_task<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'life7, 'life8, 'async_trait>(
&'life0 self,
channel: &'life1 str,
sender_id: &'life2 str,
reply_target: &'life3 str,
description: &'life4 str,
due_at: &'life5 str,
repeat: Option<&'life6 str>,
task_type: &'life7 str,
project: &'life8 str,
) -> Pin<Box<dyn Future<Output = Result<String, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait,
'life7: 'async_trait,
'life8: 'async_trait,
fn create_task<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'life7, 'life8, 'async_trait>(
&'life0 self,
channel: &'life1 str,
sender_id: &'life2 str,
reply_target: &'life3 str,
description: &'life4 str,
due_at: &'life5 str,
repeat: Option<&'life6 str>,
task_type: &'life7 str,
project: &'life8 str,
) -> Pin<Box<dyn Future<Output = Result<String, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait,
'life7: 'async_trait,
'life8: 'async_trait,
Source§fn get_tasks_for_sender<'life0, 'life1, 'async_trait>(
&'life0 self,
sender_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String, String, Option<String>, String, String)>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_tasks_for_sender<'life0, 'life1, 'async_trait>(
&'life0 self,
sender_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String, String, Option<String>, String, String)>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
sender_id as raw (id, description, due_at, repeat, task_type, project) rows, ordered by due_at ascending.Source§fn complete_task<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
repeat: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn complete_task<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
repeat: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Some("daily") / Some("weekly") /
etc., reschedules the next occurrence; with None or Some("once"),
the task transitions to a terminal status.Source§fn fail_task<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
error: &'life2 str,
max_retries: u32,
) -> Pin<Box<dyn Future<Output = Result<bool, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fail_task<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
error: &'life2 str,
max_retries: u32,
) -> Pin<Box<dyn Future<Output = Result<bool, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
true if the
task transitioned to a terminal state.Source§fn cancel_task<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id_prefix: &'life1 str,
sender_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<bool, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn cancel_task<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id_prefix: &'life1 str,
sender_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<bool, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
id_prefix, scoped to
sender_id. Returns true if a row was cancelled.Source§fn get_due_tasks<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<DueTask>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_due_tasks<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<DueTask>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
due_at is in the past.Source§fn claim_due_tasks<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<DueTask>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn claim_due_tasks<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<DueTask>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
complete_task (recurring tasks
return to ‘pending’ at the next due time) or fail_task (retries
return to ‘pending’).Source§fn record_task_run<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
started_at: &'life2 str,
status: &'life3 str,
result: Option<&'life4 str>,
error: Option<&'life5 str>,
tokens_used: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<String, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
fn record_task_run<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
started_at: &'life2 str,
status: &'life3 str,
result: Option<&'life4 str>,
error: Option<&'life5 str>,
tokens_used: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<String, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
status must be
"completed" or "failed". Returns the new run id.Source§fn list_task_runs<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id_prefix: &'life1 str,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<TaskRunRecord>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_task_runs<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id_prefix: &'life1 str,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<TaskRunRecord>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
task_id_prefix,
newest first, capped at limit.Auto Trait Implementations§
impl !RefUnwindSafe for Store
impl !UnwindSafe for Store
impl Freeze for Store
impl Send for Store
impl Sync for Store
impl Unpin for Store
impl UnsafeUnpin for Store
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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