Skip to main content

SchemaRegistry

Trait SchemaRegistry 

Source
pub trait SchemaRegistry: Send + Sync {
    // Required methods
    fn get_by_fingerprint(&self, fp: &EventFingerprint) -> Option<Schema>;
    fn get_by_name(&self, name: &str, version: Option<u32>) -> Option<Schema>;
    fn list_for_chain(&self, chain_slug: &str) -> Vec<Schema>;
    fn history(&self, name: &str) -> Vec<Schema>;
}
Expand description

A thread-safe, read-only view of a schema registry. Concrete implementations live in chaincodec-registry.

Required Methods§

Source

fn get_by_fingerprint(&self, fp: &EventFingerprint) -> Option<Schema>

Look up a schema by its fingerprint.

Source

fn get_by_name(&self, name: &str, version: Option<u32>) -> Option<Schema>

Look up a schema by name and optional version. If version is None, returns the latest non-deprecated version.

Source

fn list_for_chain(&self, chain_slug: &str) -> Vec<Schema>

Returns all schemas applicable to the given chain slug.

Source

fn history(&self, name: &str) -> Vec<Schema>

Returns the full evolution chain for a schema: from oldest to newest.

Implementors§