pub struct TopicManager { /* private fields */ }Expand description
Topic manager for managing Pub/Sub topics.
Uses the google-cloud-pubsub 0.33 TopicAdmin client for topic management
and tracks topics in a local cache.
Implementations§
Source§impl TopicManager
impl TopicManager
Sourcepub async fn create_topic(&self, config: TopicConfig) -> Result<String>
pub async fn create_topic(&self, config: TopicConfig) -> Result<String>
Creates a new topic.
Sourcepub fn get_topic(&self, topic_name: &str) -> Option<String>
pub fn get_topic(&self, topic_name: &str) -> Option<String>
Gets a fully-qualified topic name by short name.
Sourcepub async fn delete_topic(&self, topic_name: &str) -> Result<()>
pub async fn delete_topic(&self, topic_name: &str) -> Result<()>
Deletes a topic.
Sourcepub fn list_topics(&self) -> Vec<String>
pub fn list_topics(&self) -> Vec<String>
Lists all topics in the project.
Sourcepub fn topic_exists(&self, topic_name: &str) -> bool
pub fn topic_exists(&self, topic_name: &str) -> bool
Checks if a topic exists.
Sourcepub fn topic_count(&self) -> usize
pub fn topic_count(&self) -> usize
Gets the number of managed topics.
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clears all cached topics.
Sourcepub fn project_id(&self) -> &str
pub fn project_id(&self) -> &str
Gets the project ID.
Sourcepub async fn update_labels(
&self,
topic_name: &str,
_labels: HashMap<String, String>,
) -> Result<()>
pub async fn update_labels( &self, topic_name: &str, _labels: HashMap<String, String>, ) -> Result<()>
Updates topic labels.
Sourcepub async fn get_metadata(&self, topic_name: &str) -> Result<TopicMetadata>
pub async fn get_metadata(&self, topic_name: &str) -> Result<TopicMetadata>
Gets topic metadata.
Sourcepub async fn get_stats(&self, topic_name: &str) -> Result<TopicStats>
pub async fn get_stats(&self, topic_name: &str) -> Result<TopicStats>
Gets topic statistics.
Sourcepub async fn test_publish(&self, topic_name: &str) -> Result<String>
pub async fn test_publish(&self, topic_name: &str) -> Result<String>
Publishes a test message to verify topic connectivity.
Auto Trait Implementations§
impl Freeze for TopicManager
impl !RefUnwindSafe for TopicManager
impl Send for TopicManager
impl Sync for TopicManager
impl Unpin for TopicManager
impl UnsafeUnpin for TopicManager
impl !UnwindSafe for TopicManager
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request