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>
impl<T: Transport> Admin<T>
Sourcepub fn set_operation_timeout(&mut self, timeout: Duration)
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.
Sourcepub fn cluster(&mut self) -> &mut Cluster<T>
pub fn cluster(&mut self) -> &mut Cluster<T>
The underlying cluster, for callers that want metadata directly.
Sourcepub async fn create_topics(&mut self, topics: &[NewTopic]) -> Result<()>
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.
Sourcepub async fn delete_topics(&mut self, names: &[String]) -> Result<()>
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.
Sourcepub async fn create_partitions(&mut self, topic: &str, count: i32) -> Result<()>
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.
Sourcepub async fn describe_cluster(&mut self) -> Result<Vec<BrokerInfo>>
pub async fn describe_cluster(&mut self) -> Result<Vec<BrokerInfo>>
Sourcepub async fn describe_topic_config(
&mut self,
topic: &str,
) -> Result<BTreeMap<String, Option<String>>>
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.
Sourcepub async fn delete_records(
&mut self,
before: &[(TopicPartition, i64)],
) -> Result<BTreeMap<TopicPartition, i64>>
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.