pub struct RemoteStageStore { /* private fields */ }Expand description
A StageStore backed by a remote noether-registry over HTTP.
All stages are prefetched into a local MemoryStore on construction,
making subsequent reads (get, list) instant and allocation-free.
Implementations§
Source§impl RemoteStageStore
impl RemoteStageStore
Sourcepub fn connect(
base_url: &str,
api_key: Option<&str>,
) -> Result<Self, StoreError>
pub fn connect( base_url: &str, api_key: Option<&str>, ) -> Result<Self, StoreError>
Connect to a registry at base_url and prefetch all active stages.
api_key is sent as X-API-Key header; pass None if the registry
runs without auth (local dev with NOETHER_API_KEY="").
Sourcepub fn from_env() -> Option<Result<Self, StoreError>>
pub fn from_env() -> Option<Result<Self, StoreError>>
Build a store from the NOETHER_REGISTRY environment variable.
Also reads NOETHER_API_KEY if set.
Returns None if NOETHER_REGISTRY is not set.
Sourcepub fn refresh(&mut self) -> Result<usize, StoreError>
pub fn refresh(&mut self) -> Result<usize, StoreError>
Re-fetch all stages from the registry using offset pagination and
rebuild the local cache. Each page is 200 stages; iteration stops when
the server returns an empty page or offset >= total.
Call this if you know the registry was mutated externally.
Sourcepub fn get_live(&mut self, id: &StageId) -> Result<Option<&Stage>, StoreError>
pub fn get_live(&mut self, id: &StageId) -> Result<Option<&Stage>, StoreError>
Fetch a single stage directly from the registry, bypassing the cache.
On success the stage is inserted into the local cache so subsequent
get() calls will find it without another HTTP round-trip.
Returns Ok(None) when the server returns 404.
Trait Implementations§
Source§impl StageStore for RemoteStageStore
impl StageStore for RemoteStageStore
Source§fn remove(&mut self, id: &StageId) -> Result<(), StoreError>
fn remove(&mut self, id: &StageId) -> Result<(), StoreError>
Removes the stage from the remote registry (DELETE /stages/:id) and then from the local cache.
Source§fn get(&self, id: &StageId) -> Result<Option<&Stage>, StoreError>
fn get(&self, id: &StageId) -> Result<Option<&Stage>, StoreError>
Returns the stage from the local cache.
For a guaranteed-fresh read use RemoteStageStore::get_live (which
takes &mut self so it can update the cache).
fn put(&mut self, stage: Stage) -> Result<StageId, StoreError>
Source§fn upsert(&mut self, stage: Stage) -> Result<StageId, StoreError>
fn upsert(&mut self, stage: Stage) -> Result<StageId, StoreError>
fn contains(&self, id: &StageId) -> bool
fn list(&self, lifecycle: Option<&StageLifecycle>) -> Vec<&Stage>
fn update_lifecycle( &mut self, id: &StageId, lifecycle: StageLifecycle, ) -> Result<(), StoreError>
fn stats(&self) -> StoreStats
Source§fn get_owned(&self, id: &StageId) -> Result<Option<Stage>, StoreError>
fn get_owned(&self, id: &StageId) -> Result<Option<Stage>, StoreError>
Source§fn list_owned(&self, lifecycle: Option<&StageLifecycle>) -> Vec<Stage>
fn list_owned(&self, lifecycle: Option<&StageLifecycle>) -> Vec<Stage>
Source§fn find_by_name(&self, name: &str) -> Vec<&Stage>
fn find_by_name(&self, name: &str) -> Vec<&Stage>
name field matches exactly.
Used by graph loaders so composition files can reference stages
by their human-authored name instead of their 8-char content-hash
prefix. Returns every match across all lifecycles; callers
typically filter for Active.Source§fn get_by_signature(&self, signature_id: &SignatureId) -> Option<&Stage>
fn get_by_signature(&self, signature_id: &SignatureId) -> Option<&Stage>
SignatureId. This is
the M2 “resolve signature to latest implementation” pathway: a
graph that pins a stage by signature_id gets whichever
implementation is Active today. Read moreSource§fn active_stages_with_signature(
&self,
signature_id: &SignatureId,
) -> Vec<&Stage>
fn active_stages_with_signature( &self, signature_id: &SignatureId, ) -> Vec<&Stage>
signature_id matches.
Ordered lexicographically by implementation ID so iteration is
stable across HashMap-backed stores. Read more