pub struct NewTopic { /* private fields */ }Expand description
A new topic to be created via Admin::create_topics.
Implementations§
Source§impl NewTopic
impl NewTopic
Sourcepub fn with_num_partitions_replication_factor(
name: impl Into<String>,
num_partitions: Option<i32>,
replication_factor: Option<i16>,
) -> Self
pub fn with_num_partitions_replication_factor( name: impl Into<String>, num_partitions: Option<i32>, replication_factor: Option<i16>, ) -> Self
A new topic that optionally defaults num_partitions and replication_factor to the
broker configurations for num.partitions and default.replication.factor respectively.
§Arguments
name- the topic name.num_partitions- the number of partitions, orNonefor the broker default.replication_factor- the replication factor, orNonefor the broker default.
§Translation notes
Translates both NewTopic(String, int, short) and
NewTopic(String, Optional<Integer>, Optional<Short>): callers of the former pass Some.
Sourcepub fn with_replicas_assignments(
name: impl Into<String>,
replicas_assignments: BTreeMap<i32, Vec<i32>>,
) -> Self
pub fn with_replicas_assignments( name: impl Into<String>, replicas_assignments: BTreeMap<i32, Vec<i32>>, ) -> Self
A new topic with the specified replica assignment configuration.
§Arguments
name- the topic name.replicas_assignments- a map from partition id to replica ids (i.e. broker ids). Although not enforced, it is generally a good idea for all partitions to have the same number of replicas. The first replica will be treated as the preferred leader.
Sourcepub fn num_partitions(&self) -> i32
pub fn num_partitions(&self) -> i32
Returns the number of partitions for the new topic or -1 if a replica assignment has been specified.
Sourcepub fn replication_factor(&self) -> i16
pub fn replication_factor(&self) -> i16
Returns the replication factor for the new topic or -1 if a replica assignment has been specified.
Sourcepub fn replicas_assignments(&self) -> Option<&BTreeMap<i32, Vec<i32>>>
pub fn replicas_assignments(&self) -> Option<&BTreeMap<i32, Vec<i32>>>
Returns a map from partition id to replica ids (i.e. broker ids) or None if the
number of partitions and replication factor have been specified instead.
Trait Implementations§
Source§impl Display for NewTopic
Java’s toString(): an unset partition
count or replication factor renders as default, and the two maps as Java’s
AbstractMap.toString() renders them ({0=[1, 2]}, {k=v}), with null
for a missing map.
impl Display for NewTopic
Java’s toString(): an unset partition
count or replication factor renders as default, and the two maps as Java’s
AbstractMap.toString() renders them ({0=[1, 2]}, {k=v}), with null
for a missing map.
impl Eq for NewTopic
impl StructuralPartialEq for NewTopic
Auto Trait Implementations§
impl Freeze for NewTopic
impl RefUnwindSafe for NewTopic
impl Send for NewTopic
impl Sync for NewTopic
impl Unpin for NewTopic
impl UnsafeUnpin for NewTopic
impl UnwindSafe for NewTopic
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.