Files
usenet-indexer/edge/src/lease.rs
T
Daan MeijerandClaude Fable 5.1 72e973d006
Test and deploy / test (push) Successful in 48s
Test and deploy / edge (push) Successful in 1m43s
Test and deploy / deploy (push) Skipped
The replay harness: a group's corpus through one carried window into a scratch catalog
replay:corpus runs edge-bench --group over a group's complete corpus ranges
in article order (one window, carried from range to range, finished after
the last range; edge/src/lease.rs holds the lease JSON the worker and the
bench share) and stores every batch through BatchStore as the worker
would, then reports releases finished, provisional, complete and the bytes
per header of the NVMe and HDD tables. Refuses a database not named
*_replay or *_scratch. The app image carries edge-bench; compose gets a
replay profile for homelab.

Design amended (REBUILD.md 1, 2, 5): the window is carried by one worker a
group, no block leases and no block merger; provisional writes stay for
the lease ends.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-26 00:27:09 +01:00

66 lines
1.9 KiB
Rust

//! A lease as the coordinator sends it (lib/edge/lease.ts): the range and the rules, JSON with the TypeScript
//! names. The edge-node worker takes one per range; edge-bench's replay takes the rules alone (`--rules`).
use crate::names::Rules;
use serde::Deserialize;
use std::collections::HashMap;
#[derive(Deserialize)]
pub struct LeaseJson {
pub range: RangeJson,
pub rules: RulesJson,
}
#[derive(Deserialize)]
pub struct RangeJson {
pub id: i64,
pub group: String,
pub start: i64,
pub end: i64,
pub next: i64,
}
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RulesJson {
pub version: i64,
pub priorities: HashMap<String, u32>,
#[serde(default)]
pub dropped_signatures: Vec<String>,
#[serde(default)]
pub dropped_tools: Option<Vec<String>>,
#[serde(default)]
pub per_article_max_parts: Option<u32>,
#[serde(default)]
pub sample_percent: Option<f64>,
#[serde(default)]
pub drop_executables: Option<bool>,
#[serde(default)]
pub dropped_posters: Option<Vec<String>>,
}
impl RulesJson {
/// The rules with today's defaults under them (a field the stored set doesn't have keeps the default).
pub fn rules(self) -> Rules {
let mut rules = Rules::defaults(self.priorities.into_iter().collect());
rules.version = self.version;
rules.dropped_signatures = self.dropped_signatures.into_iter().collect();
if let Some(tools) = self.dropped_tools {
rules.dropped_tools = tools.into_iter().collect();
}
if let Some(n) = self.per_article_max_parts {
rules.per_article_max_parts = n;
}
if let Some(p) = self.sample_percent {
rules.sample_percent = p;
}
if let Some(e) = self.drop_executables {
rules.drop_executables = e;
}
if let Some(posters) = self.dropped_posters {
rules.dropped_posters = posters;
}
rules
}
}