Struct SchemaRegistryClient

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

A client for interacting with the Schema Registry within Redpanda.

Implementations§

Source§

impl SchemaRegistryClient

Source

pub fn new() -> Self

Create a new default Schema Registry client that connects to Redpanda’s Schema Registry when running within the context of a data transform.

Source

pub fn new_wrapping(delegate: Box<dyn SchemaRegistryClientImpl>) -> Self

Create a new custom Schema Registry client wrapping the implementation.

This is useful in testing when you want to inject a mock client.

Source

pub fn lookup_schema_by_id(&self, id: SchemaId) -> Result<Schema>

Lookup a schema via its global ID.

Source

pub fn lookup_schema_by_version( &self, subject: impl AsRef<str>, version: SchemaVersion, ) -> Result<SubjectSchema>

Lookup a schema for a given subject at a specific version.

Source

pub fn lookup_latest_schema( &self, subject: impl AsRef<str>, ) -> Result<SubjectSchema>

Lookup the latest schema for a subject.

Source

pub fn create_schema( &mut self, subject: impl AsRef<str>, schema: Schema, ) -> Result<SubjectSchema>

Create a schema in the Schema Registry under the given subject, returning the version and ID.

If an equivalent schema already exists globally, that schema ID will be reused. If an equivalent schema already exists within that subject, this will be a noop and the existing schema version will be returned.

Trait Implementations§

Source§

impl Default for SchemaRegistryClient

Source§

fn default() -> Self

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

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> 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, 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.