Skip to main content

SubstrateRead

Trait SubstrateRead 

Source
pub trait SubstrateRead {
    // Required methods
    fn capabilities(&self) -> Capabilities;
    fn grains_of_type(
        &self,
        grain_type: &str,
        namespace: Option<&str>,
        opts: ReadOpts,
    ) -> Result<Vec<GrainRecord>>;
    fn grain(&self, hash: &str) -> Result<Option<GrainRecord>>;

    // Provided methods
    fn heads(&self, _namespace: Option<&str>) -> Result<Vec<HeadGroup>> { ... }
    fn telemetry(
        &self,
        _namespace: Option<&str>,
    ) -> Result<Option<TelemetryView>> { ... }
}
Expand description

The read-only slice of the substrate. Analyzers receive this (via AnalyzeCtx) and nothing else — the trust floor’s “analyzers execute read-only” is enforced by the type system: a &dyn SubstrateRead cannot reach any mutating method. It is object-safe (no generics) so builtin_analyzers() can hand out Box<dyn Analyzer>.

Required Methods§

Source

fn capabilities(&self) -> Capabilities

Declared optional capabilities.

Source

fn grains_of_type( &self, grain_type: &str, namespace: Option<&str>, opts: ReadOpts, ) -> Result<Vec<GrainRecord>>

Curated read: all grains of one OMS type, optionally namespace-scoped and watermark/liveness filtered.

Source

fn grain(&self, hash: &str) -> Result<Option<GrainRecord>>

Fetch one grain by content address.

Provided Methods§

Source

fn heads(&self, _namespace: Option<&str>) -> Result<Vec<HeadGroup>>

Entities with more than one live head. Requires the forks capability; the default impl reports it missing so non-fork substrates degrade cleanly rather than pretend.

Source

fn telemetry(&self, _namespace: Option<&str>) -> Result<Option<TelemetryView>>

A snapshot of the recall-telemetry rollups (§8). Requires the telemetry capability; the default returns None so substrates without a sidecar degrade cleanly. namespace scopes the snapshot when set.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§