Side B is a substantive architectural fix: it removes duplicate/inconsistent storage (EntityStore + projection), stops persisting full Reddit payloads in the append-only log (likely a real API/ToS and storage-growth concern), and replaces it with ephemeral projection content plus a TTL eviction task — all while keeping votes/tree structure intact and updating every touched module and test coherently. Side A is a well-tested new feature (URL canonicalization graph) but is additive and isolated, whereas B simplifies and corrects a core data-lifecycle problem across the whole system.
constitution · epochs · watch · epoch 3
c_9bced108c8aa (tommy-mor) vs c_5cd3e5917d2f (tommy-mor)
download prompt · raw event · cmp_75337612fa7e76
council reasoning
B makes a lasting architectural correction by deleting EntityStore/EntityImported, stopping raw Reddit payloads from entering the durable event log, writing display fields only as TTL-evicted projection cache, and keeping NodeEnsured/votes/structure as the sole logged facts—directly reducing retention/compliance risk and long-term log bloat. A adds a solid, well-tested URL DFA/canonicalization graph (parse, builder, Reddit/YouTube rules, generic fallback), but that is additive domain logic rather than a core persistence-model fix.
Side B makes a durable architectural change by removing persistent storage of Reddit API payloads (`EntityStore` and `EntityImported` events), replacing it with ephemeral projection-only content, TTL-based eviction, and a simplified replay path that logs only `NodeEnsured` structure. Side A introduces a substantial URL canonicalization graph with parsing, generic fallbacks, builders, and extensive tests, but it is largely additive functionality, whereas Side B simplifies core persistence semantics and better aligns the storage model with long-term policy and replay behavior.
sides
A — c_9bced108c8aa (tommy-mor)
message
[15e1037a] url stuff
diff preview
diff --git a/server/src/url_rules/graph.rs b/server/src/url_rules/graph.rs
new file mode 100644
index 0000000000000000000000000000000000000000..f7ac0f9a551a1727cb2f9294778c283b9885b147
--- /dev/null
+++ b/server/src/url_rules/graph.rs
@@ -0,0 +1,831 @@
+//! Semantic URL graph: DFA traversal on host + path, query in context, generic fallback.
+
+use std::collections::HashMap;
+use std::sync::OnceLock;
+
+use url::Url;
+
+use super::graph_builder::GraphBuilder;
+use super::parse::{normalize_match_host, strip_tracking_query, UrlParts};
+
+#[derive(Debug, Clone, Default)]
+pub struct Context {
+ pub vars: HashMap<String, String>,
+ pub query: HashMap<String, String>,
+}
+
+pub type CanonicalFn = fn(&Context) -> Option<String>;
+
+#[derive(Clone, Copy)]
+pub enum EdgePattern {
+ Literal(&'static str),
+ Variable(&'static str),
+ /// Absorb any trailing segment without leaving this node (e.g. post title slug).
+ AbsorbAny,
+ /// Absorb segment when `cond(seg)` (e.g. subreddit listing suffix).
+ AbsorbIf(fn(&str) -> bool),
+}
+
+pub struct Edge {
+ pub pattern: EdgePattern,
+ pub target: &'static str,
+}
+
+pub struct Node {
+ pub edges: Vec<Edge>,
+ pub canonical: CanonicalFn,
+ pub parent: Option<&'static str>,
+}
+
+impl Node {
+ pub(crate) fn empty() -> Self {
+ Self {
+ edges: Vec::new(),
+ canonical: |_| None,
+ parent: None,
+ }
+ }
+}
+
+pub struct Graph {
+ pub nodes: HashMap<&'static str, Node>,
+}
+
+static GRAPH: OnceLock<Graph> = OnceLock::new();
+
+pub fn graph() -> &'static Graph {
+ GRAPH.get_or_init(build_graph)
+}
+
+impl Graph {
+ pub fn resolve_canonical(&self, parts: &UrlParts) -> Option<String> {
+ let mut query = parts.query.clone();
+ strip_tracking_query(&mut query);
+ let mut ctx = Context {
+ vars: HashMap::new(),
+ query,
+ };
+
+ if let Some(node_id) = self.traverse(parts, &mut ctx) {
+ if let Some(canon) = (self.nodes.get(node_id)?.canonical)(&ctx) {
+ return Some(canon);
+ }
+ }
+ Some(generic_canonical(parts))
+ }
+
+ pub fn breadcrumbs(&self, parts: &UrlParts) -> Vec<String> {
+ let mut query = parts.query.clone();
+ strip_tracking_query(&mut query);
+ let mut ctx = Context {
+ vars: HashMap::new(),
+ query,
+ };
+
+ if let Some(mut node_id) = self.traverse(parts, &mut ctx) {
+ let mut paths = Vec::new();
+ loop {
+ let node = match self.nodes.get(node_id) {
+ Some(n) => n,
+ None => break,
+ };
+ if let Some(url) = (node.canonical)(&ctx) {
+ if paths.last() != Some(&url) {
+ paths.push(url);
+ }
+ }
+ match node.parent {
+ Some(p) => node_id = p,
+ None => break,
+ }
+ }
+ paths.reverse();
+ if !paths.is_empty() {
+ return paths;
+ }
+ }
+ generic_breadcrumbs(parts)
+ }
+
+ fn traverse(&self, parts: &UrlParts, ctx: &mut Context) -> Option<&'static str> {
+ let host = parts.match_host();
+ let mut node_id = match host.as_str() {
+ "reddit.com" => "reddit_root",
+ "youtube.com" => "youtube_root",
+ "youtu.be" => "youtu_be_entry",
+ _ => return None,
+ };
+
+ let segs: Vec<&str> = parts.path_segments.iter().map(String::as_str).collect();
+ let mut i = 0;
+ while i < segs.len() {
+ let seg = segs[i];
+ match self.follow_edge(node_id, seg, ctx) {
+ Ok(next) => {
+ node_id = next;
+ i += 1;
+ }
+ Err(()) => {
+ if self.try_absorb(node_id, seg) {
+ i += 1;
+ continue;
+ }
+ return None;
+ }
+ }
+ }
+ Some(node_id)
+ }
+
+ fn follow_edge(
+ &self,
+ node_id: &'static str,
+ seg: &str,
+ ctx: &mut Context,
+ ) -> Result<&'static str, ()> {
+ let node = self.nodes.get(node_id).ok_or(())?;
+ for edge in &node.edges {
+ match edge.pattern {
+ EdgePattern::Literal(lit) if lit == seg => return Ok(edge.target),
+ EdgePattern::Variable(name) => {
+ ctx.vars.insert(name.to_string(), seg.to_string());
+ return Ok(edge.target);
+ }
+ EdgePattern::AbsorbAny
+ | EdgePattern::AbsorbIf(_)
+ | EdgePattern::Literal(_)
+ | EdgePattern::Variable(_) => {}
+ }
+ }
+ Err(())
+ }
+
+ fn try_absorb(&self, node_id: &'static str, seg: &str) -> bool {
+ let node = match self.nodes.get(node_id) {
+ Some(n) => n,
+ None => return false,
+ };
+ for edge in &node.edges {
+ match edge.pattern {
+ EdgePattern::AbsorbAny => return true,
+ EdgePattern::AbsorbIf(cond) if cond(seg) => return true,
+ EdgePattern::AbsorbIf(_) | EdgePattern::Literal(_) | EdgePattern::Variable(_) => {}
+ }
+ }
+ false
+ }
+
+ /// Test hook: terminal graph node and captured context after traversal.
+ #[cfg(test)]
+ pub fn traverse_terminal(&self, parts: &UrlParts) -> Option<(&'static str, Context)> {
+ let mut query = parts.query.clone();
+ strip_tracking_query(&mut query);
+ let mut ctx = Context {
+ vars: HashMap::new(),
+ query,
+ };
+ let node = self.traverse(parts, &mut ctx)?;
+ Some((node, ctx))
+ }
+}
+
+fn is_reddit_listing_suffix(seg: &str) -> bool {
+ matches!(seg, "hot" | "top" | "new" | "rising" | "controversial")
+}
+
+/// Percent-encode a path or query fragment so `&`, `?`, etc. cannot break URL structure.
+fn enc(s: &str) -> String {
+ urlencoding::encode(s).into_owned()
+}
+
+// --- Canonical formatters ---
+
+fn canon_reddit_root(_: &Context) -> Option<String> {
+ Some("https://reddit.com".to_string())
+}
+
+fn canon_reddit_r_hub(_: &Context) -> Option<String> {
+ Some("https://reddit.com/r".to_string())
+}
+
+fn canon_reddit_subreddit(ctx: &Context) -> Option<String> {
+ let sub = ctx.vars.get("subreddit")?;
+ Some(format!(
+ "https://reddit.com/r/{}",
+ enc(&sub.to_ascii_lowercase())
+ ))
+}
+
+fn canon_reddit_post(ctx: &Context) -> Option<String> {
+ let sub = ctx.vars.get("subreddit")?.to_ascii_lowercase();
+ let id = ctx.vars.get("post_id")?;
+ Some(format!(
+ "https://reddit.com/r/{}/comments/{}",
+ enc(&sub),
+ enc(id)
+ ))
+}
+
+fn canon_youtube_root(_: &Context) -> Option<String> {
+ Some("https://youtube.com".to_string())
+}
+
+fn canon_youtube_watch(ctx: &Context) -> Option<String> {
+ let v = ctx
+ .query
+ .get("v")
+ .or_else(|| ctx.vars.get("video_id"))?;
+ Some(format!("https://youtube.com/watch?v={}", enc(v)))
+}
+
+fn canon_youtu_be(ctx: &Context) -> Option<String> {
+ let v = ctx.vars.get("vid_id")?;
+ Some(format!("https://youtube.com/watch?v={}", enc(v)))
+}
+
+pub fn build_graph() -> Graph {
+ GraphBuilder::new()
+ .node("reddit_root")
+ .canonical(canon_reddit_root)
+ .edge(EdgePattern::Literal("r"), "reddit_r_hub")
+ .node("reddit_r_hub")
+ .parent("reddit_root")
+ .canonical(canon_reddit_r_hub)
+ .edge(EdgePattern::Variable("subreddit"), "reddit_subreddit")
+ .node("reddit_subreddit")
+ .parent("reddit_r_hub")
+ .canonical(canon_reddit_subreddit)
+ .edge(
+ EdgePattern::AbsorbIf(is_reddit_listing_suffix),
+ "reddit_subreddit",
+ )
+ .edge(EdgePattern::Literal("comments"), "reddit_comments_gate")
+ .node("reddit_comments_gate")
+ .parent("reddit_subreddit")
+ .canonical(canon_reddit_subreddit)
+ .edge(EdgePattern::Variable("post_id"), "reddit_post")
+ .node("reddit_post")
+ .parent("reddit_subreddit")
+ .canonical(canon_reddit_post)
+ .edge(EdgePattern::AbsorbAny, "reddit_post")
+ .node("youtube_root")
+ .canonical(canon_youtube_root)
+ .edge(EdgePattern::Literal("watch"), "youtube_watch")
+ .edge(EdgePattern::Literal("shorts"), "youtube_shorts_gate")
+ .node("youtube_watch")
+ .parent("youtube_root")
+ .canonical(canon_youtube_watch)
+ .node("youtube_shorts_gate")
+ .parent("youtube_root")
+ .canonical(canon_youtube_root)
+ .edge(EdgePattern::Variable("video_id"), "youtube_watch")
+ .node("youtu_be_entry")
+ .canonical(canon_youtube_root)
+ .edge(EdgePattern::Variable("vid_id"), "youtu_be_video")
+ .node("youtu_be_video")
+ .parent("youtube_root")
+ .canonical(canon_youtu_be)
+ .build()
+}
+
+// --- Generic internet fallback ---
+
+pub fn generic_canonical(parts: &UrlParts) -> String {
+ let host = normalize_match_host(&parts.host);
+ let path_segments: Vec<String> = parts.path_segments.clone();
+ let mut query = parts.query.clone();
+ strip_tracking_query(&mut query);
+
+ let mut url = if path_segments.is_empty() {
+ Url::parse(&format!("https://{host}"))
+ .unwrap_or_else(|_| Url::parse("https://invalid").unwrap())
+ } else {
+ let path = format!("/{}", path_segments.join("/"));
+ Url::parse(&format!("https://{host}{path}"))
+ .unwrap_or_else(|_| Url::parse("https://invalid").unwrap())
+ };
+
+ if !query.is_empty() {
+ let mut pairs: Vec<_> = query.iter().collect();
+ pairs.sort_by(|a, b| a.0.cmp(b.0));
+ url.query_pairs_mut().clear();
+ for (k, v) in pairs {
+ url.query_pairs_mut().append_pair(k, v);
+ }
+ }
+
+ let mut s = url.to_string();
+ if path_segments.is_empty() {
+ s = s.trim_end_matches('/').to_string();
+ }
+ s
+}
+
+pub fn generic_breadcrumbs(parts: &UrlParts) -> Vec<String> {
+ let host = normalize_match_host(&parts.host);
+ let n = parts.path_segments.len();
+ let mut out = Vec::new();
+
+ let base = generic_canonical(&UrlParts {
+ scheme: "https".to_string(),
+ host: host.clone(),
+ path_segments: vec![],
+ query: HashMap::new(),
+ });
+ out.push(base);
+
+ for i in 0..n {
+ let segs: Vec<String> = parts.path_segments[..=i].to_vec();
+ let url = generic_canonical(&UrlParts {
+ scheme: "https".to_string(),
+ host: host.clone(),
+ path_segments: segs,
+ query: HashMap::new(),
+ });
+ if out.last() != Some(&url) {
+ out.push(url);
+ }
+ }
+ out
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::url_rules::parse::test_parts;
+
+ fn g() -> &'static Graph {
+ graph()
+ }
+
+ fn canon(parts: &UrlParts) -> String {
+ g().resolve_canonical(parts).unwrap()
+ }
+
+ fn crumbs(parts: &UrlParts) -> Vec<String> {
+ g().breadcrumbs(parts)
+ }
+
+ fn terminal(parts: &UrlParts) -> Option<&'static str> {
+ g().traverse_terminal(parts).map(|(n, _)| n)
+ }
+
+ fn vars(parts: &UrlParts) -> HashMap<String, String> {
+ g().traverse_terminal(parts)
+ .map(|(_, c)| c.vars)
+ .unwrap_or_default()
+ }
+
+ #[test]
+ fn youtu_be_malicious_segment_encoded_not_injected() {
+ let p = test_parts("youtu.be", &["abc&t=1"], &[]);
+ assert_eq!(canon(&p
… preview truncated; 29,502 characters omittedB — c_5cd3e5917d2f (tommy-mor)
message
[1d14ff09] Ephemeral Reddit content; log structure only (#46) * Keep Reddit content ephemeral; log structure only Remove EntityImported and EntityStore. Reddit fetches write display content directly to the projection with a fetched_at timestamp, while the event log records NodeEnsured for discovered identities only. A background task evicts cached display content after 48 hours. Votes, tree structure, and ItemIds remain in the log and projection. Co-authored-by: tommy <thmorriss@gmail.com> * Fix reddit import test assertions and Clojure syntax Co-authored-by: tommy <thmorriss@gmail.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
diff preview
diff --git a/server/src/bin/storage_bench.rs b/server/src/bin/storage_bench.rs
index 4762d0d23bc8e2df439afe09a3235ba7f72bd486..3d988416ad36b27a7d3dc84280cfdbdcafa43e69 100644
--- a/server/src/bin/storage_bench.rs
+++ b/server/src/bin/storage_bench.rs
@@ -6,8 +6,8 @@ use std::{
};
use sorter2_server::{
- entity_store::EntityStore, event_log::EventLog, events::Event, journal::JournalClient,
- projection_apply, projection_store::ProjectionStore,
+ event_log::EventLog, events::Event, journal::JournalClient, projection_apply,
+ projection_store::ProjectionStore,
};
#[tokio::main]
@@ -18,12 +18,10 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
let data_dir = opts.data_dir.to_string_lossy().into_owned();
let event_log = Arc::new(EventLog::new(format!("{data_dir}/events.jsonl")));
let db = durable::Db::open(opts.data_dir.join("store"))?;
- let entity_store = EntityStore::from_db(&db)?;
let projection_store = ProjectionStore::from_db(&db)?;
let journal = JournalClient::spawn(
event_log.clone(),
- entity_store.clone(),
projection_store.clone(),
event_log.last_sequence().await? + 1,
);
@@ -46,12 +44,9 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
drop(journal);
let rebuild_start = Instant::now();
- entity_store.reset()?;
projection_store.reset()?;
let rebuild = event_log
- .replay(|record| {
- projection_apply::apply_records(&projection_store, &entity_store, &[record])
- })
+ .replay(|record| projection_apply::apply_records(&projection_store, &[record]))
.await?;
let rebuild_elapsed = rebuild_start.elapsed();
diff --git a/server/src/entity_store.rs b/server/src/entity_store.rs
deleted file mode 100644
index d29f39aecca6f12cdcf263cf77c3654eb4ee6cfa..0000000000000000000000000000000000000000
--- a/server/src/entity_store.rs
+++ /dev/null
@@ -1,134 +0,0 @@
-//! Off-heap storage for full entity payloads (Reddit API JSON).
-//!
-//! Derived [`crate::reducer::EntityData`] is stored on the node; the raw JSON
-//! lives here, in the shared durable [`Store`] schema.
-
-use std::path::Path;
-
-use durable::{Batch, Db, Durability};
-use serde_json::Value;
-
-use crate::{
- path_types::ItemId,
- storage_dto::{decode_entity_payload, encode_entity_payload},
- storage_schema::{Store, StoreFields},
-};
-
-const ENTITY_SCHEMA_KEY: &str = "schema_version";
-const ENTITY_SCHEMA_VERSION: u64 = 2;
-
-#[derive(Debug, thiserror::Error)]
-pub enum EntityStoreError {
- #[error("durable error: {0}")]
- Durable(#[from] durable::Error),
- #[error("json error: {0}")]
- Json(#[from] serde_json::Error),
- #[error("storage decode error: {0}")]
- Storage(String),
- #[error("io error: {0}")]
- Io(#[from] std::io::Error),
-}
-
-/// Disk-backed map of entity id → raw JSON payload.
-#[derive(Clone)]
-pub struct EntityStore {
- db: Db,
-}
-
-impl EntityStore {
- /// Open (or create) the entity database under `dir`.
- pub fn open(dir: &Path) -> Result<Self, EntityStoreError> {
- std::fs::create_dir_all(dir)?;
- let db = Db::open(dir)?;
- Self::from_db(&db)
- }
-
- /// Create an entity store backed by an already-open database.
- pub fn from_db(db: &Db) -> Result<Self, EntityStoreError> {
- let store = Self { db: db.clone() };
- let version = Store::root()
- .entity_meta()
- .key(&ENTITY_SCHEMA_KEY.to_string())
- .get(db)?;
- if version != Some(ENTITY_SCHEMA_VERSION) {
- store.reset()?;
- }
- Ok(store)
- }
-
- /// Clear rebuildable entity payloads and reset storage schema metadata.
- pub fn reset(&self) -> Result<(), EntityStoreError> {
- let root = Store::root();
- self.db.apply(
- &[root.entities().clear(), root.entity_meta().clear()],
- Durability::SyncWal,
- )?;
- self.db.run(
- root.entity_meta()
- .key(&ENTITY_SCHEMA_KEY.to_string())
- .set(&ENTITY_SCHEMA_VERSION),
- Durability::SyncWal,
- )?;
- Ok(())
- }
-
- /// Persist a payload for `id` (overwrites any existing entry).
- pub fn put(&self, id: &ItemId, payload: &Value) -> Result<(), EntityStoreError> {
- self.db.run(
- Store::root()
- .entities()
- .key(&id.as_str().to_string())
- .set(&encode_entity_payload(payload)),
- Durability::SyncWal,
- )?;
- Ok(())
- }
-
- /// Add a payload write to the caller's batch.
- pub fn put_in_batch(
- &self,
- batch: &mut Batch,
- id: &ItemId,
- payload: &Value,
- ) -> Result<(), EntityStoreError> {
- batch.write(
- Store::root()
- .entities()
- .key(&id.as_str().to_string())
- .set(&encode_entity_payload(payload)),
- );
- Ok(())
- }
-
- /// Load a stored payload, if present.
- pub fn get(&self, id: &ItemId) -> Result<Option<Value>, EntityStoreError> {
- match Store::root()
- .entities()
- .key(&id.as_str().to_string())
- .get(&self.db)?
- {
- Some(record) => decode_entity_payload(record)
- .map(Some)
- .map_err(EntityStoreError::Storage),
- None => Ok(None),
- }
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use serde_json::json;
-
- #[test]
- fn round_trip_payload() {
- let tmp = tempfile::tempdir().unwrap();
- let store = EntityStore::open(tmp.path()).unwrap();
- let id = ItemId::from_url("https://reddit.com/r/rust").unwrap();
- let payload = json!({"kind": "t5", "data": {"display_name": "rust"}});
-
- store.put(&id, &payload).unwrap();
- let loaded = store.get(&id).unwrap().unwrap();
- assert_eq!(loaded, payload);
- }
-}
diff --git a/server/src/events.rs b/server/src/events.rs
index a3d88e285c645a96d33e6f0aed1b487b843aceb8..d76c3bb4277216b0d39c9422ba7a50db10a95e05 100644
--- a/server/src/events.rs
+++ b/server/src/events.rs
@@ -1,5 +1,4 @@
use serde::{Deserialize, Serialize};
-use serde_json::Value;
/// Schema version for JSONL log records. Bump when event semantics change.
pub const CURRENT_LOG_SCHEMA: u32 = 1;
@@ -30,7 +29,7 @@ pub type ViewRecord = LogRecord<ViewEvent>;
/// Wall-clock timestamp carried on the log envelope for domain events.
pub fn event_timestamp(event: &Event) -> i64 {
match event {
- Event::VoteRecorded { ts, .. } | Event::EntityImported { ts, .. } => *ts,
+ Event::VoteRecorded { ts, .. } => *ts,
Event::NodeEnsured { .. } => crate::fetch::now_ms(),
}
}
@@ -57,6 +56,4 @@ pub enum Event {
},
/// Register a node path in the fractal tree (no external fetch).
NodeEnsured { id: String },
- /// Full upstream API payload for a node (domain-specific view derived at replay/render time).
- EntityImported { id: String, ts: i64, payload: Value },
}
diff --git a/server/src/journal.rs b/server/src/journal.rs
index 50bc89f976edb82b7b0e49e954a8eccbbe82bf87..d50023aca7c3e74068de988449b11baee32d1ecf 100644
--- a/server/src/journal.rs
+++ b/server/src/journal.rs
@@ -5,7 +5,6 @@ use std::sync::Arc;
use tokio::sync::{mpsc, oneshot};
use crate::{
- entity_store::EntityStore,
event_log::EventLog,
events::{event_timestamp, Event, EventRecord},
projection_apply,
@@ -25,7 +24,6 @@ pub struct JournalClient {
impl JournalClient {
pub fn spawn(
event_log: Arc<EventLog>,
- entity_store: EntityStore,
projection_store: ProjectionStore,
next_seq: u64,
) -> Self {
@@ -33,7 +31,6 @@ impl JournalClient {
tokio::spawn(journal_worker(
rx,
event_log,
- entity_store,
projection_store,
next_seq,
));
@@ -62,7 +59,6 @@ impl JournalClient {
async fn journal_worker(
mut rx: mpsc::Receiver<JournalCommand>,
event_log: Arc<EventLog>,
- entity_store: EntityStore,
projection_store: ProjectionStore,
mut next_seq: u64,
) {
@@ -75,7 +71,6 @@ async fn journal_worker(
let result = append_and_project_batch(
&event_log,
&projection_store,
- &entity_store,
&mut next_seq,
&batch,
)
@@ -99,7 +94,6 @@ async fn journal_worker(
async fn append_and_project_batch(
event_log: &EventLog,
projection_store: &ProjectionStore,
- entity_store: &EntityStore,
next_seq: &mut u64,
commands: &[JournalCommand],
) -> Result<(), String> {
@@ -117,7 +111,7 @@ async fn append_and_project_batch(
.await
.map_err(|e| e.to_string())?;
*next_seq = seq;
- projection_apply::apply_records(projection_store, entity_store, &records)
+ projection_apply::apply_records(projection_store, &records)
.map_err(|e| format!("projection apply failed after durable append: {e}"))
}
@@ -132,10 +126,9 @@ mod tests {
let log_path = tmp.path().join("events.jsonl");
let event_log = Arc::new(EventLog::new(log_path));
let db = durable::Db::open(tmp.path().join("store")).unwrap();
- let entity_store = EntityStore::from_db(&db).unwrap();
let projection_store = ProjectionStore::from_db(&db).unwrap();
- let journal = JournalClient::spawn(event_log, entity_store, projection_store.clone(), 1);
+ let journal = JournalClient::spawn(event_log, projection_store.clone(), 1);
let j1 = journal.clone();
let j2 = journal.clone();
@@ -177,11 +170,9 @@ mod tests {
.unwrap();
let db = durable::Db::open(tmp.path().join("store")).unwrap();
- let entity_store = EntityStore::from_db(&db).unwrap();
let projection_store = ProjectionStore::from_db(&db).unwrap();
projection_apply::apply_records(
&projection_store,
- &entity_store,
&[EventRecord::new(
1,
1,
@@ -196,7 +187,6 @@ mod tests {
let journal = JournalClient::spawn(
event_log.clone(),
- entity_store,
projection_store.clone(),
next_seq,
);
@@ -219,10 +209,9 @@ mod tests {
let log_path = tmp.path().join("events.jsonl");
let event_log = Arc::new(EventLog::new(log_path));
let db = durable::Db::open(tmp.path().join("store")).unwrap();
- let entity_store = EntityStore::from_db(&db).unwrap();
let projection_store = ProjectionStore::from_db(&db).unwrap();
let journal =
- JournalClient::spawn(event_log.clone(), entity_store, projection_store.clone(), 1);
+ JournalClient::spawn(event_log.clone(), projection_store.clone(), 1);
journal
.append_many(vec![
diff --git a/server/src/lib.rs b/server/src/lib.rs
index 5c02c8e704e4664453bad75d819df8a067668176..3dfc7c8acb8ed61bb73ade63e72768e402042cc5 100644
--- a/server/src/lib.rs
+++ b/server/src/lib.rs
@@ -1,5 +1,4 @@
pub mod api;
-pub mod entity_store;
pub mod event_log;
pub mod events;
pub mod fetch;
diff --git a/server/src/projection_apply.rs b/server/src/projection_apply.rs
index 5644557a41b3e9497c7421b444155ae629fa79f1..9c8990a8af927f35d3344c8d0872a516aba56b86 100644
--- a/server/src/projection_apply.rs
+++ b/server/src/projection_apply.rs
@@ -1,22 +1,20 @@
//! Apply event-log records to the durable projection as precise point updates.
//!
//! Each batch of records lowers to reified durable writes (edge merges, child
-//! links, voted-pair flags, recent-vote pushes, entity payloads) plus a cursor
-//! advance, all committed in one atomic `DisableWal` batch. The cursor moving in
-//! the same batch as the (non-idempotent) edge merges guarantees e
… preview truncated; 33,427 characters omittedHardlinks — judgments / attempts / prompt
judgments
attempts
Prompt text is loaded only by the download route.