store: remove visit tracking infrastructure
Remove AgentVisit, TranscriptSegment, and all related visit tracking code. Provenance is what we've been using to track agent interaction with nodes. Also removes dead fields from Node (state_tag, created). -349 lines. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
7d49f29fde
commit
a1accc7cd4
8 changed files with 7 additions and 349 deletions
|
|
@ -148,8 +148,6 @@ pub enum Filter {
|
|||
Age(Cmp), // vs now - timestamp (seconds)
|
||||
ContentLen(Cmp),
|
||||
Provenance(String),
|
||||
NotVisited { agent: String, duration: i64 }, // seconds
|
||||
Visited { agent: String },
|
||||
Negated(Box<Filter>),
|
||||
}
|
||||
|
||||
|
|
@ -185,8 +183,6 @@ pub enum ScoreField {
|
|||
Weight,
|
||||
ContentLen,
|
||||
Priority,
|
||||
/// Time since last visit by named agent. 1.0 = never visited, decays toward 0.
|
||||
Recency(String),
|
||||
}
|
||||
|
||||
/// Numeric comparison operator.
|
||||
|
|
@ -243,17 +239,6 @@ fn score_field(
|
|||
// Priority is already roughly 0-1 from the scoring function
|
||||
p.min(1.0)
|
||||
}
|
||||
ScoreField::Recency(agent) => {
|
||||
let last = store.last_visited(key, agent);
|
||||
if last == 0 {
|
||||
1.0 // never visited = highest recency score
|
||||
} else {
|
||||
let age = (crate::store::now_epoch() - last) as f64;
|
||||
// Sigmoid decay: 1.0 at 7+ days, ~0.5 at 1 day, ~0.1 at 1 hour
|
||||
let hours = age / 3600.0;
|
||||
1.0 - (-0.03 * hours).exp()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -306,8 +291,6 @@ impl fmt::Display for Filter {
|
|||
Filter::Age(c) => write!(f, "age:{}", c),
|
||||
Filter::ContentLen(c) => write!(f, "content-len:{}", c),
|
||||
Filter::Provenance(p) => write!(f, "provenance:{}", p),
|
||||
Filter::NotVisited { agent, duration } => write!(f, "not-visited:{},{}s", agent, duration),
|
||||
Filter::Visited { agent } => write!(f, "visited:{}", agent),
|
||||
Filter::Negated(inner) => write!(f, "!{}", inner),
|
||||
}
|
||||
}
|
||||
|
|
@ -441,13 +424,6 @@ pub fn eval_filter(filt: &Filter, key: &str, store: &Store, now: i64) -> bool {
|
|||
}
|
||||
Filter::ContentLen(cmp) => cmp.matches(node.content.len() as f64),
|
||||
Filter::Provenance(p) => node.provenance == *p,
|
||||
Filter::NotVisited { agent, duration } => {
|
||||
let last = store.last_visited(key, agent);
|
||||
last == 0 || (now - last) > *duration
|
||||
}
|
||||
Filter::Visited { agent } => {
|
||||
store.last_visited(key, agent) > 0
|
||||
}
|
||||
Filter::Negated(inner) => !eval_filter(inner, key, store, now),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,8 +100,6 @@ peg::parser! {
|
|||
/ "key:" g:glob_pattern() { Stage::Filter(Filter::KeyGlob(g)) }
|
||||
/ "!key:" g:glob_pattern() { Stage::Filter(Filter::Negated(Box::new(Filter::KeyGlob(g)))) }
|
||||
/ "provenance:" p:ident() { Stage::Filter(Filter::Provenance(p)) }
|
||||
/ "not-visited:" a:ident() "," d:integer() { Stage::Filter(Filter::NotVisited { agent: a, duration: d as i64 }) }
|
||||
/ "visited:" a:ident() { Stage::Filter(Filter::Visited { agent: a }) }
|
||||
/ "all" { Stage::Generator(Generator::All) }
|
||||
// Graph algorithms
|
||||
/ "spread" { Stage::Algorithm(AlgoStage { algo: Algorithm::Spread, params: std::collections::HashMap::new() }) }
|
||||
|
|
@ -123,8 +121,7 @@ peg::parser! {
|
|||
/ f:field() { make_sort_field(&f, false) }
|
||||
|
||||
rule score_term() -> (ScoreField, f64)
|
||||
= "recency(" a:ident() ")" "*" w:number() { (ScoreField::Recency(a), w) }
|
||||
/ f:score_field_name() "*" w:number() { (f, w) }
|
||||
= f:score_field_name() "*" w:number() { (f, w) }
|
||||
|
||||
rule score_field_name() -> ScoreField
|
||||
= "isolation" { ScoreField::Isolation }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue