pub struct Client<C>
where C: ManagedClient + Clone + Send + Sync + 'static, C::PubReceiver: Send + Sync,
{ /* private fields */ }
Expand description

Schema registry client implementation.

Implementations§

Source§

impl<C> Client<C>
where C: ManagedClient + Clone + Send + Sync + 'static, C::PubReceiver: Send + Sync,

Source

pub fn new(application_context: ApplicationContext, client: &C) -> Self

Create a new Schema Registry Client.

§Panics

Panics if the options for the underlying command invokers cannot be built. Not possible since the options are statically generated.

Source

pub async fn get( &self, get_request: GetRequest, timeout: Duration, ) -> Result<Option<Schema>, Error>

Retrieves schema information from a schema registry service.

§Arguments
  • get_request - The request to get a schema from the schema registry.
  • timeout - The duration until the Schema Registry Client stops waiting for a response to the request, it is rounded up to the nearest second.

Returns a Schema if the schema was found, otherwise returns None.

§Errors

Error of kind InvalidArgument if the timeout is zero or > u32::max, or there is an error building the request.

Error of kind SerializationError if there is an error serializing the request.

Error of kind ServiceError if there is an error returned by the Schema Registry Service.

Error of kind AIOProtocolError if there are any underlying errors from the AIO RPC protocol.

Source

pub async fn put( &self, put_request: PutRequest, timeout: Duration, ) -> Result<Schema, Error>

Adds or updates a schema in the schema registry service.

§Arguments
  • put_request - The request to put a schema in the schema registry.
  • timeout - The duration until the Schema Registry Client stops waiting for a response to the request, it is rounded up to the nearest second.

Returns the Schema that was put if the request was successful.

§Errors

Error of kind InvalidArgument if the content is empty, the timeout is zero or > u32::max, or there is an error building the request.

Error of kind SerializationError if there is an error serializing the request.

Error of kind ServiceError if there is an error returned by the Schema Registry Service.

Error of kind AIOProtocolError if there are any underlying errors from the AIO RPC protocol.

Source

pub async fn shutdown(&self) -> Result<(), Error>

Shutdown the Client. Shuts down the underlying command invokers for get and put operations.

Note: If this method is called, the Client should not be used again. If the method returns an error, it may be called again to re-attempt unsubscribing.

Returns Ok(()) on success, otherwise returns Error.

§Errors

Error of kind AIOProtocolError if the unsubscribe fails or if the unsuback reason code doesn’t indicate success.

Trait Implementations§

Source§

impl<C> Clone for Client<C>
where C: ManagedClient + Clone + Send + Sync + 'static + Clone, C::PubReceiver: Send + Sync,

Source§

fn clone(&self) -> Client<C>

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

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<C> Freeze for Client<C>

§

impl<C> !RefUnwindSafe for Client<C>

§

impl<C> Send for Client<C>

§

impl<C> Sync for Client<C>

§

impl<C> Unpin for Client<C>

§

impl<C> !UnwindSafe for Client<C>

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V