Skip to main content

Admin

Struct Admin 

Source
pub struct Admin<T: Transport> { /* private fields */ }
Expand description

Administrative operations, on one core like everything else here.

Implementations§

Source§

impl<T: Transport> Admin<T>

Source

pub async fn connect( transport: T, bootstrap: &[String], client_id: &str, ) -> Result<Self>

Connect to the cluster.

§Errors

If no bootstrap address answers.

Source

pub fn set_operation_timeout(&mut self, timeout: Duration)

How long the broker may take to complete an operation before it gives up on it. Not a client-side deadline.

Source

pub fn cluster(&mut self) -> &mut Cluster<T>

The underlying cluster, for callers that want metadata directly.

Source

pub async fn create_topics(&mut self, topics: &[NewTopic]) -> Result<()>

Create topics.

TOPIC_ALREADY_EXISTS is an error here, not a silent success. A caller who wants “create if absent” can say so by ignoring that code; a caller who does not want it and never learns is the one who ends up producing to a topic with the wrong partition count.

§Errors

If the controller rejects any of them.

Source

pub async fn delete_topics(&mut self, names: &[String]) -> Result<()>

Delete topics. Asynchronous on the broker: the response means the deletion was accepted, not that the log files are gone.

§Errors

If the controller rejects any of them.

Source

pub async fn create_partitions(&mut self, topic: &str, count: i32) -> Result<()>

Grow a topic to count partitions in total, not by count.

The broker’s own field is named count and means the new total; a wrapper that treated it as a delta would shrink a topic on the second call, which the broker refuses — loudly, which is the only reason that bug is survivable.

Expanding a topic changes where keys land for every default partitioner, this client’s included. It is not a transparent operation.

§Errors

If the controller rejects it.

Source

pub async fn describe_cluster(&mut self) -> Result<Vec<BrokerInfo>>

Every broker in the cluster, and which one is the controller.

§Errors

If no broker answers.

Source

pub async fn describe_topic_config( &mut self, topic: &str, ) -> Result<BTreeMap<String, Option<String>>>

A topic’s effective configuration: every key the broker reports, including the ones it defaulted.

§Errors

If the topic does not exist, or no broker answers.

Source

pub async fn delete_records( &mut self, before: &[(TopicPartition, i64)], ) -> Result<BTreeMap<TopicPartition, i64>>

Delete every record before the given offset, per partition.

Returns each partition’s new log start offset. This is the operation that makes beginning_offsets interesting: after it, offset zero is gone and a consumer that assumes zero asks for a record the broker no longer has.

Goes to the leader, not the controller: it moves one log’s start.

§Errors

If a leader cannot be found, or rejects the deletion.

Auto Trait Implementations§

§

impl<T> Freeze for Admin<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Admin<T>

§

impl<T> Send for Admin<T>
where T: Send, <T as Transport>::Stream: Send,

§

impl<T> Sync for Admin<T>
where T: Sync, <T as Transport>::Stream: Sync,

§

impl<T> Unpin for Admin<T>
where T: Unpin, <T as Transport>::Stream: Unpin,

§

impl<T> UnsafeUnpin for Admin<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Admin<T>

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> Same for T

Source§

type Output = T

Should always be Self
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.