pub struct SchemaRegistry { /* private fields */ }Expand description
A registry of known schema artifacts.
Replay code uses the registry to verify that every event’s schema reference points to an available artifact. Missing artifacts mean the event cannot be replayed deterministically; federation policy must fetch missing artifacts before replay proceeds (analogous to the missing-ancestor case in §5.2).
Implementations§
Source§impl SchemaRegistry
impl SchemaRegistry
Sourcepub fn insert(&mut self, artifact: SchemaArtifact) -> Result<(), String>
pub fn insert(&mut self, artifact: SchemaArtifact) -> Result<(), String>
Insert an artifact, verifying its id matches its content.
Returns an error if the artifact’s stored id does not match its derived id. This catches tampering at registration time rather than at replay time.
Sourcepub fn get(&self, id: &str) -> Option<&SchemaArtifact>
pub fn get(&self, id: &str) -> Option<&SchemaArtifact>
Look up an artifact by id.
Sourcepub fn contains(&self, id: &str) -> bool
pub fn contains(&self, id: &str) -> bool
Whether the registry contains an artifact with the given id.
Sourcepub fn missing<I: AsRef<str>>(&self, referenced: &[I]) -> Vec<String>
pub fn missing<I: AsRef<str>>(&self, referenced: &[I]) -> Vec<String>
Detect schema artifacts referenced by referenced but
missing from the registry. Used at replay-time to determine
whether replay can proceed.
Sourcepub fn unknown_event_artifacts(&self, events: &[StateEvent]) -> Vec<String>
pub fn unknown_event_artifacts(&self, events: &[StateEvent]) -> Vec<String>
Inspect a slice of events and return any
schema_artifact_id values that are not present in the
registry. Events with schema_artifact_id == None are
skipped (they predate the artifact-registry mechanism per
docs/THEORY.md §5.1 and use the legacy string schema
field).
Returned ids are deduplicated and sorted lexically.
Trait Implementations§
Source§impl Clone for SchemaRegistry
impl Clone for SchemaRegistry
Source§fn clone(&self) -> SchemaRegistry
fn clone(&self) -> SchemaRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SchemaRegistry
impl Debug for SchemaRegistry
Source§impl Default for SchemaRegistry
impl Default for SchemaRegistry
Source§fn default() -> SchemaRegistry
fn default() -> SchemaRegistry
Source§impl<'de> Deserialize<'de> for SchemaRegistry
impl<'de> Deserialize<'de> for SchemaRegistry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for SchemaRegistry
impl PartialEq for SchemaRegistry
Source§fn eq(&self, other: &SchemaRegistry) -> bool
fn eq(&self, other: &SchemaRegistry) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for SchemaRegistry
impl Serialize for SchemaRegistry
impl Eq for SchemaRegistry
impl StructuralPartialEq for SchemaRegistry
Auto Trait Implementations§
impl Freeze for SchemaRegistry
impl RefUnwindSafe for SchemaRegistry
impl Send for SchemaRegistry
impl Sync for SchemaRegistry
impl Unpin for SchemaRegistry
impl UnsafeUnpin for SchemaRegistry
impl UnwindSafe for SchemaRegistry
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.