#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AttributeValues {
#[prost(bytes = "vec", repeated, tag = "1")]
pub values: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PubSubMessage {
#[prost(bytes = "vec", tag = "1")]
pub key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "2")]
pub data: ::prost::alloc::vec::Vec<u8>,
#[prost(map = "string, message", tag = "3")]
pub attributes: ::std::collections::HashMap<::prost::alloc::string::String, AttributeValues>,
#[prost(message, optional, tag = "4")]
pub event_time: ::core::option::Option<::prost_types::Timestamp>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Cursor {
#[prost(int64, tag = "1")]
pub offset: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SequencedMessage {
#[prost(message, optional, tag = "1")]
pub cursor: ::core::option::Option<Cursor>,
#[prost(message, optional, tag = "2")]
pub publish_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "3")]
pub message: ::core::option::Option<PubSubMessage>,
#[prost(int64, tag = "4")]
pub size_bytes: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Reservation {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub throughput_capacity: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Topic {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub partition_config: ::core::option::Option<topic::PartitionConfig>,
#[prost(message, optional, tag = "3")]
pub retention_config: ::core::option::Option<topic::RetentionConfig>,
#[prost(message, optional, tag = "4")]
pub reservation_config: ::core::option::Option<topic::ReservationConfig>,
}
pub mod topic {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PartitionConfig {
#[prost(int64, tag = "1")]
pub count: i64,
#[prost(oneof = "partition_config::Dimension", tags = "2, 3")]
pub dimension: ::core::option::Option<partition_config::Dimension>,
}
pub mod partition_config {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Capacity {
#[prost(int32, tag = "1")]
pub publish_mib_per_sec: i32,
#[prost(int32, tag = "2")]
pub subscribe_mib_per_sec: i32,
}
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Dimension {
#[prost(int32, tag = "2")]
Scale(i32),
#[prost(message, tag = "3")]
Capacity(Capacity),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RetentionConfig {
#[prost(int64, tag = "1")]
pub per_partition_bytes: i64,
#[prost(message, optional, tag = "2")]
pub period: ::core::option::Option<::prost_types::Duration>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReservationConfig {
#[prost(string, tag = "1")]
pub throughput_reservation: ::prost::alloc::string::String,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Subscription {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub topic: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub delivery_config: ::core::option::Option<subscription::DeliveryConfig>,
}
pub mod subscription {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeliveryConfig {
#[prost(enumeration = "delivery_config::DeliveryRequirement", tag = "3")]
pub delivery_requirement: i32,
}
pub mod delivery_config {
#[derive(
Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration,
)]
#[repr(i32)]
pub enum DeliveryRequirement {
Unspecified = 0,
DeliverImmediately = 1,
DeliverAfterStored = 2,
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TimeTarget {
#[prost(oneof = "time_target::Time", tags = "1, 2")]
pub time: ::core::option::Option<time_target::Time>,
}
pub mod time_target {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Time {
#[prost(message, tag = "1")]
PublishTime(::prost_types::Timestamp),
#[prost(message, tag = "2")]
EventTime(::prost_types::Timestamp),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateTopicRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub topic: ::core::option::Option<Topic>,
#[prost(string, tag = "3")]
pub topic_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetTopicRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetTopicPartitionsRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TopicPartitions {
#[prost(int64, tag = "1")]
pub partition_count: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListTopicsRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListTopicsResponse {
#[prost(message, repeated, tag = "1")]
pub topics: ::prost::alloc::vec::Vec<Topic>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateTopicRequest {
#[prost(message, optional, tag = "1")]
pub topic: ::core::option::Option<Topic>,
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteTopicRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListTopicSubscriptionsRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListTopicSubscriptionsResponse {
#[prost(string, repeated, tag = "1")]
pub subscriptions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateSubscriptionRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub subscription: ::core::option::Option<Subscription>,
#[prost(string, tag = "3")]
pub subscription_id: ::prost::alloc::string::String,
#[prost(bool, tag = "4")]
pub skip_backlog: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetSubscriptionRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListSubscriptionsRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListSubscriptionsResponse {
#[prost(message, repeated, tag = "1")]
pub subscriptions: ::prost::alloc::vec::Vec<Subscription>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateSubscriptionRequest {
#[prost(message, optional, tag = "1")]
pub subscription: ::core::option::Option<Subscription>,
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteSubscriptionRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SeekSubscriptionRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(oneof = "seek_subscription_request::Target", tags = "2, 3")]
pub target: ::core::option::Option<seek_subscription_request::Target>,
}
pub mod seek_subscription_request {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum NamedTarget {
Unspecified = 0,
Tail = 1,
Head = 2,
}
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Target {
#[prost(enumeration = "NamedTarget", tag = "2")]
NamedTarget(i32),
#[prost(message, tag = "3")]
TimeTarget(super::TimeTarget),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SeekSubscriptionResponse {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OperationMetadata {
#[prost(message, optional, tag = "1")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "2")]
pub end_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(string, tag = "3")]
pub target: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub verb: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateReservationRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub reservation: ::core::option::Option<Reservation>,
#[prost(string, tag = "3")]
pub reservation_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetReservationRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListReservationsRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListReservationsResponse {
#[prost(message, repeated, tag = "1")]
pub reservations: ::prost::alloc::vec::Vec<Reservation>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateReservationRequest {
#[prost(message, optional, tag = "1")]
pub reservation: ::core::option::Option<Reservation>,
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteReservationRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListReservationTopicsRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListReservationTopicsResponse {
#[prost(string, repeated, tag = "1")]
pub topics: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[doc = r" Generated client implementations."]
pub mod admin_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " The service that a client application uses to manage topics and"]
#[doc = " subscriptions, such creating, listing, and deleting topics and subscriptions."]
#[derive(Debug, Clone)]
pub struct AdminServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> AdminServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> AdminServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
AdminServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Creates a new topic."]
pub async fn create_topic(
&mut self,
request: impl tonic::IntoRequest<super::CreateTopicRequest>,
) -> Result<tonic::Response<super::Topic>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/CreateTopic",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Returns the topic configuration."]
pub async fn get_topic(
&mut self,
request: impl tonic::IntoRequest<super::GetTopicRequest>,
) -> Result<tonic::Response<super::Topic>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/GetTopic",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Returns the partition information for the requested topic."]
pub async fn get_topic_partitions(
&mut self,
request: impl tonic::IntoRequest<super::GetTopicPartitionsRequest>,
) -> Result<tonic::Response<super::TopicPartitions>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/GetTopicPartitions",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Returns the list of topics for the given project."]
pub async fn list_topics(
&mut self,
request: impl tonic::IntoRequest<super::ListTopicsRequest>,
) -> Result<tonic::Response<super::ListTopicsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/ListTopics",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Updates properties of the specified topic."]
pub async fn update_topic(
&mut self,
request: impl tonic::IntoRequest<super::UpdateTopicRequest>,
) -> Result<tonic::Response<super::Topic>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/UpdateTopic",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Deletes the specified topic."]
pub async fn delete_topic(
&mut self,
request: impl tonic::IntoRequest<super::DeleteTopicRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/DeleteTopic",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists the subscriptions attached to the specified topic."]
pub async fn list_topic_subscriptions(
&mut self,
request: impl tonic::IntoRequest<super::ListTopicSubscriptionsRequest>,
) -> Result<tonic::Response<super::ListTopicSubscriptionsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/ListTopicSubscriptions",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Creates a new subscription."]
pub async fn create_subscription(
&mut self,
request: impl tonic::IntoRequest<super::CreateSubscriptionRequest>,
) -> Result<tonic::Response<super::Subscription>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/CreateSubscription",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Returns the subscription configuration."]
pub async fn get_subscription(
&mut self,
request: impl tonic::IntoRequest<super::GetSubscriptionRequest>,
) -> Result<tonic::Response<super::Subscription>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/GetSubscription",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Returns the list of subscriptions for the given project."]
pub async fn list_subscriptions(
&mut self,
request: impl tonic::IntoRequest<super::ListSubscriptionsRequest>,
) -> Result<tonic::Response<super::ListSubscriptionsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/ListSubscriptions",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Updates properties of the specified subscription."]
pub async fn update_subscription(
&mut self,
request: impl tonic::IntoRequest<super::UpdateSubscriptionRequest>,
) -> Result<tonic::Response<super::Subscription>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/UpdateSubscription",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Deletes the specified subscription."]
pub async fn delete_subscription(
&mut self,
request: impl tonic::IntoRequest<super::DeleteSubscriptionRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/DeleteSubscription",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Performs an out-of-band seek for a subscription to a specified target,"]
#[doc = " which may be timestamps or named positions within the message backlog."]
#[doc = " Seek translates these targets to cursors for each partition and"]
#[doc = " orchestrates subscribers to start consuming messages from these seek"]
#[doc = " cursors."]
#[doc = ""]
#[doc = " If an operation is returned, the seek has been registered and subscribers"]
#[doc = " will eventually receive messages from the seek cursors (i.e. eventual"]
#[doc = " consistency), as long as they are using a minimum supported client library"]
#[doc = " version and not a system that tracks cursors independently of Pub/Sub Lite"]
#[doc = " (e.g. Apache Beam, Dataflow, Spark). The seek operation will fail for"]
#[doc = " unsupported clients."]
#[doc = ""]
#[doc = " If clients would like to know when subscribers react to the seek (or not),"]
#[doc = " they can poll the operation. The seek operation will succeed and complete"]
#[doc = " once subscribers are ready to receive messages from the seek cursors for"]
#[doc = " all partitions of the topic. This means that the seek operation will not"]
#[doc = " complete until all subscribers come online."]
#[doc = ""]
#[doc = " If the previous seek operation has not yet completed, it will be aborted"]
#[doc = " and the new invocation of seek will supersede it."]
pub async fn seek_subscription(
&mut self,
request: impl tonic::IntoRequest<super::SeekSubscriptionRequest>,
) -> Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/SeekSubscription",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Creates a new reservation."]
pub async fn create_reservation(
&mut self,
request: impl tonic::IntoRequest<super::CreateReservationRequest>,
) -> Result<tonic::Response<super::Reservation>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/CreateReservation",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Returns the reservation configuration."]
pub async fn get_reservation(
&mut self,
request: impl tonic::IntoRequest<super::GetReservationRequest>,
) -> Result<tonic::Response<super::Reservation>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/GetReservation",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Returns the list of reservations for the given project."]
pub async fn list_reservations(
&mut self,
request: impl tonic::IntoRequest<super::ListReservationsRequest>,
) -> Result<tonic::Response<super::ListReservationsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/ListReservations",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Updates properties of the specified reservation."]
pub async fn update_reservation(
&mut self,
request: impl tonic::IntoRequest<super::UpdateReservationRequest>,
) -> Result<tonic::Response<super::Reservation>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/UpdateReservation",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Deletes the specified reservation."]
pub async fn delete_reservation(
&mut self,
request: impl tonic::IntoRequest<super::DeleteReservationRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/DeleteReservation",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists the topics attached to the specified reservation."]
pub async fn list_reservation_topics(
&mut self,
request: impl tonic::IntoRequest<super::ListReservationTopicsRequest>,
) -> Result<tonic::Response<super::ListReservationTopicsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/ListReservationTopics",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InitialCommitCursorRequest {
#[prost(string, tag = "1")]
pub subscription: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub partition: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InitialCommitCursorResponse {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SequencedCommitCursorRequest {
#[prost(message, optional, tag = "1")]
pub cursor: ::core::option::Option<Cursor>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SequencedCommitCursorResponse {
#[prost(int64, tag = "1")]
pub acknowledged_commits: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamingCommitCursorRequest {
#[prost(oneof = "streaming_commit_cursor_request::Request", tags = "1, 2")]
pub request: ::core::option::Option<streaming_commit_cursor_request::Request>,
}
pub mod streaming_commit_cursor_request {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Request {
#[prost(message, tag = "1")]
Initial(super::InitialCommitCursorRequest),
#[prost(message, tag = "2")]
Commit(super::SequencedCommitCursorRequest),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamingCommitCursorResponse {
#[prost(oneof = "streaming_commit_cursor_response::Request", tags = "1, 2")]
pub request: ::core::option::Option<streaming_commit_cursor_response::Request>,
}
pub mod streaming_commit_cursor_response {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Request {
#[prost(message, tag = "1")]
Initial(super::InitialCommitCursorResponse),
#[prost(message, tag = "2")]
Commit(super::SequencedCommitCursorResponse),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommitCursorRequest {
#[prost(string, tag = "1")]
pub subscription: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub partition: i64,
#[prost(message, optional, tag = "3")]
pub cursor: ::core::option::Option<Cursor>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommitCursorResponse {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListPartitionCursorsRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PartitionCursor {
#[prost(int64, tag = "1")]
pub partition: i64,
#[prost(message, optional, tag = "2")]
pub cursor: ::core::option::Option<Cursor>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListPartitionCursorsResponse {
#[prost(message, repeated, tag = "1")]
pub partition_cursors: ::prost::alloc::vec::Vec<PartitionCursor>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[doc = r" Generated client implementations."]
pub mod cursor_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " The service that a subscriber client application uses to manage committed"]
#[doc = " cursors while receiving messsages. A cursor represents a subscriber's"]
#[doc = " progress within a topic partition for a given subscription."]
#[derive(Debug, Clone)]
pub struct CursorServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> CursorServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> CursorServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
CursorServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Establishes a stream with the server for managing committed cursors."]
pub async fn streaming_commit_cursor(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::StreamingCommitCursorRequest>,
) -> Result<
tonic::Response<tonic::codec::Streaming<super::StreamingCommitCursorResponse>>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.CursorService/StreamingCommitCursor",
);
self.inner.streaming(request.into_streaming_request(), path, codec).await
}
#[doc = " Updates the committed cursor."]
pub async fn commit_cursor(
&mut self,
request: impl tonic::IntoRequest<super::CommitCursorRequest>,
) -> Result<tonic::Response<super::CommitCursorResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.CursorService/CommitCursor",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Returns all committed cursor information for a subscription."]
pub async fn list_partition_cursors(
&mut self,
request: impl tonic::IntoRequest<super::ListPartitionCursorsRequest>,
) -> Result<tonic::Response<super::ListPartitionCursorsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.CursorService/ListPartitionCursors",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InitialPublishRequest {
#[prost(string, tag = "1")]
pub topic: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub partition: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InitialPublishResponse {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MessagePublishRequest {
#[prost(message, repeated, tag = "1")]
pub messages: ::prost::alloc::vec::Vec<PubSubMessage>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MessagePublishResponse {
#[prost(message, optional, tag = "1")]
pub start_cursor: ::core::option::Option<Cursor>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PublishRequest {
#[prost(oneof = "publish_request::RequestType", tags = "1, 2")]
pub request_type: ::core::option::Option<publish_request::RequestType>,
}
pub mod publish_request {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum RequestType {
#[prost(message, tag = "1")]
InitialRequest(super::InitialPublishRequest),
#[prost(message, tag = "2")]
MessagePublishRequest(super::MessagePublishRequest),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PublishResponse {
#[prost(oneof = "publish_response::ResponseType", tags = "1, 2")]
pub response_type: ::core::option::Option<publish_response::ResponseType>,
}
pub mod publish_response {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum ResponseType {
#[prost(message, tag = "1")]
InitialResponse(super::InitialPublishResponse),
#[prost(message, tag = "2")]
MessageResponse(super::MessagePublishResponse),
}
}
#[doc = r" Generated client implementations."]
pub mod publisher_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " The service that a publisher client application uses to publish messages to"]
#[doc = " topics. Published messages are retained by the service for the duration of"]
#[doc = " the retention period configured for the respective topic, and are delivered"]
#[doc = " to subscriber clients upon request (via the `SubscriberService`)."]
#[derive(Debug, Clone)]
pub struct PublisherServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> PublisherServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> PublisherServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
PublisherServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Establishes a stream with the server for publishing messages. Once the"]
#[doc = " stream is initialized, the client publishes messages by sending publish"]
#[doc = " requests on the stream. The server responds with a PublishResponse for each"]
#[doc = " PublishRequest sent by the client, in the same order that the requests"]
#[doc = " were sent. Note that multiple PublishRequests can be in flight"]
#[doc = " simultaneously, but they will be processed by the server in the order that"]
#[doc = " they are sent by the client on a given stream."]
pub async fn publish(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::PublishRequest>,
) -> Result<tonic::Response<tonic::codec::Streaming<super::PublishResponse>>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.PublisherService/Publish",
);
self.inner.streaming(request.into_streaming_request(), path, codec).await
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InitialSubscribeRequest {
#[prost(string, tag = "1")]
pub subscription: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub partition: i64,
#[prost(message, optional, tag = "4")]
pub initial_location: ::core::option::Option<SeekRequest>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InitialSubscribeResponse {
#[prost(message, optional, tag = "1")]
pub cursor: ::core::option::Option<Cursor>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SeekRequest {
#[prost(oneof = "seek_request::Target", tags = "1, 2")]
pub target: ::core::option::Option<seek_request::Target>,
}
pub mod seek_request {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum NamedTarget {
Unspecified = 0,
Head = 1,
CommittedCursor = 2,
}
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Target {
#[prost(enumeration = "NamedTarget", tag = "1")]
NamedTarget(i32),
#[prost(message, tag = "2")]
Cursor(super::Cursor),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SeekResponse {
#[prost(message, optional, tag = "1")]
pub cursor: ::core::option::Option<Cursor>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FlowControlRequest {
#[prost(int64, tag = "1")]
pub allowed_messages: i64,
#[prost(int64, tag = "2")]
pub allowed_bytes: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeRequest {
#[prost(oneof = "subscribe_request::Request", tags = "1, 2, 3")]
pub request: ::core::option::Option<subscribe_request::Request>,
}
pub mod subscribe_request {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Request {
#[prost(message, tag = "1")]
Initial(super::InitialSubscribeRequest),
#[prost(message, tag = "2")]
Seek(super::SeekRequest),
#[prost(message, tag = "3")]
FlowControl(super::FlowControlRequest),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MessageResponse {
#[prost(message, repeated, tag = "1")]
pub messages: ::prost::alloc::vec::Vec<SequencedMessage>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeResponse {
#[prost(oneof = "subscribe_response::Response", tags = "1, 2, 3")]
pub response: ::core::option::Option<subscribe_response::Response>,
}
pub mod subscribe_response {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Response {
#[prost(message, tag = "1")]
Initial(super::InitialSubscribeResponse),
#[prost(message, tag = "2")]
Seek(super::SeekResponse),
#[prost(message, tag = "3")]
Messages(super::MessageResponse),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InitialPartitionAssignmentRequest {
#[prost(string, tag = "1")]
pub subscription: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "2")]
pub client_id: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PartitionAssignment {
#[prost(int64, repeated, tag = "1")]
pub partitions: ::prost::alloc::vec::Vec<i64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PartitionAssignmentAck {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PartitionAssignmentRequest {
#[prost(oneof = "partition_assignment_request::Request", tags = "1, 2")]
pub request: ::core::option::Option<partition_assignment_request::Request>,
}
pub mod partition_assignment_request {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Request {
#[prost(message, tag = "1")]
Initial(super::InitialPartitionAssignmentRequest),
#[prost(message, tag = "2")]
Ack(super::PartitionAssignmentAck),
}
}
#[doc = r" Generated client implementations."]
pub mod subscriber_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " The service that a subscriber client application uses to receive messages"]
#[doc = " from subscriptions."]
#[derive(Debug, Clone)]
pub struct SubscriberServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> SubscriberServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> SubscriberServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
SubscriberServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Establishes a stream with the server for receiving messages."]
pub async fn subscribe(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::SubscribeRequest>,
) -> Result<tonic::Response<tonic::codec::Streaming<super::SubscribeResponse>>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.SubscriberService/Subscribe",
);
self.inner.streaming(request.into_streaming_request(), path, codec).await
}
}
}
#[doc = r" Generated client implementations."]
pub mod partition_assignment_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " The service that a subscriber client application uses to determine which"]
#[doc = " partitions it should connect to."]
#[derive(Debug, Clone)]
pub struct PartitionAssignmentServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> PartitionAssignmentServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> PartitionAssignmentServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
PartitionAssignmentServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Assign partitions for this client to handle for the specified subscription."]
#[doc = ""]
#[doc = " The client must send an InitialPartitionAssignmentRequest first."]
#[doc = " The server will then send at most one unacknowledged PartitionAssignment"]
#[doc = " outstanding on the stream at a time."]
#[doc = " The client should send a PartitionAssignmentAck after updating the"]
#[doc = " partitions it is connected to to reflect the new assignment."]
pub async fn assign_partitions(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::PartitionAssignmentRequest>,
) -> Result<
tonic::Response<tonic::codec::Streaming<super::PartitionAssignment>>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.PartitionAssignmentService/AssignPartitions",
);
self.inner.streaming(request.into_streaming_request(), path, codec).await
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ComputeMessageStatsRequest {
#[prost(string, tag = "1")]
pub topic: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub partition: i64,
#[prost(message, optional, tag = "3")]
pub start_cursor: ::core::option::Option<Cursor>,
#[prost(message, optional, tag = "4")]
pub end_cursor: ::core::option::Option<Cursor>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ComputeMessageStatsResponse {
#[prost(int64, tag = "1")]
pub message_count: i64,
#[prost(int64, tag = "2")]
pub message_bytes: i64,
#[prost(message, optional, tag = "3")]
pub minimum_publish_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "4")]
pub minimum_event_time: ::core::option::Option<::prost_types::Timestamp>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ComputeHeadCursorRequest {
#[prost(string, tag = "1")]
pub topic: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub partition: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ComputeHeadCursorResponse {
#[prost(message, optional, tag = "1")]
pub head_cursor: ::core::option::Option<Cursor>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ComputeTimeCursorRequest {
#[prost(string, tag = "1")]
pub topic: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub partition: i64,
#[prost(message, optional, tag = "3")]
pub target: ::core::option::Option<TimeTarget>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ComputeTimeCursorResponse {
#[prost(message, optional, tag = "1")]
pub cursor: ::core::option::Option<Cursor>,
}
#[doc = r" Generated client implementations."]
pub mod topic_stats_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " This service allows users to get stats about messages in their topic."]
#[derive(Debug, Clone)]
pub struct TopicStatsServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> TopicStatsServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> TopicStatsServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
TopicStatsServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Compute statistics about a range of messages in a given topic and"]
#[doc = " partition."]
pub async fn compute_message_stats(
&mut self,
request: impl tonic::IntoRequest<super::ComputeMessageStatsRequest>,
) -> Result<tonic::Response<super::ComputeMessageStatsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.TopicStatsService/ComputeMessageStats",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Compute the head cursor for the partition."]
#[doc = " The head cursor's offset is guaranteed to be less than or equal to all"]
#[doc = " messages which have not yet been acknowledged as published, and"]
#[doc = " greater than the offset of any message whose publish has already"]
#[doc = " been acknowledged. It is zero if there have never been messages in the"]
#[doc = " partition."]
pub async fn compute_head_cursor(
&mut self,
request: impl tonic::IntoRequest<super::ComputeHeadCursorRequest>,
) -> Result<tonic::Response<super::ComputeHeadCursorResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.TopicStatsService/ComputeHeadCursor",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Compute the corresponding cursor for a publish or event time in a topic"]
#[doc = " partition."]
pub async fn compute_time_cursor(
&mut self,
request: impl tonic::IntoRequest<super::ComputeTimeCursorRequest>,
) -> Result<tonic::Response<super::ComputeTimeCursorResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.TopicStatsService/ComputeTimeCursor",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}