pub struct SchemaRegistry { /* private fields */ }Expand description
Central registry for managing event schemas
Implementations§
Source§impl SchemaRegistry
impl SchemaRegistry
pub fn new(config: SchemaRegistryConfig) -> Self
Sourcepub fn register_schema(
&self,
subject: String,
schema: JsonValue,
description: Option<String>,
tags: Option<Vec<String>>,
) -> Result<RegisterSchemaResponse>
pub fn register_schema( &self, subject: String, schema: JsonValue, description: Option<String>, tags: Option<Vec<String>>, ) -> Result<RegisterSchemaResponse>
Register a new schema or return existing if identical
Sourcepub fn get_schema(&self, subject: &str, version: Option<u32>) -> Result<Schema>
pub fn get_schema(&self, subject: &str, version: Option<u32>) -> Result<Schema>
Get a schema by subject and version (or latest if no version specified)
Sourcepub fn list_versions(&self, subject: &str) -> Result<Vec<u32>>
pub fn list_versions(&self, subject: &str) -> Result<Vec<u32>>
List all versions of a schema subject
Sourcepub fn list_subjects(&self) -> Vec<String>
pub fn list_subjects(&self) -> Vec<String>
List all schema subjects
Sourcepub fn validate(
&self,
subject: &str,
version: Option<u32>,
payload: &JsonValue,
) -> Result<ValidateEventResponse>
pub fn validate( &self, subject: &str, version: Option<u32>, payload: &JsonValue, ) -> Result<ValidateEventResponse>
Validate a payload against a schema
Sourcepub fn set_compatibility_mode(&self, subject: String, mode: CompatibilityMode)
pub fn set_compatibility_mode(&self, subject: String, mode: CompatibilityMode)
Set compatibility mode for a subject
Sourcepub fn get_compatibility_mode(&self, subject: &str) -> CompatibilityMode
pub fn get_compatibility_mode(&self, subject: &str) -> CompatibilityMode
Get compatibility mode for a subject (or default)
Sourcepub fn delete_schema(&self, subject: &str, version: u32) -> Result<bool>
pub fn delete_schema(&self, subject: &str, version: u32) -> Result<bool>
Delete a specific schema version
Sourcepub fn stats(&self) -> SchemaRegistryStats
pub fn stats(&self) -> SchemaRegistryStats
Get registry statistics
Sourcepub fn config(&self) -> &SchemaRegistryConfig
pub fn config(&self) -> &SchemaRegistryConfig
Get registry configuration
Auto Trait Implementations§
impl Freeze for SchemaRegistry
impl !RefUnwindSafe for SchemaRegistry
impl Send for SchemaRegistry
impl Sync for SchemaRegistry
impl Unpin 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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more