pub struct ContractRegistry { /* private fields */ }Expand description
In-memory contract metadata. Built once at startup; never mutated
while atlas runs. Wrapped in Arc<ContractRegistry> so handlers can
read it without locks.
Implementations§
Source§impl ContractRegistry
impl ContractRegistry
Sourcepub fn load_from_capabilities_dir(root: &Path) -> Result<Self>
pub fn load_from_capabilities_dir(root: &Path) -> Result<Self>
Walk <root>/**/*.toml for one root and load it into the registry.
Convenience wrapper around load_from_capability_roots(&[root]).
Sourcepub fn load_from_capability_roots(roots: &[&Path]) -> Result<Self>
pub fn load_from_capability_roots(roots: &[&Path]) -> Result<Self>
Walk every <root>/**/*.toml across all roots (in order) and
merge the parsed ContractDescriptors into one registry. Later
roots override earlier ones on duplicate [contract].id, which
matches the package-merge semantics: per-package
<pkg>/capabilities/ can re-declare a contract from the global
<robonix_source>/capabilities/. Symlinks are followed so msg/srv
directories that live in interfaces/lib/... are reachable when
they are linked under capabilities/.
After all TOMLs are loaded, this also indexes every .msg/.srv
under <root>/lib/**/* and tries to attach top-level field
schemas to each contract whose io_msg_type / io_srv_type points
at a known IDL. Failures here are non-fatal (the contract is
still served, just without field-level introspection).
Malformed TOMLs and *.toml files without a [contract].id are
logged and skipped — one bad file must not take atlas down.
pub fn get(&self, contract_id: &str) -> Option<&ContractDescriptor>
Sourcepub fn list_with_prefix(&self, prefix: &str) -> Vec<ContractDescriptor>
pub fn list_with_prefix(&self, prefix: &str) -> Vec<ContractDescriptor>
Return all contracts whose id starts with prefix. Empty prefix
returns every contract.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Debug for ContractRegistry
impl Debug for ContractRegistry
Source§impl Default for ContractRegistry
impl Default for ContractRegistry
Source§fn default() -> ContractRegistry
fn default() -> ContractRegistry
Auto Trait Implementations§
impl Freeze for ContractRegistry
impl RefUnwindSafe for ContractRegistry
impl Send for ContractRegistry
impl Sync for ContractRegistry
impl Unpin for ContractRegistry
impl UnsafeUnpin for ContractRegistry
impl UnwindSafe for ContractRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].