pub struct Context { /* private fields */ }Expand description
Ordered store of specs keyed by (repository, name) and grouped into
LemmaSpecSets.
Specs with the same (repository, name) identity are ordered by effective_from.
A spec version’s temporal end is derived from the successor spec’s effective_from, or
+∞. The repository identity is preserved as Arc<LemmaRepository> — never via string
prefixes on the spec name. Repository names include the @ prefix when present
(e.g. "@org/repo"). Dependency isolation is enforced at insert_spec: all specs
in a repository must share the same dependency provenance ID.
Implementations§
Source§impl Context
impl Context
Sourcepub fn new() -> Self
pub fn new() -> Self
Empty workspace repository; specs are inserted via Self::insert_spec.
Sourcepub fn workspace(&self) -> Arc<LemmaRepository>
pub fn workspace(&self) -> Arc<LemmaRepository>
Workspace-global grouping for every locally loaded spec. The single
namespace runtime APIs operate on (entry-point specs live here).
Stable identity across calls; name = None, dependency = None.
Sourcepub fn find_repository(&self, name: &str) -> Option<Arc<LemmaRepository>>
pub fn find_repository(&self, name: &str) -> Option<Arc<LemmaRepository>>
Look up a repository by name without creating a new one.
Sourcepub fn repositories(
&self,
) -> &IndexMap<Arc<LemmaRepository>, IndexMap<String, LemmaSpecSet>>
pub fn repositories( &self, ) -> &IndexMap<Arc<LemmaRepository>, IndexMap<String, LemmaSpecSet>>
All spec sets, keyed by (repository, name). Iteration order: repository first
(insertion order), then spec name ascending.
pub fn iter(&self) -> impl Iterator<Item = Arc<LemmaSpec>> + '_
Sourcepub fn iter_with_ranges(
&self,
) -> impl Iterator<Item = (Arc<LemmaSpec>, Option<DateTimeValue>, Option<DateTimeValue>)> + '_
pub fn iter_with_ranges( &self, ) -> impl Iterator<Item = (Arc<LemmaSpec>, Option<DateTimeValue>, Option<DateTimeValue>)> + '_
Every loaded spec paired with its half-open
[effective_from, effective_to) validity range. Iteration order
matches Self::iter.
Sourcepub fn spec_set(
&self,
repository: &Arc<LemmaRepository>,
name: &str,
) -> Option<&LemmaSpecSet>
pub fn spec_set( &self, repository: &Arc<LemmaRepository>, name: &str, ) -> Option<&LemmaSpecSet>
Look up a spec set by (repository, name). Returns None if no such spec set
is loaded.
Sourcepub fn insert_spec(
&mut self,
repository: Arc<LemmaRepository>,
spec: Arc<LemmaSpec>,
) -> Result<(), Error>
pub fn insert_spec( &mut self, repository: Arc<LemmaRepository>, spec: Arc<LemmaSpec>, ) -> Result<(), Error>
Insert a spec under repository. Validates that an identical (repository, name, effective_from)triple is not already loaded. Insert a spec underrepository`. Enforces two invariants:
- Dependency isolation: all specs in a repo must share the same
dependencyprovenance. A workspace repo cannot be merged with a dependency repo, and two different dependencies cannot contribute to the same repo name. - No duplicate
(repository, name, effective_from)triples.