Extended API caching: serve shape feeds via the Rust DS server's built-in CDN protocol

Aperta
#11 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
docker, rust

Direzione di ricerca

Prima risolvere la decisione production-DS in sospeso, poi leggere packages/durable-streams-rust handlers.rs:1970-2019 e store.rs:1237-1262, seguito dallo stream reader di packages/client e da ShapeHandle.streamUrl. Controllare l’overlay docker e la documentazione sul deployment. Il lavoro è completato quando il percorso del feed di produzione scelto supporta il comportamento richiesto di cursor/304 e la configurazione dell’URL CDN; il lavoro opzionale sulla policy ds-rust è separato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Companion to #10 (different surface: the extended API's read path is the durable-streams server, not the engine). Investigation of ../electric-ds-rust-1m (packages/durable-streams-rust) found it already ships the cache protocol we need, while the npm @durable-streams/server we deploy today has none of it:

  • Historical offset-addressed reads: immutable ranges served public, max-age=60, stale-while-revalidate=300 + range-derived ETag ("{stream}:{start}:{end}"), with If-None-Match → 304 (handlers.rs:1970-2019).
  • CDN request collapsing built in: stream-cursor header + cursor param, 20s time buckets with 1–180-interval jitter (store.rs:1237-1262).
  • Tail/now reads correctly no-store + no ETag; stream-next-offset / stream-up-to-date on everything.

Scope:

  1. Make the Rust DS server the client-facing feed path for production deployments (docker overlay + docs); keep the npm server for tests/demos. (Pending the broader "which DS is the production target" decision — issue text to be updated if that lands differently.)
  2. Client: send cursor on long-polls and honor 304s (packages/client stream reader currently uses only offset + live=long-poll).
  3. ShapeHandle.streamUrl should be the CDN-fronted URL (config knob on the API server), not the origin DS address.
  4. Optional upstream patch to ds-rust: per-stream cache policy at create time (e.g. stream-cache-max-age) so initial-snapshot chunks can get Electric's week-long tier instead of the hardcoded 60s. Requires new StreamConfig/Meta fields, parsing in handle_create, echo in read builders, and relaxing the &'static str header-name type in api.rs (handlers.rs:120,431-465, store.rs:38-48).

Non-goals: engine /v1/shape caching (#10); auth on feed URLs (auth issue, TBD).

🤖 Generated with Claude Code

Lingua principale
Rust
Stelle
32
Fork
7
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di electric-sql/electric-circuits

Tutte le issue di electric-sql/electric-circuits

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.