Struct rdkafka::admin::AdminClient

source ·
pub struct AdminClient<C: ClientContext + 'static> { /* private fields */ }
Expand description

A client for the Kafka admin API.

AdminClient provides programmatic access to managing a Kafka cluster, notably manipulating topics, partitions, and configuration paramaters.

Implementations§

source§

impl<C: ClientContext> AdminClient<C>

source

pub fn create_topics<'a, I>( &self, topics: I, opts: &AdminOptions, ) -> impl Future<Output = KafkaResult<Vec<TopicResult>>>
where I: IntoIterator<Item = &'a NewTopic<'a>>,

Creates new topics according to the provided NewTopic specifications.

Note that while the API supports creating multiple topics at once, it is not transactional. Creation of some topics may succeed while others fail. Be sure to check the result of each individual operation.

source

pub fn delete_topics( &self, topic_names: &[&str], opts: &AdminOptions, ) -> impl Future<Output = KafkaResult<Vec<TopicResult>>>

Deletes the named topics.

Note that while the API supports deleting multiple topics at once, it is not transactional. Deletion of some topics may succeed while others fail. Be sure to check the result of each individual operation.

source

pub fn create_partitions<'a, I>( &self, partitions: I, opts: &AdminOptions, ) -> impl Future<Output = KafkaResult<Vec<TopicResult>>>
where I: IntoIterator<Item = &'a NewPartitions<'a>>,

Adds additional partitions to existing topics according to the provided NewPartitions specifications.

Note that while the API supports creating partitions for multiple topics at once, it is not transactional. Creation of partitions for some topics may succeed while others fail. Be sure to check the result of each individual operation.

source

pub fn delete_records( &self, offsets: &TopicPartitionList, opts: &AdminOptions, ) -> impl Future<Output = KafkaResult<TopicPartitionList>>

Deletes records from a topic.

The provided offsets is a topic partition list specifying which records to delete from a list of topic partitions. For each entry in the list, the messages at offsets before the specified offsets (exclusive) in the specified partition will be deleted. Use offset [Offset::End] to delete all records in the partition.

Returns a topic partition list describing the result of the deletion. If the operation succeeded for a partition, the offset for that partition will be set to the post-deletion low-water mark for that partition. If the operation failed for a partition, there will be an error for that partition’s entry in the list.

source

pub fn describe_configs<'a, I>( &self, configs: I, opts: &AdminOptions, ) -> impl Future<Output = KafkaResult<Vec<ConfigResourceResult>>>
where I: IntoIterator<Item = &'a ResourceSpecifier<'a>>,

Retrieves the configuration parameters for the specified resources.

Note that while the API supports describing multiple configurations at once, it is not transactional. There is no guarantee that you will see a consistent snapshot of the configuration across different resources.

source

pub fn alter_configs<'a, I>( &self, configs: I, opts: &AdminOptions, ) -> impl Future<Output = KafkaResult<Vec<AlterConfigsResult>>>
where I: IntoIterator<Item = &'a AlterConfig<'a>>,

Sets configuration parameters for the specified resources.

Note that while the API supports altering multiple resources at once, it is not transactional. Alteration of some resources may succeed while others fail. Be sure to check the result of each individual operation.

source

pub fn inner(&self) -> &Client<C>

Returns the client underlying this admin client.

Trait Implementations§

source§

impl<C: ClientContext> Drop for AdminClient<C>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl FromClientConfig for AdminClient<DefaultClientContext>

source§

fn from_config( config: &ClientConfig, ) -> KafkaResult<AdminClient<DefaultClientContext>>

Creates a client from a client configuration. The default client context will be used.
source§

impl<C: ClientContext> FromClientConfigAndContext<C> for AdminClient<C>

source§

fn from_config_and_context( config: &ClientConfig, context: C, ) -> KafkaResult<AdminClient<C>>

Creates a client from a client configuration and a client context.

Auto Trait Implementations§

§

impl<C> Freeze for AdminClient<C>

§

impl<C> !RefUnwindSafe for AdminClient<C>

§

impl<C> Send for AdminClient<C>

§

impl<C> Sync for AdminClient<C>

§

impl<C> Unpin for AdminClient<C>

§

impl<C> !UnwindSafe for AdminClient<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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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>,

§

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

§

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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more