Skip to main content

MemoryRegistry

Struct MemoryRegistry 

Source
pub struct MemoryRegistry { /* private fields */ }
Expand description

Thread-safe in-memory schema registry.

Implementations§

Source§

impl MemoryRegistry

Source

pub fn new() -> Self

Source

pub fn add(&self, schema: Schema) -> Result<(), RegistryError>

Add a schema to the registry.

Source

pub fn load_directory(&self, dir: &Path) -> Result<usize, RegistryError>

Load all .csdl files from a directory recursively.

Each file may contain multiple schema documents (separated by ---). Returns the total number of schema versions loaded.

Source

pub fn load_file(&self, path: &Path) -> Result<usize, RegistryError>

Load a single CSDL file.

If the file contains multiple schemas (separated by ---), all are added to the registry. Returns the count of schemas loaded.

Source

pub fn insert(&self, schema: Schema) -> Result<(), RegistryError>

Alias for add() — adds a schema to the registry.

Source

pub fn len(&self) -> usize

Returns the total number of schema versions stored.

Source

pub fn is_empty(&self) -> bool

Source

pub fn all_names(&self) -> Vec<String>

Returns all schema names (deduplicated, one entry per name regardless of versions).

Source

pub fn all_schemas(&self) -> Vec<Schema>

Returns all schemas (latest non-deprecated version of each).

Trait Implementations§

Source§

impl Clone for MemoryRegistry

Source§

fn clone(&self) -> MemoryRegistry

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for MemoryRegistry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl SchemaRegistry for MemoryRegistry

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.