Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

palimpsest-server

HTTP frontier server, retrieval API, and Prometheus metrics. Three distinct services in one crate.

Frontier API

Distributed crawling coordination. Workers pop URLs, fetch them, and push discoveries back.

FrontierState

#![allow(unused)]
fn main() {
pub struct FrontierState {
    pub frontier: Mutex<Frontier>,
    pub seed: CrawlSeed,
}
}

Endpoints

MethodPathRequest BodyResponse
POST/seeds{"urls": ["..."]}{"accepted": N}
POST/pop{}{"url": "...", "depth": 0, "priority": 0}
POST/discovered{"urls": [{"url": "...", "depth": 1, "parent_hash": "..."}]}{"accepted": N}
GET/status{"queue_size": N, "seen_count": N, "host_count": N, "seed_value": N}
GET/health"ok"

Retrieval API

Content serving for AI pipelines and search.

RetrievalState

#![allow(unused)]
fn main() {
pub struct RetrievalState {
    pub index: Mutex<SqliteIndex>,
    pub storage: FileSystemBlobStore,
    pub chunk_config: ChunkConfig,
}
}

Endpoints

MethodPathQuery ParamsDescription
GET/v1/contenturlRaw captured content
GET/v1/chunksurlRAG-ready chunks with provenance
GET/v1/historyurlAll captures with timestamps
GET/v1/searchqFull-text search
GET/healthHealth check

Metrics

#![allow(unused)]
fn main() {
pub struct Metrics {
    pub urls_fetched: AtomicU64,
    pub urls_failed: AtomicU64,
    pub urls_discovered: AtomicU64,
    pub robots_blocked: AtomicU64,
    pub bytes_stored: AtomicU64,
    pub blobs_stored: AtomicU64,
    pub api_requests: AtomicU64,
    pub frontier_pops: AtomicU64,
    pub frontier_pushes: AtomicU64,
}

impl Metrics {
    pub fn new() -> Self;
    pub fn render(&self) -> String;  // Prometheus text exposition format
}
}

All counters use AtomicU64 with Ordering::Relaxed — thread-safe, no locks, no control flow impact (Law 1 safe).