pub trait FeedbackStore {
// Required methods
fn record(
&self,
ref_name: &str,
entry: &FeedbackEntry,
agent_id: &str,
) -> Result<()>;
fn list_for_symbol(
&self,
ref_name: &str,
symbol_id: &str,
) -> Result<Vec<FeedbackEntry>>;
fn list_all(&self, ref_name: &str) -> Result<Vec<FeedbackEntry>>;
fn purge(
&self,
ref_name: &str,
entry_id: &str,
) -> Result<Option<FeedbackEntry>>;
// Provided methods
fn withdraw(
&self,
ref_name: &str,
entry_id: &str,
by: &str,
reason: Option<&str>,
) -> Result<Option<FeedbackEntry>> { ... }
fn flat_verdicts(
&self,
ref_name: &str,
) -> Result<Vec<(String, String, FeedbackVerdict, DateTime<Utc>)>> { ... }
fn flat_file_scope_verdicts(
&self,
ref_name: &str,
) -> Result<Vec<(String, FeedbackVerdict, String, DateTime<Utc>)>> { ... }
}Required Methods§
Sourcefn record(
&self,
ref_name: &str,
entry: &FeedbackEntry,
agent_id: &str,
) -> Result<()>
fn record( &self, ref_name: &str, entry: &FeedbackEntry, agent_id: &str, ) -> Result<()>
Record a verdict for a (query, symbol) pair.
Sourcefn list_for_symbol(
&self,
ref_name: &str,
symbol_id: &str,
) -> Result<Vec<FeedbackEntry>>
fn list_for_symbol( &self, ref_name: &str, symbol_id: &str, ) -> Result<Vec<FeedbackEntry>>
All feedback entries recorded for a specific symbol.
Sourcefn list_all(&self, ref_name: &str) -> Result<Vec<FeedbackEntry>>
fn list_all(&self, ref_name: &str) -> Result<Vec<FeedbackEntry>>
Every feedback entry in the store.
Sourcefn purge(&self, ref_name: &str, entry_id: &str) -> Result<Option<FeedbackEntry>>
fn purge(&self, ref_name: &str, entry_id: &str) -> Result<Option<FeedbackEntry>>
Hard-delete a verdict from both stores. Returns the entry as it was,
or None if no such entry existed.
The escape hatch a tombstone cannot serve: test data written by
mistake, or a secret pasted into a --note. For anything else
withdraw is the right verb — it retracts the verdict while keeping
the record, which still explains a past ranking.
Deletes the authoritative store first, then the SQLite cache, and
fails loudly if the second step does not happen: a purge that clears
only the tree leaves list_all’s cache fast path still serving the
verdict.
Provided Methods§
Sourcefn withdraw(
&self,
ref_name: &str,
entry_id: &str,
by: &str,
reason: Option<&str>,
) -> Result<Option<FeedbackEntry>>
fn withdraw( &self, ref_name: &str, entry_id: &str, by: &str, reason: Option<&str>, ) -> Result<Option<FeedbackEntry>>
Retract a verdict so it stops influencing ranking, keeping the record.
Default implementation re-records the entry with the withdrawal stamped
on it. That deliberately reuses FeedbackStore::record, which is the
only write path that updates BOTH the authoritative store and the
SQLite write-through cache — a bespoke write touching one would leave
the other serving the verdict as live. See DESIGN.md, “Feedback
withdrawal — tombstone shape”.
Idempotent: withdrawing an already-withdrawn entry keeps the original timestamp rather than moving it.
Sourcefn flat_verdicts(
&self,
ref_name: &str,
) -> Result<Vec<(String, String, FeedbackVerdict, DateTime<Utc>)>>
fn flat_verdicts( &self, ref_name: &str, ) -> Result<Vec<(String, String, FeedbackVerdict, DateTime<Utc>)>>
Flatten all feedback into (symbol_id, query, verdict, created_at)
tuples for use in apply_feedback_adjustments. Plan J t-016 added
created_at so the boost arithmetic can decay Useful verdicts by
age — a 6-month-old opinion about a codebase shouldn’t carry the
same weight as yesterday’s.
Sourcefn flat_file_scope_verdicts(
&self,
ref_name: &str,
) -> Result<Vec<(String, FeedbackVerdict, String, DateTime<Utc>)>>
fn flat_file_scope_verdicts( &self, ref_name: &str, ) -> Result<Vec<(String, FeedbackVerdict, String, DateTime<Utc>)>>
Flatten file-scoped feedback into (file_glob, verdict, query, created_at)
tuples for use in apply_file_scope_feedback. Plan J t-016: same
reason — decay file-scope Useful verdicts by age.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".