Skip to content

Commit

Permalink
chore: update tonic_build to use compile_protos()
Browse files Browse the repository at this point in the history
  • Loading branch information
liufuyang committed Oct 17, 2024
1 parent 9d2b628 commit be21a8e
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 82 deletions.
2 changes: 1 addition & 1 deletion bigtable_rs/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
)
.extern_path(".google.protobuf", "::prost_wkt_types")
.file_descriptor_set_path(&descriptor_file)
.compile(
.compile_protos(
&[
"../googleapis/google/bigtable/v2/bigtable.proto",
"../googleapis/test/bigtable_test.proto", // only works with fork https://github.com/liufuyang/googleapis
Expand Down
70 changes: 33 additions & 37 deletions bigtable_rs/src/google/google.api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,14 +444,14 @@ impl LaunchStage {
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
LaunchStage::Unspecified => "LAUNCH_STAGE_UNSPECIFIED",
LaunchStage::Unimplemented => "UNIMPLEMENTED",
LaunchStage::Prelaunch => "PRELAUNCH",
LaunchStage::EarlyAccess => "EARLY_ACCESS",
LaunchStage::Alpha => "ALPHA",
LaunchStage::Beta => "BETA",
LaunchStage::Ga => "GA",
LaunchStage::Deprecated => "DEPRECATED",
Self::Unspecified => "LAUNCH_STAGE_UNSPECIFIED",
Self::Unimplemented => "UNIMPLEMENTED",
Self::Prelaunch => "PRELAUNCH",
Self::EarlyAccess => "EARLY_ACCESS",
Self::Alpha => "ALPHA",
Self::Beta => "BETA",
Self::Ga => "GA",
Self::Deprecated => "DEPRECATED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
Expand Down Expand Up @@ -819,16 +819,14 @@ impl ClientLibraryOrganization {
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
ClientLibraryOrganization::Unspecified => {
"CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED"
}
ClientLibraryOrganization::Cloud => "CLOUD",
ClientLibraryOrganization::Ads => "ADS",
ClientLibraryOrganization::Photos => "PHOTOS",
ClientLibraryOrganization::StreetView => "STREET_VIEW",
ClientLibraryOrganization::Shopping => "SHOPPING",
ClientLibraryOrganization::Geo => "GEO",
ClientLibraryOrganization::GenerativeAi => "GENERATIVE_AI",
Self::Unspecified => "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED",
Self::Cloud => "CLOUD",
Self::Ads => "ADS",
Self::Photos => "PHOTOS",
Self::StreetView => "STREET_VIEW",
Self::Shopping => "SHOPPING",
Self::Geo => "GEO",
Self::GenerativeAi => "GENERATIVE_AI",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
Expand Down Expand Up @@ -869,11 +867,9 @@ impl ClientLibraryDestination {
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
ClientLibraryDestination::Unspecified => {
"CLIENT_LIBRARY_DESTINATION_UNSPECIFIED"
}
ClientLibraryDestination::Github => "GITHUB",
ClientLibraryDestination::PackageManager => "PACKAGE_MANAGER",
Self::Unspecified => "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED",
Self::Github => "GITHUB",
Self::PackageManager => "PACKAGE_MANAGER",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
Expand Down Expand Up @@ -952,15 +948,15 @@ impl FieldBehavior {
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
FieldBehavior::Unspecified => "FIELD_BEHAVIOR_UNSPECIFIED",
FieldBehavior::Optional => "OPTIONAL",
FieldBehavior::Required => "REQUIRED",
FieldBehavior::OutputOnly => "OUTPUT_ONLY",
FieldBehavior::InputOnly => "INPUT_ONLY",
FieldBehavior::Immutable => "IMMUTABLE",
FieldBehavior::UnorderedList => "UNORDERED_LIST",
FieldBehavior::NonEmptyDefault => "NON_EMPTY_DEFAULT",
FieldBehavior::Identifier => "IDENTIFIER",
Self::Unspecified => "FIELD_BEHAVIOR_UNSPECIFIED",
Self::Optional => "OPTIONAL",
Self::Required => "REQUIRED",
Self::OutputOnly => "OUTPUT_ONLY",
Self::InputOnly => "INPUT_ONLY",
Self::Immutable => "IMMUTABLE",
Self::UnorderedList => "UNORDERED_LIST",
Self::NonEmptyDefault => "NON_EMPTY_DEFAULT",
Self::Identifier => "IDENTIFIER",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
Expand Down Expand Up @@ -1157,9 +1153,9 @@ pub mod resource_descriptor {
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
History::Unspecified => "HISTORY_UNSPECIFIED",
History::OriginallySinglePattern => "ORIGINALLY_SINGLE_PATTERN",
History::FutureMultiPattern => "FUTURE_MULTI_PATTERN",
Self::Unspecified => "HISTORY_UNSPECIFIED",
Self::OriginallySinglePattern => "ORIGINALLY_SINGLE_PATTERN",
Self::FutureMultiPattern => "FUTURE_MULTI_PATTERN",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
Expand Down Expand Up @@ -1208,8 +1204,8 @@ pub mod resource_descriptor {
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Style::Unspecified => "STYLE_UNSPECIFIED",
Style::DeclarativeFriendly => "DECLARATIVE_FRIENDLY",
Self::Unspecified => "STYLE_UNSPECIFIED",
Self::DeclarativeFriendly => "DECLARATIVE_FRIENDLY",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
Expand Down
67 changes: 23 additions & 44 deletions bigtable_rs/src/google/google.bigtable.v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -893,9 +893,9 @@ pub mod read_rows_request {
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
RequestStatsView::Unspecified => "REQUEST_STATS_VIEW_UNSPECIFIED",
RequestStatsView::RequestStatsNone => "REQUEST_STATS_NONE",
RequestStatsView::RequestStatsFull => "REQUEST_STATS_FULL",
Self::Unspecified => "REQUEST_STATS_VIEW_UNSPECIFIED",
Self::RequestStatsNone => "REQUEST_STATS_NONE",
Self::RequestStatsFull => "REQUEST_STATS_FULL",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
Expand Down Expand Up @@ -1546,10 +1546,10 @@ pub mod read_change_stream_response {
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Type::Unspecified => "TYPE_UNSPECIFIED",
Type::User => "USER",
Type::GarbageCollection => "GARBAGE_COLLECTION",
Type::Continuation => "CONTINUATION",
Self::Unspecified => "TYPE_UNSPECIFIED",
Self::User => "USER",
Self::GarbageCollection => "GARBAGE_COLLECTION",
Self::Continuation => "CONTINUATION",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
Expand Down Expand Up @@ -1641,7 +1641,13 @@ pub mod read_change_stream_response {
}
/// Generated client implementations.
pub mod bigtable_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
/// Service for reading from and writing to existing Bigtable tables.
Expand Down Expand Up @@ -1737,10 +1743,7 @@ pub mod bigtable_client {
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic::codec::ProstCodec::default();
let path =
Expand All @@ -1762,10 +1765,7 @@ pub mod bigtable_client {
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic::codec::ProstCodec::default();
let path =
Expand All @@ -1784,10 +1784,7 @@ pub mod bigtable_client {
request: impl tonic::IntoRequest<super::MutateRowRequest>,
) -> std::result::Result<tonic::Response<super::MutateRowResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic::codec::ProstCodec::default();
let path =
Expand All @@ -1808,10 +1805,7 @@ pub mod bigtable_client {
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic::codec::ProstCodec::default();
let path =
Expand All @@ -1828,10 +1822,7 @@ pub mod bigtable_client {
) -> std::result::Result<tonic::Response<super::CheckAndMutateRowResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
Expand All @@ -1852,10 +1843,7 @@ pub mod bigtable_client {
) -> std::result::Result<tonic::Response<super::PingAndWarmResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic::codec::ProstCodec::default();
let path =
Expand All @@ -1878,10 +1866,7 @@ pub mod bigtable_client {
) -> std::result::Result<tonic::Response<super::ReadModifyWriteRowResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
Expand All @@ -1908,10 +1893,7 @@ pub mod bigtable_client {
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
Expand All @@ -1936,10 +1918,7 @@ pub mod bigtable_client {
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
Expand Down

0 comments on commit be21a8e

Please sign in to comment.