// This file is @generated by prost-build. /// Canonical object id. `value` preserves the original binary representation used /// by the existing API; `hex` is the normalized lowercase hex form for clients. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Oid { #[prost(bytes = "vec", tag = "1")] pub value: ::prost::alloc::vec::Vec, #[prost(string, tag = "2")] pub hex: ::prost::alloc::string::String, #[prost(enumeration = "ObjectFormat", tag = "3")] pub format: i32, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ObjectName { /// Revision expression, refname, oid hex, or pseudo-ref such as HEAD. #[prost(string, tag = "1")] pub revision: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ObjectSelector { #[prost(oneof = "object_selector::Selector", tags = "1, 2")] pub selector: ::core::option::Option, } /// Nested message and enum types in `ObjectSelector`. pub mod object_selector { #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Selector { #[prost(message, tag = "1")] Oid(super::Oid), #[prost(message, tag = "2")] Revision(super::ObjectName), } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ObjectIdentity { #[prost(message, optional, tag = "1")] pub oid: ::core::option::Option, #[prost(enumeration = "ObjectType", tag = "2")] pub r#type: i32, #[prost(int64, tag = "3")] pub size: i64, #[prost(string, tag = "4")] pub abbreviated_oid: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct Pagination { #[prost(uint32, tag = "1")] pub page_size: u32, #[prost(string, tag = "2")] pub page_token: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct PageInfo { #[prost(string, tag = "1")] pub next_page_token: ::prost::alloc::string::String, #[prost(bool, tag = "2")] pub has_next_page: bool, #[prost(uint64, tag = "3")] pub total_count: u64, } /// Git object hash algorithm. GitHub and Gitaly both need to support SHA-1 today /// and SHA-256 repositories as they become more common. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum ObjectFormat { Unspecified = 0, Sha1 = 1, Sha256 = 2, } impl ObjectFormat { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { Self::Unspecified => "OBJECT_FORMAT_UNSPECIFIED", Self::Sha1 => "OBJECT_FORMAT_SHA1", Self::Sha256 => "OBJECT_FORMAT_SHA256", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "OBJECT_FORMAT_UNSPECIFIED" => Some(Self::Unspecified), "OBJECT_FORMAT_SHA1" => Some(Self::Sha1), "OBJECT_FORMAT_SHA256" => Some(Self::Sha256), _ => None, } } } /// Git object kind. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum ObjectType { Unspecified = 0, Commit = 1, Tree = 2, Blob = 3, Tag = 4, } impl ObjectType { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { Self::Unspecified => "OBJECT_TYPE_UNSPECIFIED", Self::Commit => "OBJECT_TYPE_COMMIT", Self::Tree => "OBJECT_TYPE_TREE", Self::Blob => "OBJECT_TYPE_BLOB", Self::Tag => "OBJECT_TYPE_TAG", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "OBJECT_TYPE_UNSPECIFIED" => Some(Self::Unspecified), "OBJECT_TYPE_COMMIT" => Some(Self::Commit), "OBJECT_TYPE_TREE" => Some(Self::Tree), "OBJECT_TYPE_BLOB" => Some(Self::Blob), "OBJECT_TYPE_TAG" => Some(Self::Tag), _ => None, } } } #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum SortDirection { Unspecified = 0, Asc = 1, Desc = 2, } impl SortDirection { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { Self::Unspecified => "SORT_DIRECTION_UNSPECIFIED", Self::Asc => "SORT_DIRECTION_ASC", Self::Desc => "SORT_DIRECTION_DESC", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "SORT_DIRECTION_UNSPECIFIED" => Some(Self::Unspecified), "SORT_DIRECTION_ASC" => Some(Self::Asc), "SORT_DIRECTION_DESC" => Some(Self::Desc), _ => None, } } } /// Repository identity used by storage-facing RPCs. #[derive(Clone, PartialEq, ::prost::Message)] pub struct RepositoryHeader { /// Logical storage shard or disk name. #[prost(string, tag = "1")] pub storage_name: ::prost::alloc::string::String, /// Path relative to the storage root, usually ending in `.git` for bare repos. #[prost(string, tag = "2")] pub relative_path: ::prost::alloc::string::String, /// Optional absolute path for embedded/local deployments. #[prost(string, tag = "3")] pub storage_path: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct Repository { #[prost(message, optional, tag = "1")] pub header: ::core::option::Option, #[prost(bool, tag = "2")] pub bare: bool, #[prost(bool, tag = "3")] pub empty: bool, #[prost(enumeration = "ObjectFormat", tag = "4")] pub object_format: i32, #[prost(string, tag = "5")] pub default_branch: ::prost::alloc::string::String, #[prost(string, tag = "6")] pub git_object_directory: ::prost::alloc::string::String, #[prost(string, repeated, tag = "7")] pub git_alternate_object_directories: ::prost::alloc::vec::Vec< ::prost::alloc::string::String, >, } #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RepositoryStatistics { #[prost(uint64, tag = "1")] pub size_bytes: u64, #[prost(uint64, tag = "2")] pub loose_object_count: u64, #[prost(uint64, tag = "3")] pub packed_object_count: u64, #[prost(uint64, tag = "4")] pub packfile_count: u64, #[prost(uint64, tag = "5")] pub reference_count: u64, #[prost(uint64, tag = "6")] pub commit_graph_size_bytes: u64, #[prost(uint64, tag = "7")] pub multi_pack_index_size_bytes: u64, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct RepositoryConfigEntry { #[prost(string, tag = "1")] pub key: ::prost::alloc::string::String, #[prost(string, repeated, tag = "2")] pub values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct RepositoryObjectFormatRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, } #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RepositoryObjectFormatResponse { #[prost(enumeration = "ObjectFormat", tag = "1")] pub object_format: i32, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetRepositoryRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct InitRepositoryRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(bool, tag = "2")] pub bare: bool, #[prost(enumeration = "ObjectFormat", tag = "3")] pub object_format: i32, #[prost(string, tag = "4")] pub initial_branch: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeleteRepositoryRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct RepositoryExistsRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, } #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RepositoryExistsResponse { #[prost(bool, tag = "1")] pub exists: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetDefaultBranchRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetDefaultBranchResponse { #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct SetDefaultBranchRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, tag = "2")] pub name: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetRepositoryConfigRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, repeated, tag = "2")] pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetRepositoryConfigResponse { #[prost(message, repeated, tag = "1")] pub entries: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct SetRepositoryConfigRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, repeated, tag = "2")] pub entries: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct RepositoryStatisticsRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct RepositoryHealthRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(bool, tag = "2")] pub connectivity_only: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct RepositoryHealthResponse { #[prost(bool, tag = "1")] pub ok: bool, #[prost(string, repeated, tag = "2")] pub warnings: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, #[prost(string, repeated, tag = "3")] pub errors: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, #[prost(message, optional, tag = "4")] pub statistics: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GarbageCollectRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(bool, tag = "2")] pub prune: bool, #[prost(bool, tag = "3")] pub aggressive: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct RepackRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(bool, tag = "2")] pub full: bool, #[prost(bool, tag = "3")] pub write_bitmaps: bool, #[prost(bool, tag = "4")] pub write_multi_pack_index: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct WriteCommitGraphRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(bool, tag = "2")] pub replace: bool, #[prost(bool, tag = "3")] pub split: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct RepositoryMaintenanceResponse { #[prost(bool, tag = "1")] pub ok: bool, #[prost(string, tag = "2")] pub stdout: ::prost::alloc::string::String, #[prost(string, tag = "3")] pub stderr: ::prost::alloc::string::String, } /// Generated client implementations. pub mod repository_service_client { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct RepositoryServiceClient { inner: tonic::client::Grpc, } impl RepositoryServiceClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl RepositoryServiceClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + std::marker::Send + 'static, ::Error: Into + std::marker::Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> RepositoryServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + std::marker::Send + std::marker::Sync, { RepositoryServiceClient::new(InterceptedService::new(inner, interceptor)) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_decoding_message_size(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_encoding_message_size(limit); self } pub async fn get_repository( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.RepositoryService/GetRepository", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.RepositoryService", "GetRepository")); self.inner.unary(req, path, codec).await } pub async fn init_repository( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.RepositoryService/InitRepository", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.RepositoryService", "InitRepository")); self.inner.unary(req, path, codec).await } pub async fn delete_repository( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.RepositoryService/DeleteRepository", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.RepositoryService", "DeleteRepository")); self.inner.unary(req, path, codec).await } pub async fn repository_exists( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.RepositoryService/RepositoryExists", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.RepositoryService", "RepositoryExists")); self.inner.unary(req, path, codec).await } pub async fn get_object_format( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.RepositoryService/GetObjectFormat", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.RepositoryService", "GetObjectFormat")); self.inner.unary(req, path, codec).await } pub async fn get_default_branch( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.RepositoryService/GetDefaultBranch", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.RepositoryService", "GetDefaultBranch")); self.inner.unary(req, path, codec).await } pub async fn set_default_branch( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.RepositoryService/SetDefaultBranch", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.RepositoryService", "SetDefaultBranch")); self.inner.unary(req, path, codec).await } pub async fn get_repository_config( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.RepositoryService/GetRepositoryConfig", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new("gitks.RepositoryService", "GetRepositoryConfig"), ); self.inner.unary(req, path, codec).await } pub async fn set_repository_config( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.RepositoryService/SetRepositoryConfig", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new("gitks.RepositoryService", "SetRepositoryConfig"), ); self.inner.unary(req, path, codec).await } pub async fn get_repository_statistics( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.RepositoryService/GetRepositoryStatistics", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new("gitks.RepositoryService", "GetRepositoryStatistics"), ); self.inner.unary(req, path, codec).await } pub async fn check_repository_health( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.RepositoryService/CheckRepositoryHealth", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new("gitks.RepositoryService", "CheckRepositoryHealth"), ); self.inner.unary(req, path, codec).await } pub async fn garbage_collect( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.RepositoryService/GarbageCollect", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.RepositoryService", "GarbageCollect")); self.inner.unary(req, path, codec).await } pub async fn repack( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.RepositoryService/Repack", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.RepositoryService", "Repack")); self.inner.unary(req, path, codec).await } pub async fn write_commit_graph( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.RepositoryService/WriteCommitGraph", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.RepositoryService", "WriteCommitGraph")); self.inner.unary(req, path, codec).await } } } /// Generated server implementations. pub mod repository_service_server { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with RepositoryServiceServer. #[async_trait] pub trait RepositoryService: std::marker::Send + std::marker::Sync + 'static { async fn get_repository( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn init_repository( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn delete_repository( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn repository_exists( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn get_object_format( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn get_default_branch( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn set_default_branch( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn get_repository_config( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn set_repository_config( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn get_repository_statistics( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn check_repository_health( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn garbage_collect( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn repack( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn write_commit_graph( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; } #[derive(Debug)] pub struct RepositoryServiceServer { inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } impl RepositoryServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), max_decoding_message_size: None, max_encoding_message_size: None, } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.max_decoding_message_size = Some(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.max_encoding_message_size = Some(limit); self } } impl tonic::codegen::Service> for RepositoryServiceServer where T: RepositoryService, B: Body + std::marker::Send + 'static, B::Error: Into + std::marker::Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { match req.uri().path() { "/gitks.RepositoryService/GetRepository" => { #[allow(non_camel_case_types)] struct GetRepositorySvc(pub Arc); impl< T: RepositoryService, > tonic::server::UnaryService for GetRepositorySvc { type Response = super::Repository; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_repository(&inner, request) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetRepositorySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.RepositoryService/InitRepository" => { #[allow(non_camel_case_types)] struct InitRepositorySvc(pub Arc); impl< T: RepositoryService, > tonic::server::UnaryService for InitRepositorySvc { type Response = super::Repository; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::init_repository(&inner, request) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = InitRepositorySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.RepositoryService/DeleteRepository" => { #[allow(non_camel_case_types)] struct DeleteRepositorySvc(pub Arc); impl< T: RepositoryService, > tonic::server::UnaryService for DeleteRepositorySvc { type Response = (); type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::delete_repository(&inner, request) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = DeleteRepositorySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.RepositoryService/RepositoryExists" => { #[allow(non_camel_case_types)] struct RepositoryExistsSvc(pub Arc); impl< T: RepositoryService, > tonic::server::UnaryService for RepositoryExistsSvc { type Response = super::RepositoryExistsResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::repository_exists(&inner, request) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = RepositoryExistsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.RepositoryService/GetObjectFormat" => { #[allow(non_camel_case_types)] struct GetObjectFormatSvc(pub Arc); impl< T: RepositoryService, > tonic::server::UnaryService for GetObjectFormatSvc { type Response = super::RepositoryObjectFormatResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_object_format(&inner, request) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetObjectFormatSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.RepositoryService/GetDefaultBranch" => { #[allow(non_camel_case_types)] struct GetDefaultBranchSvc(pub Arc); impl< T: RepositoryService, > tonic::server::UnaryService for GetDefaultBranchSvc { type Response = super::GetDefaultBranchResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_default_branch( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetDefaultBranchSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.RepositoryService/SetDefaultBranch" => { #[allow(non_camel_case_types)] struct SetDefaultBranchSvc(pub Arc); impl< T: RepositoryService, > tonic::server::UnaryService for SetDefaultBranchSvc { type Response = (); type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::set_default_branch( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = SetDefaultBranchSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.RepositoryService/GetRepositoryConfig" => { #[allow(non_camel_case_types)] struct GetRepositoryConfigSvc(pub Arc); impl< T: RepositoryService, > tonic::server::UnaryService for GetRepositoryConfigSvc { type Response = super::GetRepositoryConfigResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_repository_config( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetRepositoryConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.RepositoryService/SetRepositoryConfig" => { #[allow(non_camel_case_types)] struct SetRepositoryConfigSvc(pub Arc); impl< T: RepositoryService, > tonic::server::UnaryService for SetRepositoryConfigSvc { type Response = (); type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::set_repository_config( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = SetRepositoryConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.RepositoryService/GetRepositoryStatistics" => { #[allow(non_camel_case_types)] struct GetRepositoryStatisticsSvc(pub Arc); impl< T: RepositoryService, > tonic::server::UnaryService for GetRepositoryStatisticsSvc { type Response = super::RepositoryStatistics; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_repository_statistics( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetRepositoryStatisticsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.RepositoryService/CheckRepositoryHealth" => { #[allow(non_camel_case_types)] struct CheckRepositoryHealthSvc(pub Arc); impl< T: RepositoryService, > tonic::server::UnaryService for CheckRepositoryHealthSvc { type Response = super::RepositoryHealthResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::check_repository_health( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = CheckRepositoryHealthSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.RepositoryService/GarbageCollect" => { #[allow(non_camel_case_types)] struct GarbageCollectSvc(pub Arc); impl< T: RepositoryService, > tonic::server::UnaryService for GarbageCollectSvc { type Response = super::RepositoryMaintenanceResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::garbage_collect(&inner, request) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GarbageCollectSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.RepositoryService/Repack" => { #[allow(non_camel_case_types)] struct RepackSvc(pub Arc); impl< T: RepositoryService, > tonic::server::UnaryService for RepackSvc { type Response = super::RepositoryMaintenanceResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::repack(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = RepackSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.RepositoryService/WriteCommitGraph" => { #[allow(non_camel_case_types)] struct WriteCommitGraphSvc(pub Arc); impl< T: RepositoryService, > tonic::server::UnaryService for WriteCommitGraphSvc { type Response = super::RepositoryMaintenanceResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::write_commit_graph( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = WriteCommitGraphSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { let mut response = http::Response::new(empty_body()); let headers = response.headers_mut(); headers .insert( tonic::Status::GRPC_STATUS, (tonic::Code::Unimplemented as i32).into(), ); headers .insert( http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE, ); Ok(response) }) } } } } impl Clone for RepositoryServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, max_decoding_message_size: self.max_decoding_message_size, max_encoding_message_size: self.max_encoding_message_size, } } } /// Generated gRPC service name pub const SERVICE_NAME: &str = "gitks.RepositoryService"; impl tonic::server::NamedService for RepositoryServiceServer { const NAME: &'static str = SERVICE_NAME; } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ArchiveOptions { #[prost(enumeration = "archive_options::Format", tag = "1")] pub format: i32, #[prost(string, tag = "2")] pub prefix: ::prost::alloc::string::String, #[prost(string, repeated, tag = "3")] pub pathspec: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, #[prost(int32, tag = "4")] pub compression_level: i32, #[prost(bool, tag = "5")] pub include_global_extended_pax_headers: bool, } /// Nested message and enum types in `ArchiveOptions`. pub mod archive_options { #[derive( Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration )] #[repr(i32)] pub enum Format { ArchiveFormatUnspecified = 0, ArchiveFormatTar = 1, ArchiveFormatTarGz = 2, ArchiveFormatTarBz2 = 3, ArchiveFormatTarXz = 4, ArchiveFormatZip = 5, } impl Format { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { Self::ArchiveFormatUnspecified => "ARCHIVE_FORMAT_UNSPECIFIED", Self::ArchiveFormatTar => "ARCHIVE_FORMAT_TAR", Self::ArchiveFormatTarGz => "ARCHIVE_FORMAT_TAR_GZ", Self::ArchiveFormatTarBz2 => "ARCHIVE_FORMAT_TAR_BZ2", Self::ArchiveFormatTarXz => "ARCHIVE_FORMAT_TAR_XZ", Self::ArchiveFormatZip => "ARCHIVE_FORMAT_ZIP", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "ARCHIVE_FORMAT_UNSPECIFIED" => Some(Self::ArchiveFormatUnspecified), "ARCHIVE_FORMAT_TAR" => Some(Self::ArchiveFormatTar), "ARCHIVE_FORMAT_TAR_GZ" => Some(Self::ArchiveFormatTarGz), "ARCHIVE_FORMAT_TAR_BZ2" => Some(Self::ArchiveFormatTarBz2), "ARCHIVE_FORMAT_TAR_XZ" => Some(Self::ArchiveFormatTarXz), "ARCHIVE_FORMAT_ZIP" => Some(Self::ArchiveFormatZip), _ => None, } } } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ArchiveRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub treeish: ::core::option::Option, #[prost(message, optional, tag = "3")] pub options: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ArchiveChunk { #[prost(bytes = "vec", tag = "1")] pub data: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ArchiveEntry { #[prost(string, tag = "1")] pub path: ::prost::alloc::string::String, #[prost(message, optional, tag = "2")] pub oid: ::core::option::Option, #[prost(uint32, tag = "3")] pub mode: u32, #[prost(int64, tag = "4")] pub size: i64, #[prost(enumeration = "ObjectType", tag = "5")] pub r#type: i32, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListArchiveEntriesRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub treeish: ::core::option::Option, #[prost(string, repeated, tag = "3")] pub pathspec: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, #[prost(message, optional, tag = "4")] pub pagination: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListArchiveEntriesResponse { #[prost(message, repeated, tag = "1")] pub entries: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "2")] pub page_info: ::core::option::Option, } /// Generated client implementations. pub mod archive_service_client { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct ArchiveServiceClient { inner: tonic::client::Grpc, } impl ArchiveServiceClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl ArchiveServiceClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + std::marker::Send + 'static, ::Error: Into + std::marker::Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> ArchiveServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + std::marker::Send + std::marker::Sync, { ArchiveServiceClient::new(InterceptedService::new(inner, interceptor)) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_decoding_message_size(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_encoding_message_size(limit); self } pub async fn get_archive( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.ArchiveService/GetArchive", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.ArchiveService", "GetArchive")); self.inner.server_streaming(req, path, codec).await } pub async fn list_archive_entries( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.ArchiveService/ListArchiveEntries", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.ArchiveService", "ListArchiveEntries")); self.inner.unary(req, path, codec).await } } } /// Generated server implementations. pub mod archive_service_server { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with ArchiveServiceServer. #[async_trait] pub trait ArchiveService: std::marker::Send + std::marker::Sync + 'static { /// Server streaming response type for the GetArchive method. type GetArchiveStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, > + std::marker::Send + 'static; async fn get_archive( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn list_archive_entries( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; } #[derive(Debug)] pub struct ArchiveServiceServer { inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } impl ArchiveServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), max_decoding_message_size: None, max_encoding_message_size: None, } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.max_decoding_message_size = Some(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.max_encoding_message_size = Some(limit); self } } impl tonic::codegen::Service> for ArchiveServiceServer where T: ArchiveService, B: Body + std::marker::Send + 'static, B::Error: Into + std::marker::Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { match req.uri().path() { "/gitks.ArchiveService/GetArchive" => { #[allow(non_camel_case_types)] struct GetArchiveSvc(pub Arc); impl< T: ArchiveService, > tonic::server::ServerStreamingService for GetArchiveSvc { type Response = super::ArchiveChunk; type ResponseStream = T::GetArchiveStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_archive(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetArchiveSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.server_streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.ArchiveService/ListArchiveEntries" => { #[allow(non_camel_case_types)] struct ListArchiveEntriesSvc(pub Arc); impl< T: ArchiveService, > tonic::server::UnaryService for ListArchiveEntriesSvc { type Response = super::ListArchiveEntriesResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::list_archive_entries(&inner, request) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = ListArchiveEntriesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { let mut response = http::Response::new(empty_body()); let headers = response.headers_mut(); headers .insert( tonic::Status::GRPC_STATUS, (tonic::Code::Unimplemented as i32).into(), ); headers .insert( http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE, ); Ok(response) }) } } } } impl Clone for ArchiveServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, max_decoding_message_size: self.max_decoding_message_size, max_encoding_message_size: self.max_encoding_message_size, } } } /// Generated gRPC service name pub const SERVICE_NAME: &str = "gitks.ArchiveService"; impl tonic::server::NamedService for ArchiveServiceServer { const NAME: &'static str = SERVICE_NAME; } } /// Git identity attached to commits and tags. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Identity { #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub email: ::prost::alloc::string::String, } /// Git signature with timestamp and timezone offset. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Signature { #[prost(message, optional, tag = "1")] pub identity: ::core::option::Option, #[prost(message, optional, tag = "2")] pub when: ::core::option::Option<::prost_types::Timestamp>, /// Offset in minutes east of UTC, as stored by git. #[prost(int32, tag = "3")] pub timezone_offset: i32, } /// Backward-compatible payload name used by earlier Rust structs. #[derive(Clone, PartialEq, ::prost::Message)] pub struct PayloadTagger { #[prost(string, tag = "1")] pub email: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub name: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct VerifiedSignature { #[prost(bool, tag = "1")] pub verified: bool, #[prost(enumeration = "verified_signature::Reason", tag = "2")] pub reason: i32, #[prost(string, tag = "3")] pub signature: ::prost::alloc::string::String, #[prost(string, tag = "4")] pub payload: ::prost::alloc::string::String, #[prost(string, tag = "5")] pub key_fingerprint: ::prost::alloc::string::String, #[prost(string, tag = "6")] pub signer: ::prost::alloc::string::String, } /// Nested message and enum types in `VerifiedSignature`. pub mod verified_signature { #[derive( Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration )] #[repr(i32)] pub enum Reason { Unspecified = 0, Valid = 1, ExpiredKey = 2, NotSigningKey = 3, GpgverifyError = 4, GpgverifyUnavailable = 5, Unsigned = 6, UnknownSignatureType = 7, NoUser = 8, UnverifiedEmail = 9, BadEmail = 10, UnknownKey = 11, MalformedSignature = 12, Invalid = 13, } impl Reason { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { Self::Unspecified => "REASON_UNSPECIFIED", Self::Valid => "REASON_VALID", Self::ExpiredKey => "REASON_EXPIRED_KEY", Self::NotSigningKey => "REASON_NOT_SIGNING_KEY", Self::GpgverifyError => "REASON_GPGVERIFY_ERROR", Self::GpgverifyUnavailable => "REASON_GPGVERIFY_UNAVAILABLE", Self::Unsigned => "REASON_UNSIGNED", Self::UnknownSignatureType => "REASON_UNKNOWN_SIGNATURE_TYPE", Self::NoUser => "REASON_NO_USER", Self::UnverifiedEmail => "REASON_UNVERIFIED_EMAIL", Self::BadEmail => "REASON_BAD_EMAIL", Self::UnknownKey => "REASON_UNKNOWN_KEY", Self::MalformedSignature => "REASON_MALFORMED_SIGNATURE", Self::Invalid => "REASON_INVALID", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "REASON_UNSPECIFIED" => Some(Self::Unspecified), "REASON_VALID" => Some(Self::Valid), "REASON_EXPIRED_KEY" => Some(Self::ExpiredKey), "REASON_NOT_SIGNING_KEY" => Some(Self::NotSigningKey), "REASON_GPGVERIFY_ERROR" => Some(Self::GpgverifyError), "REASON_GPGVERIFY_UNAVAILABLE" => Some(Self::GpgverifyUnavailable), "REASON_UNSIGNED" => Some(Self::Unsigned), "REASON_UNKNOWN_SIGNATURE_TYPE" => Some(Self::UnknownSignatureType), "REASON_NO_USER" => Some(Self::NoUser), "REASON_UNVERIFIED_EMAIL" => Some(Self::UnverifiedEmail), "REASON_BAD_EMAIL" => Some(Self::BadEmail), "REASON_UNKNOWN_KEY" => Some(Self::UnknownKey), "REASON_MALFORMED_SIGNATURE" => Some(Self::MalformedSignature), "REASON_INVALID" => Some(Self::Invalid), _ => None, } } } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct PayloadCommit { #[prost(message, optional, tag = "1")] pub author: ::core::option::Option, #[prost(message, optional, tag = "2")] pub committer: ::core::option::Option, #[prost(message, optional, tag = "3")] pub oid: ::core::option::Option, #[prost(string, tag = "4")] pub message: ::prost::alloc::string::String, #[prost(message, repeated, tag = "5")] pub parents: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "6")] pub tree: ::core::option::Option, #[prost(message, optional, tag = "7")] pub timestamp: ::core::option::Option<::prost_types::Timestamp>, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct CommitTrailer { #[prost(string, tag = "1")] pub key: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub value: ::prost::alloc::string::String, #[prost(bool, tag = "3")] pub separator_present: bool, } #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct CommitStats { #[prost(uint32, tag = "1")] pub additions: u32, #[prost(uint32, tag = "2")] pub deletions: u32, #[prost(uint32, tag = "3")] pub changed_files: u32, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct Commit { #[prost(message, optional, tag = "1")] pub oid: ::core::option::Option, #[prost(string, tag = "2")] pub abbreviated_oid: ::prost::alloc::string::String, #[prost(message, repeated, tag = "3")] pub parent_oids: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "4")] pub tree_oid: ::core::option::Option, #[prost(message, optional, tag = "5")] pub author: ::core::option::Option, #[prost(message, optional, tag = "6")] pub committer: ::core::option::Option, #[prost(string, tag = "7")] pub subject: ::prost::alloc::string::String, #[prost(string, tag = "8")] pub body: ::prost::alloc::string::String, #[prost(string, tag = "9")] pub message: ::prost::alloc::string::String, #[prost(message, repeated, tag = "10")] pub trailers: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "11")] pub signature: ::core::option::Option, #[prost(message, optional, tag = "12")] pub stats: ::core::option::Option, #[prost(message, optional, tag = "13")] pub authored_at: ::core::option::Option<::prost_types::Timestamp>, #[prost(message, optional, tag = "14")] pub committed_at: ::core::option::Option<::prost_types::Timestamp>, #[prost(bytes = "vec", tag = "15")] pub raw: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListCommitsRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub revision: ::core::option::Option, #[prost(string, tag = "3")] pub path: ::prost::alloc::string::String, #[prost(message, optional, tag = "4")] pub since: ::core::option::Option<::prost_types::Timestamp>, #[prost(message, optional, tag = "5")] pub until: ::core::option::Option<::prost_types::Timestamp>, #[prost(bool, tag = "6")] pub first_parent: bool, #[prost(bool, tag = "7")] pub all: bool, #[prost(bool, tag = "8")] pub reverse: bool, #[prost(uint32, tag = "9")] pub max_parents: u32, #[prost(uint32, tag = "10")] pub min_parents: u32, #[prost(message, optional, tag = "11")] pub pagination: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListCommitsResponse { #[prost(message, repeated, tag = "1")] pub commits: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "2")] pub page_info: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetCommitRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub revision: ::core::option::Option, #[prost(bool, tag = "3")] pub include_stats: bool, #[prost(bool, tag = "4")] pub include_raw: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetCommitAncestorsRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub revision: ::core::option::Option, #[prost(bool, tag = "3")] pub first_parent: bool, #[prost(message, optional, tag = "4")] pub pagination: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetCommitAncestorsResponse { #[prost(message, repeated, tag = "1")] pub commits: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "2")] pub page_info: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct CreateCommitAction { #[prost(enumeration = "create_commit_action::Action", tag = "1")] pub action: i32, #[prost(string, tag = "2")] pub file_path: ::prost::alloc::string::String, #[prost(string, tag = "3")] pub previous_path: ::prost::alloc::string::String, #[prost(bytes = "vec", tag = "4")] pub content: ::prost::alloc::vec::Vec, #[prost(string, tag = "5")] pub encoding: ::prost::alloc::string::String, #[prost(bool, tag = "6")] pub executable: bool, #[prost(message, optional, tag = "7")] pub last_commit_oid: ::core::option::Option, } /// Nested message and enum types in `CreateCommitAction`. pub mod create_commit_action { #[derive( Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration )] #[repr(i32)] pub enum Action { CreateCommitActionUnspecified = 0, CreateCommitActionCreate = 1, CreateCommitActionUpdate = 2, CreateCommitActionDelete = 3, CreateCommitActionMove = 4, CreateCommitActionChmod = 5, } impl Action { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { Self::CreateCommitActionUnspecified => "CREATE_COMMIT_ACTION_UNSPECIFIED", Self::CreateCommitActionCreate => "CREATE_COMMIT_ACTION_CREATE", Self::CreateCommitActionUpdate => "CREATE_COMMIT_ACTION_UPDATE", Self::CreateCommitActionDelete => "CREATE_COMMIT_ACTION_DELETE", Self::CreateCommitActionMove => "CREATE_COMMIT_ACTION_MOVE", Self::CreateCommitActionChmod => "CREATE_COMMIT_ACTION_CHMOD", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "CREATE_COMMIT_ACTION_UNSPECIFIED" => { Some(Self::CreateCommitActionUnspecified) } "CREATE_COMMIT_ACTION_CREATE" => Some(Self::CreateCommitActionCreate), "CREATE_COMMIT_ACTION_UPDATE" => Some(Self::CreateCommitActionUpdate), "CREATE_COMMIT_ACTION_DELETE" => Some(Self::CreateCommitActionDelete), "CREATE_COMMIT_ACTION_MOVE" => Some(Self::CreateCommitActionMove), "CREATE_COMMIT_ACTION_CHMOD" => Some(Self::CreateCommitActionChmod), _ => None, } } } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct CreateCommitRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, tag = "2")] pub branch: ::prost::alloc::string::String, #[prost(string, tag = "3")] pub message: ::prost::alloc::string::String, #[prost(message, optional, tag = "4")] pub author: ::core::option::Option, #[prost(message, optional, tag = "5")] pub committer: ::core::option::Option, #[prost(message, repeated, tag = "6")] pub actions: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "7")] pub start_revision: ::core::option::Option, #[prost(bool, tag = "8")] pub force: bool, #[prost(message, repeated, tag = "9")] pub trailers: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct CreateCommitResponse { #[prost(message, optional, tag = "1")] pub commit: ::core::option::Option, #[prost(string, tag = "2")] pub branch: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct RevertCommitRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub commit: ::core::option::Option, #[prost(string, tag = "3")] pub branch: ::prost::alloc::string::String, #[prost(message, optional, tag = "4")] pub committer: ::core::option::Option, #[prost(string, tag = "5")] pub message: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct CherryPickCommitRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub commit: ::core::option::Option, #[prost(string, tag = "3")] pub branch: ::prost::alloc::string::String, #[prost(message, optional, tag = "4")] pub committer: ::core::option::Option, #[prost(string, tag = "5")] pub message: ::prost::alloc::string::String, #[prost(uint32, tag = "6")] pub mainline: u32, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct CompareCommitsRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub base: ::core::option::Option, #[prost(message, optional, tag = "3")] pub head: ::core::option::Option, #[prost(bool, tag = "4")] pub straight: bool, #[prost(bool, tag = "5")] pub first_parent: bool, #[prost(message, optional, tag = "6")] pub pagination: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct CompareCommitsResponse { #[prost(message, repeated, tag = "1")] pub commits: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "2")] pub stats: ::core::option::Option, #[prost(message, optional, tag = "3")] pub page_info: ::core::option::Option, #[prost(message, optional, tag = "4")] pub merge_base: ::core::option::Option, } /// Generated client implementations. pub mod commit_service_client { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct CommitServiceClient { inner: tonic::client::Grpc, } impl CommitServiceClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl CommitServiceClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + std::marker::Send + 'static, ::Error: Into + std::marker::Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> CommitServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + std::marker::Send + std::marker::Sync, { CommitServiceClient::new(InterceptedService::new(inner, interceptor)) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_decoding_message_size(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_encoding_message_size(limit); self } pub async fn list_commits( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.CommitService/ListCommits", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.CommitService", "ListCommits")); self.inner.unary(req, path, codec).await } pub async fn get_commit( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.CommitService/GetCommit", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.CommitService", "GetCommit")); self.inner.unary(req, path, codec).await } pub async fn get_commit_ancestors( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.CommitService/GetCommitAncestors", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.CommitService", "GetCommitAncestors")); self.inner.unary(req, path, codec).await } pub async fn create_commit( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.CommitService/CreateCommit", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.CommitService", "CreateCommit")); self.inner.unary(req, path, codec).await } pub async fn revert_commit( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.CommitService/RevertCommit", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.CommitService", "RevertCommit")); self.inner.unary(req, path, codec).await } pub async fn cherry_pick_commit( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.CommitService/CherryPickCommit", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.CommitService", "CherryPickCommit")); self.inner.unary(req, path, codec).await } pub async fn compare_commits( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.CommitService/CompareCommits", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.CommitService", "CompareCommits")); self.inner.unary(req, path, codec).await } } } /// Generated server implementations. pub mod commit_service_server { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with CommitServiceServer. #[async_trait] pub trait CommitService: std::marker::Send + std::marker::Sync + 'static { async fn list_commits( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn get_commit( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn get_commit_ancestors( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn create_commit( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn revert_commit( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn cherry_pick_commit( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn compare_commits( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; } #[derive(Debug)] pub struct CommitServiceServer { inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } impl CommitServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), max_decoding_message_size: None, max_encoding_message_size: None, } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.max_decoding_message_size = Some(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.max_encoding_message_size = Some(limit); self } } impl tonic::codegen::Service> for CommitServiceServer where T: CommitService, B: Body + std::marker::Send + 'static, B::Error: Into + std::marker::Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { match req.uri().path() { "/gitks.CommitService/ListCommits" => { #[allow(non_camel_case_types)] struct ListCommitsSvc(pub Arc); impl< T: CommitService, > tonic::server::UnaryService for ListCommitsSvc { type Response = super::ListCommitsResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::list_commits(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = ListCommitsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.CommitService/GetCommit" => { #[allow(non_camel_case_types)] struct GetCommitSvc(pub Arc); impl< T: CommitService, > tonic::server::UnaryService for GetCommitSvc { type Response = super::Commit; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_commit(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetCommitSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.CommitService/GetCommitAncestors" => { #[allow(non_camel_case_types)] struct GetCommitAncestorsSvc(pub Arc); impl< T: CommitService, > tonic::server::UnaryService for GetCommitAncestorsSvc { type Response = super::GetCommitAncestorsResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_commit_ancestors(&inner, request) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetCommitAncestorsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.CommitService/CreateCommit" => { #[allow(non_camel_case_types)] struct CreateCommitSvc(pub Arc); impl< T: CommitService, > tonic::server::UnaryService for CreateCommitSvc { type Response = super::CreateCommitResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::create_commit(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = CreateCommitSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.CommitService/RevertCommit" => { #[allow(non_camel_case_types)] struct RevertCommitSvc(pub Arc); impl< T: CommitService, > tonic::server::UnaryService for RevertCommitSvc { type Response = super::CreateCommitResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::revert_commit(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = RevertCommitSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.CommitService/CherryPickCommit" => { #[allow(non_camel_case_types)] struct CherryPickCommitSvc(pub Arc); impl< T: CommitService, > tonic::server::UnaryService for CherryPickCommitSvc { type Response = super::CreateCommitResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::cherry_pick_commit(&inner, request) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = CherryPickCommitSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.CommitService/CompareCommits" => { #[allow(non_camel_case_types)] struct CompareCommitsSvc(pub Arc); impl< T: CommitService, > tonic::server::UnaryService for CompareCommitsSvc { type Response = super::CompareCommitsResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::compare_commits(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = CompareCommitsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { let mut response = http::Response::new(empty_body()); let headers = response.headers_mut(); headers .insert( tonic::Status::GRPC_STATUS, (tonic::Code::Unimplemented as i32).into(), ); headers .insert( http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE, ); Ok(response) }) } } } } impl Clone for CommitServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, max_decoding_message_size: self.max_decoding_message_size, max_encoding_message_size: self.max_encoding_message_size, } } } /// Generated gRPC service name pub const SERVICE_NAME: &str = "gitks.CommitService"; impl tonic::server::NamedService for CommitServiceServer { const NAME: &'static str = SERVICE_NAME; } } #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct LineRange { #[prost(uint32, tag = "1")] pub start: u32, #[prost(uint32, tag = "2")] pub end: u32, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlameOptions { #[prost(bool, tag = "1")] pub detect_move: bool, #[prost(bool, tag = "2")] pub detect_copy: bool, #[prost(uint32, tag = "3")] pub score: u32, #[prost(string, repeated, tag = "4")] pub ignore_revisions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlameRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub revision: ::core::option::Option, #[prost(string, tag = "3")] pub path: ::prost::alloc::string::String, #[prost(message, optional, tag = "4")] pub range: ::core::option::Option, #[prost(message, optional, tag = "5")] pub options: ::core::option::Option, #[prost(message, optional, tag = "6")] pub pagination: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlameLine { #[prost(uint32, tag = "1")] pub final_line: u32, #[prost(uint32, tag = "2")] pub original_line: u32, #[prost(bytes = "vec", tag = "3")] pub content: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlameHunk { #[prost(message, optional, tag = "1")] pub commit: ::core::option::Option, #[prost(string, tag = "2")] pub original_path: ::prost::alloc::string::String, #[prost(string, tag = "3")] pub final_path: ::prost::alloc::string::String, #[prost(uint32, tag = "4")] pub original_start_line: u32, #[prost(uint32, tag = "5")] pub final_start_line: u32, #[prost(uint32, tag = "6")] pub line_count: u32, #[prost(bool, tag = "7")] pub boundary: bool, #[prost(message, repeated, tag = "8")] pub lines: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlameResponse { #[prost(message, repeated, tag = "1")] pub hunks: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "2")] pub page_info: ::core::option::Option, #[prost(bool, tag = "3")] pub truncated: bool, } /// Generated client implementations. pub mod blame_service_client { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct BlameServiceClient { inner: tonic::client::Grpc, } impl BlameServiceClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl BlameServiceClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + std::marker::Send + 'static, ::Error: Into + std::marker::Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> BlameServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + std::marker::Send + std::marker::Sync, { BlameServiceClient::new(InterceptedService::new(inner, interceptor)) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_decoding_message_size(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_encoding_message_size(limit); self } pub async fn blame( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static("/gitks.BlameService/Blame"); let mut req = request.into_request(); req.extensions_mut().insert(GrpcMethod::new("gitks.BlameService", "Blame")); self.inner.unary(req, path, codec).await } pub async fn stream_blame( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.BlameService/StreamBlame", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.BlameService", "StreamBlame")); self.inner.server_streaming(req, path, codec).await } } } /// Generated server implementations. pub mod blame_service_server { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with BlameServiceServer. #[async_trait] pub trait BlameService: std::marker::Send + std::marker::Sync + 'static { async fn blame( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the StreamBlame method. type StreamBlameStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, > + std::marker::Send + 'static; async fn stream_blame( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; } #[derive(Debug)] pub struct BlameServiceServer { inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } impl BlameServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), max_decoding_message_size: None, max_encoding_message_size: None, } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.max_decoding_message_size = Some(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.max_encoding_message_size = Some(limit); self } } impl tonic::codegen::Service> for BlameServiceServer where T: BlameService, B: Body + std::marker::Send + 'static, B::Error: Into + std::marker::Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { match req.uri().path() { "/gitks.BlameService/Blame" => { #[allow(non_camel_case_types)] struct BlameSvc(pub Arc); impl< T: BlameService, > tonic::server::UnaryService for BlameSvc { type Response = super::BlameResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::blame(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = BlameSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.BlameService/StreamBlame" => { #[allow(non_camel_case_types)] struct StreamBlameSvc(pub Arc); impl< T: BlameService, > tonic::server::ServerStreamingService for StreamBlameSvc { type Response = super::BlameHunk; type ResponseStream = T::StreamBlameStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::stream_blame(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = StreamBlameSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.server_streaming(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { let mut response = http::Response::new(empty_body()); let headers = response.headers_mut(); headers .insert( tonic::Status::GRPC_STATUS, (tonic::Code::Unimplemented as i32).into(), ); headers .insert( http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE, ); Ok(response) }) } } } } impl Clone for BlameServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, max_decoding_message_size: self.max_decoding_message_size, max_encoding_message_size: self.max_encoding_message_size, } } } /// Generated gRPC service name pub const SERVICE_NAME: &str = "gitks.BlameService"; impl tonic::server::NamedService for BlameServiceServer { const NAME: &'static str = SERVICE_NAME; } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct BranchUpstream { #[prost(string, tag = "1")] pub remote_name: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub remote_url: ::prost::alloc::string::String, #[prost(string, tag = "3")] pub remote_branch_name: ::prost::alloc::string::String, #[prost(string, tag = "4")] pub local_branch_name: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct Branch { #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub full_ref: ::prost::alloc::string::String, #[prost(message, optional, tag = "3")] pub target_oid: ::core::option::Option, #[prost(message, optional, tag = "4")] pub commit: ::core::option::Option, #[prost(message, optional, tag = "5")] pub upstream: ::core::option::Option, #[prost(bool, tag = "6")] pub is_default: bool, #[prost(bool, tag = "7")] pub is_head: bool, #[prost(bool, tag = "8")] pub is_merged: bool, #[prost(bool, tag = "9")] pub is_detached: bool, } /// Backward-compatible payload name used by earlier clients. #[derive(Clone, PartialEq, ::prost::Message)] pub struct PayloadBranch { #[prost(message, optional, tag = "1")] pub commit: ::core::option::Option, #[prost(string, tag = "2")] pub name: ::prost::alloc::string::String, #[prost(message, optional, tag = "3")] pub upstream: ::core::option::Option, #[prost(bool, tag = "4")] pub is_head: bool, } #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestBranchInit {} #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListBranchesRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, tag = "2")] pub pattern: ::prost::alloc::string::String, #[prost(bool, tag = "3")] pub merged_into_head: bool, #[prost(bool, tag = "4")] pub not_merged_into_head: bool, #[prost(message, optional, tag = "5")] pub pagination: ::core::option::Option, #[prost(enumeration = "SortDirection", tag = "6")] pub sort_direction: i32, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListBranchesResponse { #[prost(message, repeated, tag = "1")] pub branches: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "2")] pub page_info: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetBranchRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, tag = "2")] pub name: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct CreateBranchRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, tag = "2")] pub name: ::prost::alloc::string::String, #[prost(message, optional, tag = "3")] pub start_point: ::core::option::Option, #[prost(bool, tag = "4")] pub force: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeleteBranchRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, tag = "2")] pub name: ::prost::alloc::string::String, #[prost(bool, tag = "3")] pub force: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct RenameBranchRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, tag = "2")] pub old_name: ::prost::alloc::string::String, #[prost(string, tag = "3")] pub new_name: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct UpdateBranchTargetRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, tag = "2")] pub name: ::prost::alloc::string::String, #[prost(message, optional, tag = "3")] pub expected_old_oid: ::core::option::Option, #[prost(message, optional, tag = "4")] pub new_oid: ::core::option::Option, #[prost(bool, tag = "5")] pub force: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct SetBranchUpstreamRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, tag = "2")] pub name: ::prost::alloc::string::String, #[prost(message, optional, tag = "3")] pub upstream: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct CompareBranchRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, tag = "2")] pub source_branch: ::prost::alloc::string::String, #[prost(string, tag = "3")] pub target_branch: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct CompareBranchResponse { #[prost(bool, tag = "1")] pub ahead: bool, #[prost(bool, tag = "2")] pub behind: bool, #[prost(uint32, tag = "3")] pub ahead_by: u32, #[prost(uint32, tag = "4")] pub behind_by: u32, #[prost(message, optional, tag = "5")] pub merge_base: ::core::option::Option, } /// Generated client implementations. pub mod branch_service_client { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct BranchServiceClient { inner: tonic::client::Grpc, } impl BranchServiceClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl BranchServiceClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + std::marker::Send + 'static, ::Error: Into + std::marker::Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> BranchServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + std::marker::Send + std::marker::Sync, { BranchServiceClient::new(InterceptedService::new(inner, interceptor)) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_decoding_message_size(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_encoding_message_size(limit); self } pub async fn list_branches( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.BranchService/ListBranches", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.BranchService", "ListBranches")); self.inner.unary(req, path, codec).await } pub async fn get_branch( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.BranchService/GetBranch", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.BranchService", "GetBranch")); self.inner.unary(req, path, codec).await } pub async fn create_branch( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.BranchService/CreateBranch", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.BranchService", "CreateBranch")); self.inner.unary(req, path, codec).await } pub async fn delete_branch( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.BranchService/DeleteBranch", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.BranchService", "DeleteBranch")); self.inner.unary(req, path, codec).await } pub async fn rename_branch( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.BranchService/RenameBranch", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.BranchService", "RenameBranch")); self.inner.unary(req, path, codec).await } pub async fn update_branch_target( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.BranchService/UpdateBranchTarget", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.BranchService", "UpdateBranchTarget")); self.inner.unary(req, path, codec).await } pub async fn set_branch_upstream( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.BranchService/SetBranchUpstream", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.BranchService", "SetBranchUpstream")); self.inner.unary(req, path, codec).await } pub async fn compare_branch( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.BranchService/CompareBranch", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.BranchService", "CompareBranch")); self.inner.unary(req, path, codec).await } } } /// Generated server implementations. pub mod branch_service_server { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with BranchServiceServer. #[async_trait] pub trait BranchService: std::marker::Send + std::marker::Sync + 'static { async fn list_branches( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn get_branch( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn create_branch( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn delete_branch( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn rename_branch( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn update_branch_target( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn set_branch_upstream( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn compare_branch( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; } #[derive(Debug)] pub struct BranchServiceServer { inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } impl BranchServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), max_decoding_message_size: None, max_encoding_message_size: None, } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.max_decoding_message_size = Some(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.max_encoding_message_size = Some(limit); self } } impl tonic::codegen::Service> for BranchServiceServer where T: BranchService, B: Body + std::marker::Send + 'static, B::Error: Into + std::marker::Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { match req.uri().path() { "/gitks.BranchService/ListBranches" => { #[allow(non_camel_case_types)] struct ListBranchesSvc(pub Arc); impl< T: BranchService, > tonic::server::UnaryService for ListBranchesSvc { type Response = super::ListBranchesResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::list_branches(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = ListBranchesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.BranchService/GetBranch" => { #[allow(non_camel_case_types)] struct GetBranchSvc(pub Arc); impl< T: BranchService, > tonic::server::UnaryService for GetBranchSvc { type Response = super::Branch; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_branch(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetBranchSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.BranchService/CreateBranch" => { #[allow(non_camel_case_types)] struct CreateBranchSvc(pub Arc); impl< T: BranchService, > tonic::server::UnaryService for CreateBranchSvc { type Response = super::Branch; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::create_branch(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = CreateBranchSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.BranchService/DeleteBranch" => { #[allow(non_camel_case_types)] struct DeleteBranchSvc(pub Arc); impl< T: BranchService, > tonic::server::UnaryService for DeleteBranchSvc { type Response = (); type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::delete_branch(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = DeleteBranchSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.BranchService/RenameBranch" => { #[allow(non_camel_case_types)] struct RenameBranchSvc(pub Arc); impl< T: BranchService, > tonic::server::UnaryService for RenameBranchSvc { type Response = super::Branch; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::rename_branch(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = RenameBranchSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.BranchService/UpdateBranchTarget" => { #[allow(non_camel_case_types)] struct UpdateBranchTargetSvc(pub Arc); impl< T: BranchService, > tonic::server::UnaryService for UpdateBranchTargetSvc { type Response = super::Branch; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::update_branch_target(&inner, request) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = UpdateBranchTargetSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.BranchService/SetBranchUpstream" => { #[allow(non_camel_case_types)] struct SetBranchUpstreamSvc(pub Arc); impl< T: BranchService, > tonic::server::UnaryService for SetBranchUpstreamSvc { type Response = super::Branch; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::set_branch_upstream(&inner, request) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = SetBranchUpstreamSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.BranchService/CompareBranch" => { #[allow(non_camel_case_types)] struct CompareBranchSvc(pub Arc); impl< T: BranchService, > tonic::server::UnaryService for CompareBranchSvc { type Response = super::CompareBranchResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::compare_branch(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = CompareBranchSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { let mut response = http::Response::new(empty_body()); let headers = response.headers_mut(); headers .insert( tonic::Status::GRPC_STATUS, (tonic::Code::Unimplemented as i32).into(), ); headers .insert( http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE, ); Ok(response) }) } } } } impl Clone for BranchServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, max_decoding_message_size: self.max_decoding_message_size, max_encoding_message_size: self.max_encoding_message_size, } } } /// Generated gRPC service name pub const SERVICE_NAME: &str = "gitks.BranchService"; impl tonic::server::NamedService for BranchServiceServer { const NAME: &'static str = SERVICE_NAME; } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct DiffOptions { #[prost(bool, tag = "1")] pub recursive: bool, #[prost(bool, tag = "2")] pub include_binary: bool, #[prost(bool, tag = "3")] pub include_patch: bool, #[prost(bool, tag = "4")] pub rename_detection: bool, #[prost(bool, tag = "5")] pub copy_detection: bool, #[prost(uint32, tag = "6")] pub context_lines: u32, #[prost(string, repeated, tag = "7")] pub pathspec: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, #[prost(enumeration = "diff_options::WhitespaceMode", tag = "8")] pub whitespace_mode: i32, #[prost(uint64, tag = "9")] pub max_files: u64, #[prost(uint64, tag = "10")] pub max_bytes: u64, } /// Nested message and enum types in `DiffOptions`. pub mod diff_options { #[derive( Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration )] #[repr(i32)] pub enum WhitespaceMode { DiffWhitespaceModeUnspecified = 0, DiffWhitespaceModeDefault = 1, DiffWhitespaceModeIgnoreAll = 2, DiffWhitespaceModeIgnoreChange = 3, DiffWhitespaceModeIgnoreEol = 4, } impl WhitespaceMode { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { Self::DiffWhitespaceModeUnspecified => "DIFF_WHITESPACE_MODE_UNSPECIFIED", Self::DiffWhitespaceModeDefault => "DIFF_WHITESPACE_MODE_DEFAULT", Self::DiffWhitespaceModeIgnoreAll => "DIFF_WHITESPACE_MODE_IGNORE_ALL", Self::DiffWhitespaceModeIgnoreChange => { "DIFF_WHITESPACE_MODE_IGNORE_CHANGE" } Self::DiffWhitespaceModeIgnoreEol => "DIFF_WHITESPACE_MODE_IGNORE_EOL", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "DIFF_WHITESPACE_MODE_UNSPECIFIED" => { Some(Self::DiffWhitespaceModeUnspecified) } "DIFF_WHITESPACE_MODE_DEFAULT" => Some(Self::DiffWhitespaceModeDefault), "DIFF_WHITESPACE_MODE_IGNORE_ALL" => { Some(Self::DiffWhitespaceModeIgnoreAll) } "DIFF_WHITESPACE_MODE_IGNORE_CHANGE" => { Some(Self::DiffWhitespaceModeIgnoreChange) } "DIFF_WHITESPACE_MODE_IGNORE_EOL" => { Some(Self::DiffWhitespaceModeIgnoreEol) } _ => None, } } } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct DiffLine { #[prost(enumeration = "diff_line::LineType", tag = "1")] pub r#type: i32, #[prost(int32, tag = "2")] pub old_line: i32, #[prost(int32, tag = "3")] pub new_line: i32, #[prost(bytes = "vec", tag = "4")] pub content: ::prost::alloc::vec::Vec, #[prost(bool, tag = "5")] pub truncated: bool, } /// Nested message and enum types in `DiffLine`. pub mod diff_line { #[derive( Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration )] #[repr(i32)] pub enum LineType { DiffLineTypeUnspecified = 0, DiffLineTypeContext = 1, DiffLineTypeAdded = 2, DiffLineTypeDeleted = 3, DiffLineTypeHunkHeader = 4, DiffLineTypeNoNewline = 5, } impl LineType { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { Self::DiffLineTypeUnspecified => "DIFF_LINE_TYPE_UNSPECIFIED", Self::DiffLineTypeContext => "DIFF_LINE_TYPE_CONTEXT", Self::DiffLineTypeAdded => "DIFF_LINE_TYPE_ADDED", Self::DiffLineTypeDeleted => "DIFF_LINE_TYPE_DELETED", Self::DiffLineTypeHunkHeader => "DIFF_LINE_TYPE_HUNK_HEADER", Self::DiffLineTypeNoNewline => "DIFF_LINE_TYPE_NO_NEWLINE", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "DIFF_LINE_TYPE_UNSPECIFIED" => Some(Self::DiffLineTypeUnspecified), "DIFF_LINE_TYPE_CONTEXT" => Some(Self::DiffLineTypeContext), "DIFF_LINE_TYPE_ADDED" => Some(Self::DiffLineTypeAdded), "DIFF_LINE_TYPE_DELETED" => Some(Self::DiffLineTypeDeleted), "DIFF_LINE_TYPE_HUNK_HEADER" => Some(Self::DiffLineTypeHunkHeader), "DIFF_LINE_TYPE_NO_NEWLINE" => Some(Self::DiffLineTypeNoNewline), _ => None, } } } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct DiffHunk { #[prost(string, tag = "1")] pub header: ::prost::alloc::string::String, #[prost(uint32, tag = "2")] pub old_start: u32, #[prost(uint32, tag = "3")] pub old_lines: u32, #[prost(uint32, tag = "4")] pub new_start: u32, #[prost(uint32, tag = "5")] pub new_lines: u32, #[prost(message, repeated, tag = "6")] pub lines: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct DiffFile { #[prost(string, tag = "1")] pub old_path: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub new_path: ::prost::alloc::string::String, #[prost(message, optional, tag = "3")] pub old_oid: ::core::option::Option, #[prost(message, optional, tag = "4")] pub new_oid: ::core::option::Option, #[prost(uint32, tag = "5")] pub old_mode: u32, #[prost(uint32, tag = "6")] pub new_mode: u32, #[prost(enumeration = "diff_file::ChangeType", tag = "7")] pub change_type: i32, #[prost(bool, tag = "8")] pub binary: bool, #[prost(bool, tag = "9")] pub too_large: bool, #[prost(uint32, tag = "10")] pub additions: u32, #[prost(uint32, tag = "11")] pub deletions: u32, #[prost(message, repeated, tag = "12")] pub hunks: ::prost::alloc::vec::Vec, #[prost(bytes = "vec", tag = "13")] pub patch: ::prost::alloc::vec::Vec, #[prost(double, tag = "14")] pub similarity: f64, } /// Nested message and enum types in `DiffFile`. pub mod diff_file { #[derive( Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration )] #[repr(i32)] pub enum ChangeType { DiffFileChangeTypeUnspecified = 0, DiffFileChangeTypeAdded = 1, DiffFileChangeTypeModified = 2, DiffFileChangeTypeDeleted = 3, DiffFileChangeTypeRenamed = 4, DiffFileChangeTypeCopied = 5, DiffFileChangeTypeTypeChanged = 6, DiffFileChangeTypeUnmerged = 7, } impl ChangeType { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { Self::DiffFileChangeTypeUnspecified => { "DIFF_FILE_CHANGE_TYPE_UNSPECIFIED" } Self::DiffFileChangeTypeAdded => "DIFF_FILE_CHANGE_TYPE_ADDED", Self::DiffFileChangeTypeModified => "DIFF_FILE_CHANGE_TYPE_MODIFIED", Self::DiffFileChangeTypeDeleted => "DIFF_FILE_CHANGE_TYPE_DELETED", Self::DiffFileChangeTypeRenamed => "DIFF_FILE_CHANGE_TYPE_RENAMED", Self::DiffFileChangeTypeCopied => "DIFF_FILE_CHANGE_TYPE_COPIED", Self::DiffFileChangeTypeTypeChanged => { "DIFF_FILE_CHANGE_TYPE_TYPE_CHANGED" } Self::DiffFileChangeTypeUnmerged => "DIFF_FILE_CHANGE_TYPE_UNMERGED", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "DIFF_FILE_CHANGE_TYPE_UNSPECIFIED" => { Some(Self::DiffFileChangeTypeUnspecified) } "DIFF_FILE_CHANGE_TYPE_ADDED" => Some(Self::DiffFileChangeTypeAdded), "DIFF_FILE_CHANGE_TYPE_MODIFIED" => { Some(Self::DiffFileChangeTypeModified) } "DIFF_FILE_CHANGE_TYPE_DELETED" => Some(Self::DiffFileChangeTypeDeleted), "DIFF_FILE_CHANGE_TYPE_RENAMED" => Some(Self::DiffFileChangeTypeRenamed), "DIFF_FILE_CHANGE_TYPE_COPIED" => Some(Self::DiffFileChangeTypeCopied), "DIFF_FILE_CHANGE_TYPE_TYPE_CHANGED" => { Some(Self::DiffFileChangeTypeTypeChanged) } "DIFF_FILE_CHANGE_TYPE_UNMERGED" => { Some(Self::DiffFileChangeTypeUnmerged) } _ => None, } } } } #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct DiffStats { #[prost(uint32, tag = "1")] pub additions: u32, #[prost(uint32, tag = "2")] pub deletions: u32, #[prost(uint32, tag = "3")] pub changed_files: u32, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct Diff { #[prost(message, repeated, tag = "1")] pub files: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "2")] pub stats: ::core::option::Option, #[prost(bool, tag = "3")] pub overflow: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetDiffRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub base: ::core::option::Option, #[prost(message, optional, tag = "3")] pub head: ::core::option::Option, #[prost(message, optional, tag = "4")] pub options: ::core::option::Option, #[prost(message, optional, tag = "5")] pub pagination: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetDiffResponse { #[prost(message, repeated, tag = "1")] pub files: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "2")] pub stats: ::core::option::Option, #[prost(message, optional, tag = "3")] pub page_info: ::core::option::Option, #[prost(bool, tag = "4")] pub overflow: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetCommitDiffRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub commit: ::core::option::Option, #[prost(message, optional, tag = "3")] pub options: ::core::option::Option, #[prost(message, optional, tag = "4")] pub pagination: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetPatchRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub base: ::core::option::Option, #[prost(message, optional, tag = "3")] pub head: ::core::option::Option, #[prost(message, optional, tag = "4")] pub options: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetPatchResponse { #[prost(bytes = "vec", tag = "1")] pub data: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetDiffStatsRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub base: ::core::option::Option, #[prost(message, optional, tag = "3")] pub head: ::core::option::Option, #[prost(message, optional, tag = "4")] pub options: ::core::option::Option, } /// Generated client implementations. pub mod diff_service_client { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct DiffServiceClient { inner: tonic::client::Grpc, } impl DiffServiceClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl DiffServiceClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + std::marker::Send + 'static, ::Error: Into + std::marker::Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> DiffServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + std::marker::Send + std::marker::Sync, { DiffServiceClient::new(InterceptedService::new(inner, interceptor)) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_decoding_message_size(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_encoding_message_size(limit); self } pub async fn get_diff( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.DiffService/GetDiff", ); let mut req = request.into_request(); req.extensions_mut().insert(GrpcMethod::new("gitks.DiffService", "GetDiff")); self.inner.unary(req, path, codec).await } pub async fn get_commit_diff( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.DiffService/GetCommitDiff", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.DiffService", "GetCommitDiff")); self.inner.unary(req, path, codec).await } pub async fn get_patch( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.DiffService/GetPatch", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.DiffService", "GetPatch")); self.inner.server_streaming(req, path, codec).await } pub async fn get_diff_stats( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.DiffService/GetDiffStats", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.DiffService", "GetDiffStats")); self.inner.unary(req, path, codec).await } } } /// Generated server implementations. pub mod diff_service_server { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with DiffServiceServer. #[async_trait] pub trait DiffService: std::marker::Send + std::marker::Sync + 'static { async fn get_diff( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn get_commit_diff( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the GetPatch method. type GetPatchStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, > + std::marker::Send + 'static; async fn get_patch( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn get_diff_stats( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; } #[derive(Debug)] pub struct DiffServiceServer { inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } impl DiffServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), max_decoding_message_size: None, max_encoding_message_size: None, } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.max_decoding_message_size = Some(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.max_encoding_message_size = Some(limit); self } } impl tonic::codegen::Service> for DiffServiceServer where T: DiffService, B: Body + std::marker::Send + 'static, B::Error: Into + std::marker::Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { match req.uri().path() { "/gitks.DiffService/GetDiff" => { #[allow(non_camel_case_types)] struct GetDiffSvc(pub Arc); impl< T: DiffService, > tonic::server::UnaryService for GetDiffSvc { type Response = super::GetDiffResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_diff(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetDiffSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.DiffService/GetCommitDiff" => { #[allow(non_camel_case_types)] struct GetCommitDiffSvc(pub Arc); impl< T: DiffService, > tonic::server::UnaryService for GetCommitDiffSvc { type Response = super::GetDiffResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_commit_diff(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetCommitDiffSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.DiffService/GetPatch" => { #[allow(non_camel_case_types)] struct GetPatchSvc(pub Arc); impl< T: DiffService, > tonic::server::ServerStreamingService for GetPatchSvc { type Response = super::GetPatchResponse; type ResponseStream = T::GetPatchStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_patch(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetPatchSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.server_streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.DiffService/GetDiffStats" => { #[allow(non_camel_case_types)] struct GetDiffStatsSvc(pub Arc); impl< T: DiffService, > tonic::server::UnaryService for GetDiffStatsSvc { type Response = super::DiffStats; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_diff_stats(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetDiffStatsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { let mut response = http::Response::new(empty_body()); let headers = response.headers_mut(); headers .insert( tonic::Status::GRPC_STATUS, (tonic::Code::Unimplemented as i32).into(), ); headers .insert( http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE, ); Ok(response) }) } } } } impl Clone for DiffServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, max_decoding_message_size: self.max_decoding_message_size, max_encoding_message_size: self.max_encoding_message_size, } } } /// Generated gRPC service name pub const SERVICE_NAME: &str = "gitks.DiffService"; impl tonic::server::NamedService for DiffServiceServer { const NAME: &'static str = SERVICE_NAME; } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct MergeOptions { #[prost(enumeration = "merge_options::Strategy", tag = "1")] pub strategy: i32, #[prost(enumeration = "merge_options::FastForwardMode", tag = "2")] pub fast_forward: i32, #[prost(bool, tag = "3")] pub squash: bool, #[prost(bool, tag = "4")] pub no_commit: bool, #[prost(bool, tag = "5")] pub allow_unrelated_histories: bool, #[prost(string, repeated, tag = "6")] pub strategy_options: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// Nested message and enum types in `MergeOptions`. pub mod merge_options { #[derive( Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration )] #[repr(i32)] pub enum Strategy { MergeStrategyUnspecified = 0, MergeStrategyRecursive = 1, MergeStrategyOrt = 2, MergeStrategyResolve = 3, MergeStrategyOctopus = 4, MergeStrategyOurs = 5, MergeStrategySubtree = 6, } impl Strategy { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { Self::MergeStrategyUnspecified => "MERGE_STRATEGY_UNSPECIFIED", Self::MergeStrategyRecursive => "MERGE_STRATEGY_RECURSIVE", Self::MergeStrategyOrt => "MERGE_STRATEGY_ORT", Self::MergeStrategyResolve => "MERGE_STRATEGY_RESOLVE", Self::MergeStrategyOctopus => "MERGE_STRATEGY_OCTOPUS", Self::MergeStrategyOurs => "MERGE_STRATEGY_OURS", Self::MergeStrategySubtree => "MERGE_STRATEGY_SUBTREE", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "MERGE_STRATEGY_UNSPECIFIED" => Some(Self::MergeStrategyUnspecified), "MERGE_STRATEGY_RECURSIVE" => Some(Self::MergeStrategyRecursive), "MERGE_STRATEGY_ORT" => Some(Self::MergeStrategyOrt), "MERGE_STRATEGY_RESOLVE" => Some(Self::MergeStrategyResolve), "MERGE_STRATEGY_OCTOPUS" => Some(Self::MergeStrategyOctopus), "MERGE_STRATEGY_OURS" => Some(Self::MergeStrategyOurs), "MERGE_STRATEGY_SUBTREE" => Some(Self::MergeStrategySubtree), _ => None, } } } #[derive( Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration )] #[repr(i32)] pub enum FastForwardMode { MergeFastForwardModeUnspecified = 0, MergeFastForwardModeAllowed = 1, MergeFastForwardModeOnly = 2, MergeFastForwardModeNoFf = 3, } impl FastForwardMode { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { Self::MergeFastForwardModeUnspecified => { "MERGE_FAST_FORWARD_MODE_UNSPECIFIED" } Self::MergeFastForwardModeAllowed => "MERGE_FAST_FORWARD_MODE_ALLOWED", Self::MergeFastForwardModeOnly => "MERGE_FAST_FORWARD_MODE_ONLY", Self::MergeFastForwardModeNoFf => "MERGE_FAST_FORWARD_MODE_NO_FF", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "MERGE_FAST_FORWARD_MODE_UNSPECIFIED" => { Some(Self::MergeFastForwardModeUnspecified) } "MERGE_FAST_FORWARD_MODE_ALLOWED" => { Some(Self::MergeFastForwardModeAllowed) } "MERGE_FAST_FORWARD_MODE_ONLY" => Some(Self::MergeFastForwardModeOnly), "MERGE_FAST_FORWARD_MODE_NO_FF" => Some(Self::MergeFastForwardModeNoFf), _ => None, } } } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct MergeConflictSection { #[prost(string, tag = "1")] pub label: ::prost::alloc::string::String, #[prost(bytes = "vec", tag = "2")] pub content: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct MergeConflict { #[prost(string, tag = "1")] pub path: ::prost::alloc::string::String, #[prost(uint32, tag = "2")] pub mode: u32, #[prost(message, optional, tag = "3")] pub base_oid: ::core::option::Option, #[prost(message, optional, tag = "4")] pub ours_oid: ::core::option::Option, #[prost(message, optional, tag = "5")] pub theirs_oid: ::core::option::Option, #[prost(message, repeated, tag = "6")] pub sections: ::prost::alloc::vec::Vec, #[prost(bool, tag = "7")] pub binary: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct MergeResult { #[prost(enumeration = "merge_result::Status", tag = "1")] pub status: i32, #[prost(message, optional, tag = "2")] pub commit: ::core::option::Option, #[prost(message, optional, tag = "3")] pub merge_base: ::core::option::Option, #[prost(message, repeated, tag = "4")] pub conflicts: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "5")] pub stats: ::core::option::Option, #[prost(string, tag = "6")] pub message: ::prost::alloc::string::String, } /// Nested message and enum types in `MergeResult`. pub mod merge_result { #[derive( Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration )] #[repr(i32)] pub enum Status { MergeResultStatusUnspecified = 0, MergeResultStatusMerged = 1, MergeResultStatusFastForward = 2, MergeResultStatusAlreadyUpToDate = 3, MergeResultStatusConflicts = 4, MergeResultStatusAborted = 5, } impl Status { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { Self::MergeResultStatusUnspecified => "MERGE_RESULT_STATUS_UNSPECIFIED", Self::MergeResultStatusMerged => "MERGE_RESULT_STATUS_MERGED", Self::MergeResultStatusFastForward => "MERGE_RESULT_STATUS_FAST_FORWARD", Self::MergeResultStatusAlreadyUpToDate => { "MERGE_RESULT_STATUS_ALREADY_UP_TO_DATE" } Self::MergeResultStatusConflicts => "MERGE_RESULT_STATUS_CONFLICTS", Self::MergeResultStatusAborted => "MERGE_RESULT_STATUS_ABORTED", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "MERGE_RESULT_STATUS_UNSPECIFIED" => { Some(Self::MergeResultStatusUnspecified) } "MERGE_RESULT_STATUS_MERGED" => Some(Self::MergeResultStatusMerged), "MERGE_RESULT_STATUS_FAST_FORWARD" => { Some(Self::MergeResultStatusFastForward) } "MERGE_RESULT_STATUS_ALREADY_UP_TO_DATE" => { Some(Self::MergeResultStatusAlreadyUpToDate) } "MERGE_RESULT_STATUS_CONFLICTS" => Some(Self::MergeResultStatusConflicts), "MERGE_RESULT_STATUS_ABORTED" => Some(Self::MergeResultStatusAborted), _ => None, } } } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct MergeRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, tag = "2")] pub target_branch: ::prost::alloc::string::String, #[prost(message, optional, tag = "3")] pub source: ::core::option::Option, #[prost(message, optional, tag = "4")] pub committer: ::core::option::Option, #[prost(string, tag = "5")] pub message: ::prost::alloc::string::String, #[prost(message, optional, tag = "6")] pub options: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct CheckMergeRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub target: ::core::option::Option, #[prost(message, optional, tag = "3")] pub source: ::core::option::Option, #[prost(message, optional, tag = "4")] pub options: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListMergeConflictsRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub target: ::core::option::Option, #[prost(message, optional, tag = "3")] pub source: ::core::option::Option, #[prost(message, optional, tag = "4")] pub pagination: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListMergeConflictsResponse { #[prost(message, repeated, tag = "1")] pub conflicts: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "2")] pub page_info: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ResolveMergeConflict { #[prost(string, tag = "1")] pub path: ::prost::alloc::string::String, #[prost(bytes = "vec", tag = "2")] pub content: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ResolveMergeConflictsRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, tag = "2")] pub target_branch: ::prost::alloc::string::String, #[prost(message, optional, tag = "3")] pub source: ::core::option::Option, #[prost(message, repeated, tag = "4")] pub resolutions: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "5")] pub committer: ::core::option::Option, #[prost(string, tag = "6")] pub message: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct RebaseRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, tag = "2")] pub branch: ::prost::alloc::string::String, #[prost(message, optional, tag = "3")] pub upstream: ::core::option::Option, #[prost(message, optional, tag = "4")] pub committer: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct RebaseResult { #[prost(enumeration = "rebase_result::Status", tag = "1")] pub status: i32, #[prost(message, optional, tag = "2")] pub head: ::core::option::Option, #[prost(message, repeated, tag = "3")] pub conflicts: ::prost::alloc::vec::Vec, } /// Nested message and enum types in `RebaseResult`. pub mod rebase_result { #[derive( Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration )] #[repr(i32)] pub enum Status { RebaseResultStatusUnspecified = 0, RebaseResultStatusRebased = 1, RebaseResultStatusAlreadyUpToDate = 2, RebaseResultStatusConflicts = 3, RebaseResultStatusAborted = 4, } impl Status { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { Self::RebaseResultStatusUnspecified => "REBASE_RESULT_STATUS_UNSPECIFIED", Self::RebaseResultStatusRebased => "REBASE_RESULT_STATUS_REBASED", Self::RebaseResultStatusAlreadyUpToDate => { "REBASE_RESULT_STATUS_ALREADY_UP_TO_DATE" } Self::RebaseResultStatusConflicts => "REBASE_RESULT_STATUS_CONFLICTS", Self::RebaseResultStatusAborted => "REBASE_RESULT_STATUS_ABORTED", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "REBASE_RESULT_STATUS_UNSPECIFIED" => { Some(Self::RebaseResultStatusUnspecified) } "REBASE_RESULT_STATUS_REBASED" => Some(Self::RebaseResultStatusRebased), "REBASE_RESULT_STATUS_ALREADY_UP_TO_DATE" => { Some(Self::RebaseResultStatusAlreadyUpToDate) } "REBASE_RESULT_STATUS_CONFLICTS" => { Some(Self::RebaseResultStatusConflicts) } "REBASE_RESULT_STATUS_ABORTED" => Some(Self::RebaseResultStatusAborted), _ => None, } } } } /// Generated client implementations. pub mod merge_service_client { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct MergeServiceClient { inner: tonic::client::Grpc, } impl MergeServiceClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl MergeServiceClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + std::marker::Send + 'static, ::Error: Into + std::marker::Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> MergeServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + std::marker::Send + std::marker::Sync, { MergeServiceClient::new(InterceptedService::new(inner, interceptor)) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_decoding_message_size(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_encoding_message_size(limit); self } pub async fn check_merge( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.MergeService/CheckMerge", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.MergeService", "CheckMerge")); self.inner.unary(req, path, codec).await } pub async fn merge( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static("/gitks.MergeService/Merge"); let mut req = request.into_request(); req.extensions_mut().insert(GrpcMethod::new("gitks.MergeService", "Merge")); self.inner.unary(req, path, codec).await } pub async fn list_merge_conflicts( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.MergeService/ListMergeConflicts", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.MergeService", "ListMergeConflicts")); self.inner.unary(req, path, codec).await } pub async fn resolve_merge_conflicts( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.MergeService/ResolveMergeConflicts", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.MergeService", "ResolveMergeConflicts")); self.inner.unary(req, path, codec).await } pub async fn rebase( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.MergeService/Rebase", ); let mut req = request.into_request(); req.extensions_mut().insert(GrpcMethod::new("gitks.MergeService", "Rebase")); self.inner.unary(req, path, codec).await } } } /// Generated server implementations. pub mod merge_service_server { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with MergeServiceServer. #[async_trait] pub trait MergeService: std::marker::Send + std::marker::Sync + 'static { async fn check_merge( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn merge( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn list_merge_conflicts( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn resolve_merge_conflicts( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn rebase( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; } #[derive(Debug)] pub struct MergeServiceServer { inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } impl MergeServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), max_decoding_message_size: None, max_encoding_message_size: None, } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.max_decoding_message_size = Some(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.max_encoding_message_size = Some(limit); self } } impl tonic::codegen::Service> for MergeServiceServer where T: MergeService, B: Body + std::marker::Send + 'static, B::Error: Into + std::marker::Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { match req.uri().path() { "/gitks.MergeService/CheckMerge" => { #[allow(non_camel_case_types)] struct CheckMergeSvc(pub Arc); impl< T: MergeService, > tonic::server::UnaryService for CheckMergeSvc { type Response = super::MergeResult; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::check_merge(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = CheckMergeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.MergeService/Merge" => { #[allow(non_camel_case_types)] struct MergeSvc(pub Arc); impl< T: MergeService, > tonic::server::UnaryService for MergeSvc { type Response = super::MergeResult; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::merge(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = MergeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.MergeService/ListMergeConflicts" => { #[allow(non_camel_case_types)] struct ListMergeConflictsSvc(pub Arc); impl< T: MergeService, > tonic::server::UnaryService for ListMergeConflictsSvc { type Response = super::ListMergeConflictsResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::list_merge_conflicts(&inner, request) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = ListMergeConflictsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.MergeService/ResolveMergeConflicts" => { #[allow(non_camel_case_types)] struct ResolveMergeConflictsSvc(pub Arc); impl< T: MergeService, > tonic::server::UnaryService for ResolveMergeConflictsSvc { type Response = super::MergeResult; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::resolve_merge_conflicts( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = ResolveMergeConflictsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.MergeService/Rebase" => { #[allow(non_camel_case_types)] struct RebaseSvc(pub Arc); impl< T: MergeService, > tonic::server::UnaryService for RebaseSvc { type Response = super::RebaseResult; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::rebase(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = RebaseSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { let mut response = http::Response::new(empty_body()); let headers = response.headers_mut(); headers .insert( tonic::Status::GRPC_STATUS, (tonic::Code::Unimplemented as i32).into(), ); headers .insert( http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE, ); Ok(response) }) } } } } impl Clone for MergeServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, max_decoding_message_size: self.max_decoding_message_size, max_encoding_message_size: self.max_encoding_message_size, } } } /// Generated gRPC service name pub const SERVICE_NAME: &str = "gitks.MergeService"; impl tonic::server::NamedService for MergeServiceServer { const NAME: &'static str = SERVICE_NAME; } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GitProtocolFeatures { #[prost(uint32, tag = "1")] pub version: u32, #[prost(string, repeated, tag = "2")] pub capabilities: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, #[prost(string, repeated, tag = "3")] pub server_options: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, #[prost(string, repeated, tag = "4")] pub agent: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ReferenceAdvertisement { #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, #[prost(message, optional, tag = "2")] pub target_oid: ::core::option::Option, #[prost(message, optional, tag = "3")] pub peeled_oid: ::core::option::Option, #[prost(bool, tag = "4")] pub symbolic: bool, #[prost(string, tag = "5")] pub symbolic_target: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct AdvertiseRefsRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub protocol: ::core::option::Option, #[prost(string, tag = "3")] pub service: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct AdvertiseRefsResponse { #[prost(message, repeated, tag = "1")] pub references: ::prost::alloc::vec::Vec, #[prost(string, repeated, tag = "2")] pub capabilities: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct UploadPackRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub protocol: ::core::option::Option, #[prost(bytes = "vec", tag = "3")] pub packet: ::prost::alloc::vec::Vec, #[prost(bool, tag = "4")] pub done: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct UploadPackResponse { #[prost(bytes = "vec", tag = "1")] pub packet: ::prost::alloc::vec::Vec, #[prost(string, tag = "2")] pub stderr: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ReceivePackRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub protocol: ::core::option::Option, #[prost(bytes = "vec", tag = "3")] pub packet: ::prost::alloc::vec::Vec, #[prost(bool, tag = "4")] pub done: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ReceivePackResponse { #[prost(bytes = "vec", tag = "1")] pub packet: ::prost::alloc::vec::Vec, #[prost(string, tag = "2")] pub stderr: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct PackObjectsOptions { #[prost(message, repeated, tag = "1")] pub wants: ::prost::alloc::vec::Vec, #[prost(message, repeated, tag = "2")] pub haves: ::prost::alloc::vec::Vec, #[prost(string, repeated, tag = "3")] pub shallow_revisions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, #[prost(uint32, tag = "4")] pub deepen: u32, #[prost(bool, tag = "5")] pub thin_pack: bool, #[prost(bool, tag = "6")] pub include_tag: bool, #[prost(bool, tag = "7")] pub use_bitmaps: bool, #[prost(bool, tag = "8")] pub delta_base_offset: bool, #[prost(string, repeated, tag = "9")] pub pathspec: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct PackObjectsRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub options: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct PackfileChunk { #[prost(bytes = "vec", tag = "1")] pub data: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct IndexPackRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(bytes = "vec", tag = "2")] pub data: ::prost::alloc::vec::Vec, #[prost(bool, tag = "3")] pub done: bool, #[prost(bool, tag = "4")] pub keep: bool, #[prost(bool, tag = "5")] pub strict: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct IndexPackResponse { #[prost(message, optional, tag = "1")] pub pack_hash: ::core::option::Option, #[prost(uint64, tag = "2")] pub object_count: u64, #[prost(string, tag = "3")] pub stderr: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListPackfilesRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub pagination: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct PackfileInfo { #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, #[prost(message, optional, tag = "2")] pub pack_hash: ::core::option::Option, #[prost(uint64, tag = "3")] pub size_bytes: u64, #[prost(uint64, tag = "4")] pub index_size_bytes: u64, #[prost(uint64, tag = "5")] pub object_count: u64, #[prost(bool, tag = "6")] pub has_bitmap: bool, #[prost(bool, tag = "7")] pub has_rev_index: bool, #[prost(bool, tag = "8")] pub kept: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListPackfilesResponse { #[prost(message, repeated, tag = "1")] pub packfiles: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "2")] pub page_info: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct FsckRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(bool, tag = "2")] pub strict: bool, #[prost(bool, tag = "3")] pub connectivity_only: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct FsckResponse { #[prost(bool, tag = "1")] pub ok: bool, #[prost(string, repeated, tag = "2")] pub errors: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, #[prost(string, repeated, tag = "3")] pub warnings: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// Generated client implementations. pub mod pack_service_client { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct PackServiceClient { inner: tonic::client::Grpc, } impl PackServiceClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl PackServiceClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + std::marker::Send + 'static, ::Error: Into + std::marker::Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> PackServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + std::marker::Send + std::marker::Sync, { PackServiceClient::new(InterceptedService::new(inner, interceptor)) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_decoding_message_size(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_encoding_message_size(limit); self } pub async fn advertise_refs( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.PackService/AdvertiseRefs", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.PackService", "AdvertiseRefs")); self.inner.unary(req, path, codec).await } pub async fn upload_pack( &mut self, request: impl tonic::IntoStreamingRequest, ) -> std::result::Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.PackService/UploadPack", ); let mut req = request.into_streaming_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.PackService", "UploadPack")); self.inner.streaming(req, path, codec).await } pub async fn receive_pack( &mut self, request: impl tonic::IntoStreamingRequest< Message = super::ReceivePackRequest, >, ) -> std::result::Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.PackService/ReceivePack", ); let mut req = request.into_streaming_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.PackService", "ReceivePack")); self.inner.streaming(req, path, codec).await } pub async fn pack_objects( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.PackService/PackObjects", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.PackService", "PackObjects")); self.inner.server_streaming(req, path, codec).await } pub async fn index_pack( &mut self, request: impl tonic::IntoStreamingRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.PackService/IndexPack", ); let mut req = request.into_streaming_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.PackService", "IndexPack")); self.inner.client_streaming(req, path, codec).await } pub async fn list_packfiles( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.PackService/ListPackfiles", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.PackService", "ListPackfiles")); self.inner.unary(req, path, codec).await } pub async fn fsck( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static("/gitks.PackService/Fsck"); let mut req = request.into_request(); req.extensions_mut().insert(GrpcMethod::new("gitks.PackService", "Fsck")); self.inner.unary(req, path, codec).await } } } /// Generated server implementations. pub mod pack_service_server { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with PackServiceServer. #[async_trait] pub trait PackService: std::marker::Send + std::marker::Sync + 'static { async fn advertise_refs( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; /// Server streaming response type for the UploadPack method. type UploadPackStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, > + std::marker::Send + 'static; async fn upload_pack( &self, request: tonic::Request>, ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the ReceivePack method. type ReceivePackStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, > + std::marker::Send + 'static; async fn receive_pack( &self, request: tonic::Request>, ) -> std::result::Result< tonic::Response, tonic::Status, >; /// Server streaming response type for the PackObjects method. type PackObjectsStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, > + std::marker::Send + 'static; async fn pack_objects( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn index_pack( &self, request: tonic::Request>, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn list_packfiles( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn fsck( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; } #[derive(Debug)] pub struct PackServiceServer { inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } impl PackServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), max_decoding_message_size: None, max_encoding_message_size: None, } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.max_decoding_message_size = Some(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.max_encoding_message_size = Some(limit); self } } impl tonic::codegen::Service> for PackServiceServer where T: PackService, B: Body + std::marker::Send + 'static, B::Error: Into + std::marker::Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { match req.uri().path() { "/gitks.PackService/AdvertiseRefs" => { #[allow(non_camel_case_types)] struct AdvertiseRefsSvc(pub Arc); impl< T: PackService, > tonic::server::UnaryService for AdvertiseRefsSvc { type Response = super::AdvertiseRefsResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::advertise_refs(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = AdvertiseRefsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.PackService/UploadPack" => { #[allow(non_camel_case_types)] struct UploadPackSvc(pub Arc); impl< T: PackService, > tonic::server::StreamingService for UploadPackSvc { type Response = super::UploadPackResponse; type ResponseStream = T::UploadPackStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request< tonic::Streaming, >, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::upload_pack(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = UploadPackSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.PackService/ReceivePack" => { #[allow(non_camel_case_types)] struct ReceivePackSvc(pub Arc); impl< T: PackService, > tonic::server::StreamingService for ReceivePackSvc { type Response = super::ReceivePackResponse; type ResponseStream = T::ReceivePackStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request< tonic::Streaming, >, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::receive_pack(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = ReceivePackSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.PackService/PackObjects" => { #[allow(non_camel_case_types)] struct PackObjectsSvc(pub Arc); impl< T: PackService, > tonic::server::ServerStreamingService for PackObjectsSvc { type Response = super::PackfileChunk; type ResponseStream = T::PackObjectsStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::pack_objects(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = PackObjectsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.server_streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.PackService/IndexPack" => { #[allow(non_camel_case_types)] struct IndexPackSvc(pub Arc); impl< T: PackService, > tonic::server::ClientStreamingService for IndexPackSvc { type Response = super::IndexPackResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request< tonic::Streaming, >, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::index_pack(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = IndexPackSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.client_streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.PackService/ListPackfiles" => { #[allow(non_camel_case_types)] struct ListPackfilesSvc(pub Arc); impl< T: PackService, > tonic::server::UnaryService for ListPackfilesSvc { type Response = super::ListPackfilesResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::list_packfiles(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = ListPackfilesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.PackService/Fsck" => { #[allow(non_camel_case_types)] struct FsckSvc(pub Arc); impl tonic::server::UnaryService for FsckSvc { type Response = super::FsckResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::fsck(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = FsckSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { let mut response = http::Response::new(empty_body()); let headers = response.headers_mut(); headers .insert( tonic::Status::GRPC_STATUS, (tonic::Code::Unimplemented as i32).into(), ); headers .insert( http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE, ); Ok(response) }) } } } } impl Clone for PackServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, max_decoding_message_size: self.max_decoding_message_size, max_encoding_message_size: self.max_encoding_message_size, } } } /// Generated gRPC service name pub const SERVICE_NAME: &str = "gitks.PackService"; impl tonic::server::NamedService for PackServiceServer { const NAME: &'static str = SERVICE_NAME; } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct Tag { #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub full_ref: ::prost::alloc::string::String, #[prost(message, optional, tag = "3")] pub target_oid: ::core::option::Option, #[prost(enumeration = "ObjectType", tag = "4")] pub target_type: i32, #[prost(message, optional, tag = "5")] pub tag_oid: ::core::option::Option, #[prost(bool, tag = "6")] pub annotated: bool, #[prost(message, optional, tag = "7")] pub tagger: ::core::option::Option, #[prost(string, tag = "8")] pub message: ::prost::alloc::string::String, #[prost(message, optional, tag = "9")] pub signature: ::core::option::Option, #[prost(bytes = "vec", tag = "10")] pub raw: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListTagsRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, tag = "2")] pub pattern: ::prost::alloc::string::String, #[prost(message, optional, tag = "3")] pub pagination: ::core::option::Option, #[prost(enumeration = "SortDirection", tag = "4")] pub sort_direction: i32, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListTagsResponse { #[prost(message, repeated, tag = "1")] pub tags: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "2")] pub page_info: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetTagRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, tag = "2")] pub name: ::prost::alloc::string::String, #[prost(bool, tag = "3")] pub include_raw: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct CreateTagRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, tag = "2")] pub name: ::prost::alloc::string::String, #[prost(message, optional, tag = "3")] pub target: ::core::option::Option, #[prost(string, tag = "4")] pub message: ::prost::alloc::string::String, #[prost(message, optional, tag = "5")] pub tagger: ::core::option::Option, #[prost(bool, tag = "6")] pub force: bool, #[prost(bool, tag = "7")] pub annotated: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeleteTagRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, tag = "2")] pub name: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct VerifyTagRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(string, tag = "2")] pub name: ::prost::alloc::string::String, } /// Generated client implementations. pub mod tag_service_client { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct TagServiceClient { inner: tonic::client::Grpc, } impl TagServiceClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl TagServiceClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + std::marker::Send + 'static, ::Error: Into + std::marker::Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> TagServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + std::marker::Send + std::marker::Sync, { TagServiceClient::new(InterceptedService::new(inner, interceptor)) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_decoding_message_size(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_encoding_message_size(limit); self } pub async fn list_tags( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.TagService/ListTags", ); let mut req = request.into_request(); req.extensions_mut().insert(GrpcMethod::new("gitks.TagService", "ListTags")); self.inner.unary(req, path, codec).await } pub async fn get_tag( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static("/gitks.TagService/GetTag"); let mut req = request.into_request(); req.extensions_mut().insert(GrpcMethod::new("gitks.TagService", "GetTag")); self.inner.unary(req, path, codec).await } pub async fn create_tag( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.TagService/CreateTag", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.TagService", "CreateTag")); self.inner.unary(req, path, codec).await } pub async fn delete_tag( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.TagService/DeleteTag", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.TagService", "DeleteTag")); self.inner.unary(req, path, codec).await } pub async fn verify_tag( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.TagService/VerifyTag", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.TagService", "VerifyTag")); self.inner.unary(req, path, codec).await } } } /// Generated server implementations. pub mod tag_service_server { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with TagServiceServer. #[async_trait] pub trait TagService: std::marker::Send + std::marker::Sync + 'static { async fn list_tags( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn get_tag( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn create_tag( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn delete_tag( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn verify_tag( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; } #[derive(Debug)] pub struct TagServiceServer { inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } impl TagServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), max_decoding_message_size: None, max_encoding_message_size: None, } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.max_decoding_message_size = Some(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.max_encoding_message_size = Some(limit); self } } impl tonic::codegen::Service> for TagServiceServer where T: TagService, B: Body + std::marker::Send + 'static, B::Error: Into + std::marker::Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { match req.uri().path() { "/gitks.TagService/ListTags" => { #[allow(non_camel_case_types)] struct ListTagsSvc(pub Arc); impl< T: TagService, > tonic::server::UnaryService for ListTagsSvc { type Response = super::ListTagsResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::list_tags(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = ListTagsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.TagService/GetTag" => { #[allow(non_camel_case_types)] struct GetTagSvc(pub Arc); impl tonic::server::UnaryService for GetTagSvc { type Response = super::Tag; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_tag(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetTagSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.TagService/CreateTag" => { #[allow(non_camel_case_types)] struct CreateTagSvc(pub Arc); impl< T: TagService, > tonic::server::UnaryService for CreateTagSvc { type Response = super::Tag; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::create_tag(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = CreateTagSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.TagService/DeleteTag" => { #[allow(non_camel_case_types)] struct DeleteTagSvc(pub Arc); impl< T: TagService, > tonic::server::UnaryService for DeleteTagSvc { type Response = (); type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::delete_tag(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = DeleteTagSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.TagService/VerifyTag" => { #[allow(non_camel_case_types)] struct VerifyTagSvc(pub Arc); impl< T: TagService, > tonic::server::UnaryService for VerifyTagSvc { type Response = super::VerifiedSignature; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::verify_tag(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = VerifyTagSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { let mut response = http::Response::new(empty_body()); let headers = response.headers_mut(); headers .insert( tonic::Status::GRPC_STATUS, (tonic::Code::Unimplemented as i32).into(), ); headers .insert( http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE, ); Ok(response) }) } } } } impl Clone for TagServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, max_decoding_message_size: self.max_decoding_message_size, max_encoding_message_size: self.max_encoding_message_size, } } } /// Generated gRPC service name pub const SERVICE_NAME: &str = "gitks.TagService"; impl tonic::server::NamedService for TagServiceServer { const NAME: &'static str = SERVICE_NAME; } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct TreeEntry { #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub path: ::prost::alloc::string::String, #[prost(message, optional, tag = "3")] pub oid: ::core::option::Option, #[prost(enumeration = "tree_entry::EntryType", tag = "4")] pub r#type: i32, #[prost(uint32, tag = "5")] pub mode: u32, #[prost(int64, tag = "6")] pub size: i64, } /// Nested message and enum types in `TreeEntry`. pub mod tree_entry { #[derive( Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration )] #[repr(i32)] pub enum EntryType { TreeEntryTypeUnspecified = 0, TreeEntryTypeTree = 1, TreeEntryTypeBlob = 2, TreeEntryTypeCommit = 3, TreeEntryTypeSymlink = 4, TreeEntryTypeExecutable = 5, } impl EntryType { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { Self::TreeEntryTypeUnspecified => "TREE_ENTRY_TYPE_UNSPECIFIED", Self::TreeEntryTypeTree => "TREE_ENTRY_TYPE_TREE", Self::TreeEntryTypeBlob => "TREE_ENTRY_TYPE_BLOB", Self::TreeEntryTypeCommit => "TREE_ENTRY_TYPE_COMMIT", Self::TreeEntryTypeSymlink => "TREE_ENTRY_TYPE_SYMLINK", Self::TreeEntryTypeExecutable => "TREE_ENTRY_TYPE_EXECUTABLE", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "TREE_ENTRY_TYPE_UNSPECIFIED" => Some(Self::TreeEntryTypeUnspecified), "TREE_ENTRY_TYPE_TREE" => Some(Self::TreeEntryTypeTree), "TREE_ENTRY_TYPE_BLOB" => Some(Self::TreeEntryTypeBlob), "TREE_ENTRY_TYPE_COMMIT" => Some(Self::TreeEntryTypeCommit), "TREE_ENTRY_TYPE_SYMLINK" => Some(Self::TreeEntryTypeSymlink), "TREE_ENTRY_TYPE_EXECUTABLE" => Some(Self::TreeEntryTypeExecutable), _ => None, } } } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct Tree { #[prost(message, optional, tag = "1")] pub oid: ::core::option::Option, #[prost(string, tag = "2")] pub path: ::prost::alloc::string::String, #[prost(message, repeated, tag = "3")] pub entries: ::prost::alloc::vec::Vec, #[prost(bool, tag = "4")] pub truncated: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct Blob { #[prost(message, optional, tag = "1")] pub oid: ::core::option::Option, #[prost(string, tag = "2")] pub path: ::prost::alloc::string::String, #[prost(uint32, tag = "3")] pub mode: u32, #[prost(int64, tag = "4")] pub size: i64, #[prost(bytes = "vec", tag = "5")] pub data: ::prost::alloc::vec::Vec, #[prost(string, tag = "6")] pub encoding: ::prost::alloc::string::String, #[prost(bool, tag = "7")] pub binary: bool, #[prost(bool, tag = "8")] pub truncated: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct FileMetadata { #[prost(string, tag = "1")] pub path: ::prost::alloc::string::String, #[prost(message, optional, tag = "2")] pub oid: ::core::option::Option, #[prost(uint32, tag = "3")] pub mode: u32, #[prost(int64, tag = "4")] pub size: i64, #[prost(enumeration = "ObjectType", tag = "5")] pub r#type: i32, #[prost(bool, tag = "6")] pub binary: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListTreeRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub revision: ::core::option::Option, #[prost(string, tag = "3")] pub path: ::prost::alloc::string::String, #[prost(bool, tag = "4")] pub recursive: bool, #[prost(message, optional, tag = "5")] pub pagination: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListTreeResponse { #[prost(message, repeated, tag = "1")] pub entries: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "2")] pub page_info: ::core::option::Option, #[prost(bool, tag = "3")] pub truncated: bool, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetTreeRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub revision: ::core::option::Option, #[prost(string, tag = "3")] pub path: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetBlobRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub revision: ::core::option::Option, #[prost(string, tag = "3")] pub path: ::prost::alloc::string::String, #[prost(message, optional, tag = "4")] pub oid: ::core::option::Option, #[prost(uint64, tag = "5")] pub max_bytes: u64, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetRawBlobRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub revision: ::core::option::Option, #[prost(string, tag = "3")] pub path: ::prost::alloc::string::String, #[prost(message, optional, tag = "4")] pub oid: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetRawBlobResponse { #[prost(bytes = "vec", tag = "1")] pub data: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetFileMetadataRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub revision: ::core::option::Option, #[prost(string, tag = "3")] pub path: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct FindFilesRequest { #[prost(message, optional, tag = "1")] pub repository: ::core::option::Option, #[prost(message, optional, tag = "2")] pub revision: ::core::option::Option, #[prost(string, tag = "3")] pub pattern: ::prost::alloc::string::String, #[prost(string, repeated, tag = "4")] pub pathspec: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, #[prost(message, optional, tag = "5")] pub pagination: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct FindFilesResponse { #[prost(message, repeated, tag = "1")] pub files: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "2")] pub page_info: ::core::option::Option, } /// Generated client implementations. pub mod tree_service_client { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct TreeServiceClient { inner: tonic::client::Grpc, } impl TreeServiceClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl TreeServiceClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + std::marker::Send + 'static, ::Error: Into + std::marker::Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> TreeServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + std::marker::Send + std::marker::Sync, { TreeServiceClient::new(InterceptedService::new(inner, interceptor)) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_decoding_message_size(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_encoding_message_size(limit); self } pub async fn list_tree( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.TreeService/ListTree", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.TreeService", "ListTree")); self.inner.unary(req, path, codec).await } pub async fn get_tree( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.TreeService/GetTree", ); let mut req = request.into_request(); req.extensions_mut().insert(GrpcMethod::new("gitks.TreeService", "GetTree")); self.inner.unary(req, path, codec).await } pub async fn get_blob( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.TreeService/GetBlob", ); let mut req = request.into_request(); req.extensions_mut().insert(GrpcMethod::new("gitks.TreeService", "GetBlob")); self.inner.unary(req, path, codec).await } pub async fn get_raw_blob( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.TreeService/GetRawBlob", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.TreeService", "GetRawBlob")); self.inner.server_streaming(req, path, codec).await } pub async fn get_file_metadata( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.TreeService/GetFileMetadata", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.TreeService", "GetFileMetadata")); self.inner.unary(req, path, codec).await } pub async fn find_files( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/gitks.TreeService/FindFiles", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("gitks.TreeService", "FindFiles")); self.inner.unary(req, path, codec).await } } } /// Generated server implementations. pub mod tree_service_server { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with TreeServiceServer. #[async_trait] pub trait TreeService: std::marker::Send + std::marker::Sync + 'static { async fn list_tree( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn get_tree( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn get_blob( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the GetRawBlob method. type GetRawBlobStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, > + std::marker::Send + 'static; async fn get_raw_blob( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn get_file_metadata( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn find_files( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; } #[derive(Debug)] pub struct TreeServiceServer { inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } impl TreeServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), max_decoding_message_size: None, max_encoding_message_size: None, } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.max_decoding_message_size = Some(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.max_encoding_message_size = Some(limit); self } } impl tonic::codegen::Service> for TreeServiceServer where T: TreeService, B: Body + std::marker::Send + 'static, B::Error: Into + std::marker::Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { match req.uri().path() { "/gitks.TreeService/ListTree" => { #[allow(non_camel_case_types)] struct ListTreeSvc(pub Arc); impl< T: TreeService, > tonic::server::UnaryService for ListTreeSvc { type Response = super::ListTreeResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::list_tree(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = ListTreeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.TreeService/GetTree" => { #[allow(non_camel_case_types)] struct GetTreeSvc(pub Arc); impl< T: TreeService, > tonic::server::UnaryService for GetTreeSvc { type Response = super::Tree; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_tree(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetTreeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.TreeService/GetBlob" => { #[allow(non_camel_case_types)] struct GetBlobSvc(pub Arc); impl< T: TreeService, > tonic::server::UnaryService for GetBlobSvc { type Response = super::Blob; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_blob(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetBlobSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.TreeService/GetRawBlob" => { #[allow(non_camel_case_types)] struct GetRawBlobSvc(pub Arc); impl< T: TreeService, > tonic::server::ServerStreamingService for GetRawBlobSvc { type Response = super::GetRawBlobResponse; type ResponseStream = T::GetRawBlobStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_raw_blob(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetRawBlobSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.server_streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.TreeService/GetFileMetadata" => { #[allow(non_camel_case_types)] struct GetFileMetadataSvc(pub Arc); impl< T: TreeService, > tonic::server::UnaryService for GetFileMetadataSvc { type Response = super::FileMetadata; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_file_metadata(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetFileMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/gitks.TreeService/FindFiles" => { #[allow(non_camel_case_types)] struct FindFilesSvc(pub Arc); impl< T: TreeService, > tonic::server::UnaryService for FindFilesSvc { type Response = super::FindFilesResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::find_files(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = FindFilesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { let mut response = http::Response::new(empty_body()); let headers = response.headers_mut(); headers .insert( tonic::Status::GRPC_STATUS, (tonic::Code::Unimplemented as i32).into(), ); headers .insert( http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE, ); Ok(response) }) } } } } impl Clone for TreeServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, max_decoding_message_size: self.max_decoding_message_size, max_encoding_message_size: self.max_encoding_message_size, } } } /// Generated gRPC service name pub const SERVICE_NAME: &str = "gitks.TreeService"; impl tonic::server::NamedService for TreeServiceServer { const NAME: &'static str = SERVICE_NAME; } }