dcb0fb74c5
- Add advertise_refs functionality for Git protocol communication - Implement archive service with TAR/ZIP format support and streaming - Create blame service for Git file annotation with line tracking - Add branch management including create, delete, rename and compare operations - Implement merge checking with conflict detection and fast-forward handling - Add cherry-pick functionality for applying commits between branches - Integrate gix library for Git repository operations and object handling - Add comprehensive test suite covering all Git operations - Implement proper error handling and repository validation - Add pagination support for large result sets - Create protobuf definitions for all Git operations and data structures - Add build system for gRPC code generation and dependency management
8924 lines
375 KiB
Rust
8924 lines
375 KiB
Rust
// 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<u8>,
|
|
#[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<object_selector::Selector>,
|
|
}
|
|
/// 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<Oid>,
|
|
#[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<Self> {
|
|
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<Self> {
|
|
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<Self> {
|
|
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<RepositoryHeader>,
|
|
#[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<RepositoryHeader>,
|
|
}
|
|
#[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<RepositoryHeader>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct InitRepositoryRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
#[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<RepositoryHeader>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct RepositoryExistsRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
}
|
|
#[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<RepositoryHeader>,
|
|
}
|
|
#[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<RepositoryHeader>,
|
|
#[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<RepositoryHeader>,
|
|
#[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<RepositoryConfigEntry>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct SetRepositoryConfigRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
#[prost(message, repeated, tag = "2")]
|
|
pub entries: ::prost::alloc::vec::Vec<RepositoryConfigEntry>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct RepositoryStatisticsRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct RepositoryHealthRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
#[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<RepositoryStatistics>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GarbageCollectRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
#[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<RepositoryHeader>,
|
|
#[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<RepositoryHeader>,
|
|
#[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<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl RepositoryServiceClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
|
|
where
|
|
D: TryInto<tonic::transport::Endpoint>,
|
|
D::Error: Into<StdError>,
|
|
{
|
|
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
|
|
Ok(Self::new(conn))
|
|
}
|
|
}
|
|
impl<T> RepositoryServiceClient<T>
|
|
where
|
|
T: tonic::client::GrpcService<tonic::body::BoxBody>,
|
|
T::Error: Into<StdError>,
|
|
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
|
|
<T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> RepositoryServiceClient<InterceptedService<T, F>>
|
|
where
|
|
F: tonic::service::Interceptor,
|
|
T::ResponseBody: Default,
|
|
T: tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
Response = http::Response<
|
|
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
|
|
>,
|
|
>,
|
|
<T as tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
>>::Error: Into<StdError> + 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<super::GetRepositoryRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Repository>, 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<super::InitRepositoryRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Repository>, 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<super::DeleteRepositoryRequest>,
|
|
) -> 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/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<super::RepositoryExistsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::RepositoryExistsResponse>,
|
|
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<super::RepositoryObjectFormatRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::RepositoryObjectFormatResponse>,
|
|
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<super::GetDefaultBranchRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::GetDefaultBranchResponse>,
|
|
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<super::SetDefaultBranchRequest>,
|
|
) -> 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/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<super::GetRepositoryConfigRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::GetRepositoryConfigResponse>,
|
|
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<super::SetRepositoryConfigRequest>,
|
|
) -> 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/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<super::RepositoryStatisticsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::RepositoryStatistics>,
|
|
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<super::RepositoryHealthRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::RepositoryHealthResponse>,
|
|
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<super::GarbageCollectRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::RepositoryMaintenanceResponse>,
|
|
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<super::RepackRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::RepositoryMaintenanceResponse>,
|
|
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<super::WriteCommitGraphRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::RepositoryMaintenanceResponse>,
|
|
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<super::GetRepositoryRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Repository>, tonic::Status>;
|
|
async fn init_repository(
|
|
&self,
|
|
request: tonic::Request<super::InitRepositoryRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Repository>, tonic::Status>;
|
|
async fn delete_repository(
|
|
&self,
|
|
request: tonic::Request<super::DeleteRepositoryRequest>,
|
|
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
|
|
async fn repository_exists(
|
|
&self,
|
|
request: tonic::Request<super::RepositoryExistsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::RepositoryExistsResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn get_object_format(
|
|
&self,
|
|
request: tonic::Request<super::RepositoryObjectFormatRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::RepositoryObjectFormatResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn get_default_branch(
|
|
&self,
|
|
request: tonic::Request<super::GetDefaultBranchRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::GetDefaultBranchResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn set_default_branch(
|
|
&self,
|
|
request: tonic::Request<super::SetDefaultBranchRequest>,
|
|
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
|
|
async fn get_repository_config(
|
|
&self,
|
|
request: tonic::Request<super::GetRepositoryConfigRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::GetRepositoryConfigResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn set_repository_config(
|
|
&self,
|
|
request: tonic::Request<super::SetRepositoryConfigRequest>,
|
|
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
|
|
async fn get_repository_statistics(
|
|
&self,
|
|
request: tonic::Request<super::RepositoryStatisticsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::RepositoryStatistics>,
|
|
tonic::Status,
|
|
>;
|
|
async fn check_repository_health(
|
|
&self,
|
|
request: tonic::Request<super::RepositoryHealthRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::RepositoryHealthResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn garbage_collect(
|
|
&self,
|
|
request: tonic::Request<super::GarbageCollectRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::RepositoryMaintenanceResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn repack(
|
|
&self,
|
|
request: tonic::Request<super::RepackRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::RepositoryMaintenanceResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn write_commit_graph(
|
|
&self,
|
|
request: tonic::Request<super::WriteCommitGraphRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::RepositoryMaintenanceResponse>,
|
|
tonic::Status,
|
|
>;
|
|
}
|
|
#[derive(Debug)]
|
|
pub struct RepositoryServiceServer<T> {
|
|
inner: Arc<T>,
|
|
accept_compression_encodings: EnabledCompressionEncodings,
|
|
send_compression_encodings: EnabledCompressionEncodings,
|
|
max_decoding_message_size: Option<usize>,
|
|
max_encoding_message_size: Option<usize>,
|
|
}
|
|
impl<T> RepositoryServiceServer<T> {
|
|
pub fn new(inner: T) -> Self {
|
|
Self::from_arc(Arc::new(inner))
|
|
}
|
|
pub fn from_arc(inner: Arc<T>) -> 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> InterceptedService<Self, F>
|
|
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<T, B> tonic::codegen::Service<http::Request<B>> for RepositoryServiceServer<T>
|
|
where
|
|
T: RepositoryService,
|
|
B: Body + std::marker::Send + 'static,
|
|
B::Error: Into<StdError> + std::marker::Send + 'static,
|
|
{
|
|
type Response = http::Response<tonic::body::BoxBody>;
|
|
type Error = std::convert::Infallible;
|
|
type Future = BoxFuture<Self::Response, Self::Error>;
|
|
fn poll_ready(
|
|
&mut self,
|
|
_cx: &mut Context<'_>,
|
|
) -> Poll<std::result::Result<(), Self::Error>> {
|
|
Poll::Ready(Ok(()))
|
|
}
|
|
fn call(&mut self, req: http::Request<B>) -> Self::Future {
|
|
match req.uri().path() {
|
|
"/gitks.RepositoryService/GetRepository" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct GetRepositorySvc<T: RepositoryService>(pub Arc<T>);
|
|
impl<
|
|
T: RepositoryService,
|
|
> tonic::server::UnaryService<super::GetRepositoryRequest>
|
|
for GetRepositorySvc<T> {
|
|
type Response = super::Repository;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetRepositoryRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as RepositoryService>::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<T: RepositoryService>(pub Arc<T>);
|
|
impl<
|
|
T: RepositoryService,
|
|
> tonic::server::UnaryService<super::InitRepositoryRequest>
|
|
for InitRepositorySvc<T> {
|
|
type Response = super::Repository;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::InitRepositoryRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as RepositoryService>::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<T: RepositoryService>(pub Arc<T>);
|
|
impl<
|
|
T: RepositoryService,
|
|
> tonic::server::UnaryService<super::DeleteRepositoryRequest>
|
|
for DeleteRepositorySvc<T> {
|
|
type Response = ();
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::DeleteRepositoryRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as RepositoryService>::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<T: RepositoryService>(pub Arc<T>);
|
|
impl<
|
|
T: RepositoryService,
|
|
> tonic::server::UnaryService<super::RepositoryExistsRequest>
|
|
for RepositoryExistsSvc<T> {
|
|
type Response = super::RepositoryExistsResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::RepositoryExistsRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as RepositoryService>::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<T: RepositoryService>(pub Arc<T>);
|
|
impl<
|
|
T: RepositoryService,
|
|
> tonic::server::UnaryService<super::RepositoryObjectFormatRequest>
|
|
for GetObjectFormatSvc<T> {
|
|
type Response = super::RepositoryObjectFormatResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::RepositoryObjectFormatRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as RepositoryService>::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<T: RepositoryService>(pub Arc<T>);
|
|
impl<
|
|
T: RepositoryService,
|
|
> tonic::server::UnaryService<super::GetDefaultBranchRequest>
|
|
for GetDefaultBranchSvc<T> {
|
|
type Response = super::GetDefaultBranchResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetDefaultBranchRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as RepositoryService>::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<T: RepositoryService>(pub Arc<T>);
|
|
impl<
|
|
T: RepositoryService,
|
|
> tonic::server::UnaryService<super::SetDefaultBranchRequest>
|
|
for SetDefaultBranchSvc<T> {
|
|
type Response = ();
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::SetDefaultBranchRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as RepositoryService>::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<T: RepositoryService>(pub Arc<T>);
|
|
impl<
|
|
T: RepositoryService,
|
|
> tonic::server::UnaryService<super::GetRepositoryConfigRequest>
|
|
for GetRepositoryConfigSvc<T> {
|
|
type Response = super::GetRepositoryConfigResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetRepositoryConfigRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as RepositoryService>::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<T: RepositoryService>(pub Arc<T>);
|
|
impl<
|
|
T: RepositoryService,
|
|
> tonic::server::UnaryService<super::SetRepositoryConfigRequest>
|
|
for SetRepositoryConfigSvc<T> {
|
|
type Response = ();
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::SetRepositoryConfigRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as RepositoryService>::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<T: RepositoryService>(pub Arc<T>);
|
|
impl<
|
|
T: RepositoryService,
|
|
> tonic::server::UnaryService<super::RepositoryStatisticsRequest>
|
|
for GetRepositoryStatisticsSvc<T> {
|
|
type Response = super::RepositoryStatistics;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::RepositoryStatisticsRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as RepositoryService>::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<T: RepositoryService>(pub Arc<T>);
|
|
impl<
|
|
T: RepositoryService,
|
|
> tonic::server::UnaryService<super::RepositoryHealthRequest>
|
|
for CheckRepositoryHealthSvc<T> {
|
|
type Response = super::RepositoryHealthResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::RepositoryHealthRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as RepositoryService>::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<T: RepositoryService>(pub Arc<T>);
|
|
impl<
|
|
T: RepositoryService,
|
|
> tonic::server::UnaryService<super::GarbageCollectRequest>
|
|
for GarbageCollectSvc<T> {
|
|
type Response = super::RepositoryMaintenanceResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GarbageCollectRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as RepositoryService>::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<T: RepositoryService>(pub Arc<T>);
|
|
impl<
|
|
T: RepositoryService,
|
|
> tonic::server::UnaryService<super::RepackRequest>
|
|
for RepackSvc<T> {
|
|
type Response = super::RepositoryMaintenanceResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::RepackRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as RepositoryService>::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<T: RepositoryService>(pub Arc<T>);
|
|
impl<
|
|
T: RepositoryService,
|
|
> tonic::server::UnaryService<super::WriteCommitGraphRequest>
|
|
for WriteCommitGraphSvc<T> {
|
|
type Response = super::RepositoryMaintenanceResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::WriteCommitGraphRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as RepositoryService>::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<T> Clone for RepositoryServiceServer<T> {
|
|
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<T> tonic::server::NamedService for RepositoryServiceServer<T> {
|
|
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<Self> {
|
|
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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub treeish: ::core::option::Option<ObjectSelector>,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub options: ::core::option::Option<ArchiveOptions>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ArchiveChunk {
|
|
#[prost(bytes = "vec", tag = "1")]
|
|
pub data: ::prost::alloc::vec::Vec<u8>,
|
|
}
|
|
#[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<Oid>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub treeish: ::core::option::Option<ObjectSelector>,
|
|
#[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<Pagination>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ListArchiveEntriesResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub entries: ::prost::alloc::vec::Vec<ArchiveEntry>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub page_info: ::core::option::Option<PageInfo>,
|
|
}
|
|
/// 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<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl ArchiveServiceClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
|
|
where
|
|
D: TryInto<tonic::transport::Endpoint>,
|
|
D::Error: Into<StdError>,
|
|
{
|
|
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
|
|
Ok(Self::new(conn))
|
|
}
|
|
}
|
|
impl<T> ArchiveServiceClient<T>
|
|
where
|
|
T: tonic::client::GrpcService<tonic::body::BoxBody>,
|
|
T::Error: Into<StdError>,
|
|
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
|
|
<T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> ArchiveServiceClient<InterceptedService<T, F>>
|
|
where
|
|
F: tonic::service::Interceptor,
|
|
T::ResponseBody: Default,
|
|
T: tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
Response = http::Response<
|
|
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
|
|
>,
|
|
>,
|
|
<T as tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
>>::Error: Into<StdError> + 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<super::ArchiveRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<tonic::codec::Streaming<super::ArchiveChunk>>,
|
|
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<super::ListArchiveEntriesRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListArchiveEntriesResponse>,
|
|
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<super::ArchiveChunk, tonic::Status>,
|
|
>
|
|
+ std::marker::Send
|
|
+ 'static;
|
|
async fn get_archive(
|
|
&self,
|
|
request: tonic::Request<super::ArchiveRequest>,
|
|
) -> std::result::Result<tonic::Response<Self::GetArchiveStream>, tonic::Status>;
|
|
async fn list_archive_entries(
|
|
&self,
|
|
request: tonic::Request<super::ListArchiveEntriesRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListArchiveEntriesResponse>,
|
|
tonic::Status,
|
|
>;
|
|
}
|
|
#[derive(Debug)]
|
|
pub struct ArchiveServiceServer<T> {
|
|
inner: Arc<T>,
|
|
accept_compression_encodings: EnabledCompressionEncodings,
|
|
send_compression_encodings: EnabledCompressionEncodings,
|
|
max_decoding_message_size: Option<usize>,
|
|
max_encoding_message_size: Option<usize>,
|
|
}
|
|
impl<T> ArchiveServiceServer<T> {
|
|
pub fn new(inner: T) -> Self {
|
|
Self::from_arc(Arc::new(inner))
|
|
}
|
|
pub fn from_arc(inner: Arc<T>) -> 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> InterceptedService<Self, F>
|
|
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<T, B> tonic::codegen::Service<http::Request<B>> for ArchiveServiceServer<T>
|
|
where
|
|
T: ArchiveService,
|
|
B: Body + std::marker::Send + 'static,
|
|
B::Error: Into<StdError> + std::marker::Send + 'static,
|
|
{
|
|
type Response = http::Response<tonic::body::BoxBody>;
|
|
type Error = std::convert::Infallible;
|
|
type Future = BoxFuture<Self::Response, Self::Error>;
|
|
fn poll_ready(
|
|
&mut self,
|
|
_cx: &mut Context<'_>,
|
|
) -> Poll<std::result::Result<(), Self::Error>> {
|
|
Poll::Ready(Ok(()))
|
|
}
|
|
fn call(&mut self, req: http::Request<B>) -> Self::Future {
|
|
match req.uri().path() {
|
|
"/gitks.ArchiveService/GetArchive" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct GetArchiveSvc<T: ArchiveService>(pub Arc<T>);
|
|
impl<
|
|
T: ArchiveService,
|
|
> tonic::server::ServerStreamingService<super::ArchiveRequest>
|
|
for GetArchiveSvc<T> {
|
|
type Response = super::ArchiveChunk;
|
|
type ResponseStream = T::GetArchiveStream;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::ResponseStream>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ArchiveRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ArchiveService>::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<T: ArchiveService>(pub Arc<T>);
|
|
impl<
|
|
T: ArchiveService,
|
|
> tonic::server::UnaryService<super::ListArchiveEntriesRequest>
|
|
for ListArchiveEntriesSvc<T> {
|
|
type Response = super::ListArchiveEntriesResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ListArchiveEntriesRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as ArchiveService>::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<T> Clone for ArchiveServiceServer<T> {
|
|
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<T> tonic::server::NamedService for ArchiveServiceServer<T> {
|
|
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<Identity>,
|
|
#[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<Self> {
|
|
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<PayloadTagger>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub committer: ::core::option::Option<PayloadTagger>,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub oid: ::core::option::Option<Oid>,
|
|
#[prost(string, tag = "4")]
|
|
pub message: ::prost::alloc::string::String,
|
|
#[prost(message, repeated, tag = "5")]
|
|
pub parents: ::prost::alloc::vec::Vec<Oid>,
|
|
#[prost(message, optional, tag = "6")]
|
|
pub tree: ::core::option::Option<Oid>,
|
|
#[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<Oid>,
|
|
#[prost(string, tag = "2")]
|
|
pub abbreviated_oid: ::prost::alloc::string::String,
|
|
#[prost(message, repeated, tag = "3")]
|
|
pub parent_oids: ::prost::alloc::vec::Vec<Oid>,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub tree_oid: ::core::option::Option<Oid>,
|
|
#[prost(message, optional, tag = "5")]
|
|
pub author: ::core::option::Option<Signature>,
|
|
#[prost(message, optional, tag = "6")]
|
|
pub committer: ::core::option::Option<Signature>,
|
|
#[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<CommitTrailer>,
|
|
#[prost(message, optional, tag = "11")]
|
|
pub signature: ::core::option::Option<VerifiedSignature>,
|
|
#[prost(message, optional, tag = "12")]
|
|
pub stats: ::core::option::Option<CommitStats>,
|
|
#[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<u8>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ListCommitsRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub revision: ::core::option::Option<ObjectSelector>,
|
|
#[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<Pagination>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ListCommitsResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub commits: ::prost::alloc::vec::Vec<Commit>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub page_info: ::core::option::Option<PageInfo>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetCommitRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub revision: ::core::option::Option<ObjectSelector>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub revision: ::core::option::Option<ObjectSelector>,
|
|
#[prost(bool, tag = "3")]
|
|
pub first_parent: bool,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub pagination: ::core::option::Option<Pagination>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetCommitAncestorsResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub commits: ::prost::alloc::vec::Vec<Commit>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub page_info: ::core::option::Option<PageInfo>,
|
|
}
|
|
#[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<u8>,
|
|
#[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<Oid>,
|
|
}
|
|
/// 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<Self> {
|
|
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<RepositoryHeader>,
|
|
#[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<Signature>,
|
|
#[prost(message, optional, tag = "5")]
|
|
pub committer: ::core::option::Option<Signature>,
|
|
#[prost(message, repeated, tag = "6")]
|
|
pub actions: ::prost::alloc::vec::Vec<CreateCommitAction>,
|
|
#[prost(message, optional, tag = "7")]
|
|
pub start_revision: ::core::option::Option<ObjectSelector>,
|
|
#[prost(bool, tag = "8")]
|
|
pub force: bool,
|
|
#[prost(message, repeated, tag = "9")]
|
|
pub trailers: ::prost::alloc::vec::Vec<CommitTrailer>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct CreateCommitResponse {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub commit: ::core::option::Option<Commit>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub commit: ::core::option::Option<ObjectSelector>,
|
|
#[prost(string, tag = "3")]
|
|
pub branch: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub committer: ::core::option::Option<Signature>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub commit: ::core::option::Option<ObjectSelector>,
|
|
#[prost(string, tag = "3")]
|
|
pub branch: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub committer: ::core::option::Option<Signature>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub base: ::core::option::Option<ObjectSelector>,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub head: ::core::option::Option<ObjectSelector>,
|
|
#[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<Pagination>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct CompareCommitsResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub commits: ::prost::alloc::vec::Vec<Commit>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub stats: ::core::option::Option<CommitStats>,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub page_info: ::core::option::Option<PageInfo>,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub merge_base: ::core::option::Option<Oid>,
|
|
}
|
|
/// 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<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl CommitServiceClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
|
|
where
|
|
D: TryInto<tonic::transport::Endpoint>,
|
|
D::Error: Into<StdError>,
|
|
{
|
|
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
|
|
Ok(Self::new(conn))
|
|
}
|
|
}
|
|
impl<T> CommitServiceClient<T>
|
|
where
|
|
T: tonic::client::GrpcService<tonic::body::BoxBody>,
|
|
T::Error: Into<StdError>,
|
|
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
|
|
<T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> CommitServiceClient<InterceptedService<T, F>>
|
|
where
|
|
F: tonic::service::Interceptor,
|
|
T::ResponseBody: Default,
|
|
T: tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
Response = http::Response<
|
|
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
|
|
>,
|
|
>,
|
|
<T as tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
>>::Error: Into<StdError> + 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<super::ListCommitsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListCommitsResponse>,
|
|
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<super::GetCommitRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Commit>, 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<super::GetCommitAncestorsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::GetCommitAncestorsResponse>,
|
|
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<super::CreateCommitRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::CreateCommitResponse>,
|
|
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<super::RevertCommitRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::CreateCommitResponse>,
|
|
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<super::CherryPickCommitRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::CreateCommitResponse>,
|
|
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<super::CompareCommitsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::CompareCommitsResponse>,
|
|
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<super::ListCommitsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListCommitsResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn get_commit(
|
|
&self,
|
|
request: tonic::Request<super::GetCommitRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Commit>, tonic::Status>;
|
|
async fn get_commit_ancestors(
|
|
&self,
|
|
request: tonic::Request<super::GetCommitAncestorsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::GetCommitAncestorsResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn create_commit(
|
|
&self,
|
|
request: tonic::Request<super::CreateCommitRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::CreateCommitResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn revert_commit(
|
|
&self,
|
|
request: tonic::Request<super::RevertCommitRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::CreateCommitResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn cherry_pick_commit(
|
|
&self,
|
|
request: tonic::Request<super::CherryPickCommitRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::CreateCommitResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn compare_commits(
|
|
&self,
|
|
request: tonic::Request<super::CompareCommitsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::CompareCommitsResponse>,
|
|
tonic::Status,
|
|
>;
|
|
}
|
|
#[derive(Debug)]
|
|
pub struct CommitServiceServer<T> {
|
|
inner: Arc<T>,
|
|
accept_compression_encodings: EnabledCompressionEncodings,
|
|
send_compression_encodings: EnabledCompressionEncodings,
|
|
max_decoding_message_size: Option<usize>,
|
|
max_encoding_message_size: Option<usize>,
|
|
}
|
|
impl<T> CommitServiceServer<T> {
|
|
pub fn new(inner: T) -> Self {
|
|
Self::from_arc(Arc::new(inner))
|
|
}
|
|
pub fn from_arc(inner: Arc<T>) -> 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> InterceptedService<Self, F>
|
|
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<T, B> tonic::codegen::Service<http::Request<B>> for CommitServiceServer<T>
|
|
where
|
|
T: CommitService,
|
|
B: Body + std::marker::Send + 'static,
|
|
B::Error: Into<StdError> + std::marker::Send + 'static,
|
|
{
|
|
type Response = http::Response<tonic::body::BoxBody>;
|
|
type Error = std::convert::Infallible;
|
|
type Future = BoxFuture<Self::Response, Self::Error>;
|
|
fn poll_ready(
|
|
&mut self,
|
|
_cx: &mut Context<'_>,
|
|
) -> Poll<std::result::Result<(), Self::Error>> {
|
|
Poll::Ready(Ok(()))
|
|
}
|
|
fn call(&mut self, req: http::Request<B>) -> Self::Future {
|
|
match req.uri().path() {
|
|
"/gitks.CommitService/ListCommits" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct ListCommitsSvc<T: CommitService>(pub Arc<T>);
|
|
impl<
|
|
T: CommitService,
|
|
> tonic::server::UnaryService<super::ListCommitsRequest>
|
|
for ListCommitsSvc<T> {
|
|
type Response = super::ListCommitsResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ListCommitsRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as CommitService>::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<T: CommitService>(pub Arc<T>);
|
|
impl<
|
|
T: CommitService,
|
|
> tonic::server::UnaryService<super::GetCommitRequest>
|
|
for GetCommitSvc<T> {
|
|
type Response = super::Commit;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetCommitRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as CommitService>::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<T: CommitService>(pub Arc<T>);
|
|
impl<
|
|
T: CommitService,
|
|
> tonic::server::UnaryService<super::GetCommitAncestorsRequest>
|
|
for GetCommitAncestorsSvc<T> {
|
|
type Response = super::GetCommitAncestorsResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetCommitAncestorsRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as CommitService>::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<T: CommitService>(pub Arc<T>);
|
|
impl<
|
|
T: CommitService,
|
|
> tonic::server::UnaryService<super::CreateCommitRequest>
|
|
for CreateCommitSvc<T> {
|
|
type Response = super::CreateCommitResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::CreateCommitRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as CommitService>::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<T: CommitService>(pub Arc<T>);
|
|
impl<
|
|
T: CommitService,
|
|
> tonic::server::UnaryService<super::RevertCommitRequest>
|
|
for RevertCommitSvc<T> {
|
|
type Response = super::CreateCommitResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::RevertCommitRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as CommitService>::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<T: CommitService>(pub Arc<T>);
|
|
impl<
|
|
T: CommitService,
|
|
> tonic::server::UnaryService<super::CherryPickCommitRequest>
|
|
for CherryPickCommitSvc<T> {
|
|
type Response = super::CreateCommitResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::CherryPickCommitRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as CommitService>::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<T: CommitService>(pub Arc<T>);
|
|
impl<
|
|
T: CommitService,
|
|
> tonic::server::UnaryService<super::CompareCommitsRequest>
|
|
for CompareCommitsSvc<T> {
|
|
type Response = super::CompareCommitsResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::CompareCommitsRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as CommitService>::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<T> Clone for CommitServiceServer<T> {
|
|
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<T> tonic::server::NamedService for CommitServiceServer<T> {
|
|
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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub revision: ::core::option::Option<ObjectSelector>,
|
|
#[prost(string, tag = "3")]
|
|
pub path: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub range: ::core::option::Option<LineRange>,
|
|
#[prost(message, optional, tag = "5")]
|
|
pub options: ::core::option::Option<BlameOptions>,
|
|
#[prost(message, optional, tag = "6")]
|
|
pub pagination: ::core::option::Option<Pagination>,
|
|
}
|
|
#[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<u8>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct BlameHunk {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub commit: ::core::option::Option<Commit>,
|
|
#[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<BlameLine>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct BlameResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub hunks: ::prost::alloc::vec::Vec<BlameHunk>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub page_info: ::core::option::Option<PageInfo>,
|
|
#[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<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl BlameServiceClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
|
|
where
|
|
D: TryInto<tonic::transport::Endpoint>,
|
|
D::Error: Into<StdError>,
|
|
{
|
|
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
|
|
Ok(Self::new(conn))
|
|
}
|
|
}
|
|
impl<T> BlameServiceClient<T>
|
|
where
|
|
T: tonic::client::GrpcService<tonic::body::BoxBody>,
|
|
T::Error: Into<StdError>,
|
|
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
|
|
<T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> BlameServiceClient<InterceptedService<T, F>>
|
|
where
|
|
F: tonic::service::Interceptor,
|
|
T::ResponseBody: Default,
|
|
T: tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
Response = http::Response<
|
|
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
|
|
>,
|
|
>,
|
|
<T as tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
>>::Error: Into<StdError> + 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<super::BlameRequest>,
|
|
) -> std::result::Result<tonic::Response<super::BlameResponse>, 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<super::BlameRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<tonic::codec::Streaming<super::BlameHunk>>,
|
|
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<super::BlameRequest>,
|
|
) -> std::result::Result<tonic::Response<super::BlameResponse>, tonic::Status>;
|
|
/// Server streaming response type for the StreamBlame method.
|
|
type StreamBlameStream: tonic::codegen::tokio_stream::Stream<
|
|
Item = std::result::Result<super::BlameHunk, tonic::Status>,
|
|
>
|
|
+ std::marker::Send
|
|
+ 'static;
|
|
async fn stream_blame(
|
|
&self,
|
|
request: tonic::Request<super::BlameRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<Self::StreamBlameStream>,
|
|
tonic::Status,
|
|
>;
|
|
}
|
|
#[derive(Debug)]
|
|
pub struct BlameServiceServer<T> {
|
|
inner: Arc<T>,
|
|
accept_compression_encodings: EnabledCompressionEncodings,
|
|
send_compression_encodings: EnabledCompressionEncodings,
|
|
max_decoding_message_size: Option<usize>,
|
|
max_encoding_message_size: Option<usize>,
|
|
}
|
|
impl<T> BlameServiceServer<T> {
|
|
pub fn new(inner: T) -> Self {
|
|
Self::from_arc(Arc::new(inner))
|
|
}
|
|
pub fn from_arc(inner: Arc<T>) -> 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> InterceptedService<Self, F>
|
|
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<T, B> tonic::codegen::Service<http::Request<B>> for BlameServiceServer<T>
|
|
where
|
|
T: BlameService,
|
|
B: Body + std::marker::Send + 'static,
|
|
B::Error: Into<StdError> + std::marker::Send + 'static,
|
|
{
|
|
type Response = http::Response<tonic::body::BoxBody>;
|
|
type Error = std::convert::Infallible;
|
|
type Future = BoxFuture<Self::Response, Self::Error>;
|
|
fn poll_ready(
|
|
&mut self,
|
|
_cx: &mut Context<'_>,
|
|
) -> Poll<std::result::Result<(), Self::Error>> {
|
|
Poll::Ready(Ok(()))
|
|
}
|
|
fn call(&mut self, req: http::Request<B>) -> Self::Future {
|
|
match req.uri().path() {
|
|
"/gitks.BlameService/Blame" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct BlameSvc<T: BlameService>(pub Arc<T>);
|
|
impl<
|
|
T: BlameService,
|
|
> tonic::server::UnaryService<super::BlameRequest> for BlameSvc<T> {
|
|
type Response = super::BlameResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::BlameRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as BlameService>::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<T: BlameService>(pub Arc<T>);
|
|
impl<
|
|
T: BlameService,
|
|
> tonic::server::ServerStreamingService<super::BlameRequest>
|
|
for StreamBlameSvc<T> {
|
|
type Response = super::BlameHunk;
|
|
type ResponseStream = T::StreamBlameStream;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::ResponseStream>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::BlameRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as BlameService>::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<T> Clone for BlameServiceServer<T> {
|
|
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<T> tonic::server::NamedService for BlameServiceServer<T> {
|
|
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<Oid>,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub commit: ::core::option::Option<Commit>,
|
|
#[prost(message, optional, tag = "5")]
|
|
pub upstream: ::core::option::Option<BranchUpstream>,
|
|
#[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<PayloadCommit>,
|
|
#[prost(string, tag = "2")]
|
|
pub name: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub upstream: ::core::option::Option<BranchUpstream>,
|
|
#[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<RepositoryHeader>,
|
|
#[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<Pagination>,
|
|
#[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<Branch>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub page_info: ::core::option::Option<PageInfo>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetBranchRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(string, tag = "2")]
|
|
pub name: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub start_point: ::core::option::Option<ObjectSelector>,
|
|
#[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<RepositoryHeader>,
|
|
#[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<RepositoryHeader>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(string, tag = "2")]
|
|
pub name: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub expected_old_oid: ::core::option::Option<Oid>,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub new_oid: ::core::option::Option<Oid>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(string, tag = "2")]
|
|
pub name: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub upstream: ::core::option::Option<BranchUpstream>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct CompareBranchRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
#[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<Oid>,
|
|
}
|
|
/// 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<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl BranchServiceClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
|
|
where
|
|
D: TryInto<tonic::transport::Endpoint>,
|
|
D::Error: Into<StdError>,
|
|
{
|
|
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
|
|
Ok(Self::new(conn))
|
|
}
|
|
}
|
|
impl<T> BranchServiceClient<T>
|
|
where
|
|
T: tonic::client::GrpcService<tonic::body::BoxBody>,
|
|
T::Error: Into<StdError>,
|
|
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
|
|
<T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> BranchServiceClient<InterceptedService<T, F>>
|
|
where
|
|
F: tonic::service::Interceptor,
|
|
T::ResponseBody: Default,
|
|
T: tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
Response = http::Response<
|
|
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
|
|
>,
|
|
>,
|
|
<T as tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
>>::Error: Into<StdError> + 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<super::ListBranchesRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListBranchesResponse>,
|
|
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<super::GetBranchRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Branch>, 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<super::CreateBranchRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Branch>, 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<super::DeleteBranchRequest>,
|
|
) -> 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/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<super::RenameBranchRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Branch>, 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<super::UpdateBranchTargetRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Branch>, 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<super::SetBranchUpstreamRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Branch>, 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<super::CompareBranchRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::CompareBranchResponse>,
|
|
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<super::ListBranchesRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListBranchesResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn get_branch(
|
|
&self,
|
|
request: tonic::Request<super::GetBranchRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Branch>, tonic::Status>;
|
|
async fn create_branch(
|
|
&self,
|
|
request: tonic::Request<super::CreateBranchRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Branch>, tonic::Status>;
|
|
async fn delete_branch(
|
|
&self,
|
|
request: tonic::Request<super::DeleteBranchRequest>,
|
|
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
|
|
async fn rename_branch(
|
|
&self,
|
|
request: tonic::Request<super::RenameBranchRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Branch>, tonic::Status>;
|
|
async fn update_branch_target(
|
|
&self,
|
|
request: tonic::Request<super::UpdateBranchTargetRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Branch>, tonic::Status>;
|
|
async fn set_branch_upstream(
|
|
&self,
|
|
request: tonic::Request<super::SetBranchUpstreamRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Branch>, tonic::Status>;
|
|
async fn compare_branch(
|
|
&self,
|
|
request: tonic::Request<super::CompareBranchRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::CompareBranchResponse>,
|
|
tonic::Status,
|
|
>;
|
|
}
|
|
#[derive(Debug)]
|
|
pub struct BranchServiceServer<T> {
|
|
inner: Arc<T>,
|
|
accept_compression_encodings: EnabledCompressionEncodings,
|
|
send_compression_encodings: EnabledCompressionEncodings,
|
|
max_decoding_message_size: Option<usize>,
|
|
max_encoding_message_size: Option<usize>,
|
|
}
|
|
impl<T> BranchServiceServer<T> {
|
|
pub fn new(inner: T) -> Self {
|
|
Self::from_arc(Arc::new(inner))
|
|
}
|
|
pub fn from_arc(inner: Arc<T>) -> 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> InterceptedService<Self, F>
|
|
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<T, B> tonic::codegen::Service<http::Request<B>> for BranchServiceServer<T>
|
|
where
|
|
T: BranchService,
|
|
B: Body + std::marker::Send + 'static,
|
|
B::Error: Into<StdError> + std::marker::Send + 'static,
|
|
{
|
|
type Response = http::Response<tonic::body::BoxBody>;
|
|
type Error = std::convert::Infallible;
|
|
type Future = BoxFuture<Self::Response, Self::Error>;
|
|
fn poll_ready(
|
|
&mut self,
|
|
_cx: &mut Context<'_>,
|
|
) -> Poll<std::result::Result<(), Self::Error>> {
|
|
Poll::Ready(Ok(()))
|
|
}
|
|
fn call(&mut self, req: http::Request<B>) -> Self::Future {
|
|
match req.uri().path() {
|
|
"/gitks.BranchService/ListBranches" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct ListBranchesSvc<T: BranchService>(pub Arc<T>);
|
|
impl<
|
|
T: BranchService,
|
|
> tonic::server::UnaryService<super::ListBranchesRequest>
|
|
for ListBranchesSvc<T> {
|
|
type Response = super::ListBranchesResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ListBranchesRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as BranchService>::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<T: BranchService>(pub Arc<T>);
|
|
impl<
|
|
T: BranchService,
|
|
> tonic::server::UnaryService<super::GetBranchRequest>
|
|
for GetBranchSvc<T> {
|
|
type Response = super::Branch;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetBranchRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as BranchService>::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<T: BranchService>(pub Arc<T>);
|
|
impl<
|
|
T: BranchService,
|
|
> tonic::server::UnaryService<super::CreateBranchRequest>
|
|
for CreateBranchSvc<T> {
|
|
type Response = super::Branch;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::CreateBranchRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as BranchService>::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<T: BranchService>(pub Arc<T>);
|
|
impl<
|
|
T: BranchService,
|
|
> tonic::server::UnaryService<super::DeleteBranchRequest>
|
|
for DeleteBranchSvc<T> {
|
|
type Response = ();
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::DeleteBranchRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as BranchService>::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<T: BranchService>(pub Arc<T>);
|
|
impl<
|
|
T: BranchService,
|
|
> tonic::server::UnaryService<super::RenameBranchRequest>
|
|
for RenameBranchSvc<T> {
|
|
type Response = super::Branch;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::RenameBranchRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as BranchService>::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<T: BranchService>(pub Arc<T>);
|
|
impl<
|
|
T: BranchService,
|
|
> tonic::server::UnaryService<super::UpdateBranchTargetRequest>
|
|
for UpdateBranchTargetSvc<T> {
|
|
type Response = super::Branch;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::UpdateBranchTargetRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as BranchService>::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<T: BranchService>(pub Arc<T>);
|
|
impl<
|
|
T: BranchService,
|
|
> tonic::server::UnaryService<super::SetBranchUpstreamRequest>
|
|
for SetBranchUpstreamSvc<T> {
|
|
type Response = super::Branch;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::SetBranchUpstreamRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as BranchService>::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<T: BranchService>(pub Arc<T>);
|
|
impl<
|
|
T: BranchService,
|
|
> tonic::server::UnaryService<super::CompareBranchRequest>
|
|
for CompareBranchSvc<T> {
|
|
type Response = super::CompareBranchResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::CompareBranchRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as BranchService>::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<T> Clone for BranchServiceServer<T> {
|
|
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<T> tonic::server::NamedService for BranchServiceServer<T> {
|
|
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<Self> {
|
|
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<u8>,
|
|
#[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<Self> {
|
|
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<DiffLine>,
|
|
}
|
|
#[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<Oid>,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub new_oid: ::core::option::Option<Oid>,
|
|
#[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<DiffHunk>,
|
|
#[prost(bytes = "vec", tag = "13")]
|
|
pub patch: ::prost::alloc::vec::Vec<u8>,
|
|
#[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<Self> {
|
|
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<DiffFile>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub stats: ::core::option::Option<DiffStats>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub base: ::core::option::Option<ObjectSelector>,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub head: ::core::option::Option<ObjectSelector>,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub options: ::core::option::Option<DiffOptions>,
|
|
#[prost(message, optional, tag = "5")]
|
|
pub pagination: ::core::option::Option<Pagination>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetDiffResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub files: ::prost::alloc::vec::Vec<DiffFile>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub stats: ::core::option::Option<DiffStats>,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub page_info: ::core::option::Option<PageInfo>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub commit: ::core::option::Option<ObjectSelector>,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub options: ::core::option::Option<DiffOptions>,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub pagination: ::core::option::Option<Pagination>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetPatchRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub base: ::core::option::Option<ObjectSelector>,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub head: ::core::option::Option<ObjectSelector>,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub options: ::core::option::Option<DiffOptions>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetPatchResponse {
|
|
#[prost(bytes = "vec", tag = "1")]
|
|
pub data: ::prost::alloc::vec::Vec<u8>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetDiffStatsRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub base: ::core::option::Option<ObjectSelector>,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub head: ::core::option::Option<ObjectSelector>,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub options: ::core::option::Option<DiffOptions>,
|
|
}
|
|
/// 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<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl DiffServiceClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
|
|
where
|
|
D: TryInto<tonic::transport::Endpoint>,
|
|
D::Error: Into<StdError>,
|
|
{
|
|
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
|
|
Ok(Self::new(conn))
|
|
}
|
|
}
|
|
impl<T> DiffServiceClient<T>
|
|
where
|
|
T: tonic::client::GrpcService<tonic::body::BoxBody>,
|
|
T::Error: Into<StdError>,
|
|
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
|
|
<T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> DiffServiceClient<InterceptedService<T, F>>
|
|
where
|
|
F: tonic::service::Interceptor,
|
|
T::ResponseBody: Default,
|
|
T: tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
Response = http::Response<
|
|
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
|
|
>,
|
|
>,
|
|
<T as tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
>>::Error: Into<StdError> + 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<super::GetDiffRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::GetDiffResponse>,
|
|
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<super::GetCommitDiffRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::GetDiffResponse>,
|
|
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<super::GetPatchRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<tonic::codec::Streaming<super::GetPatchResponse>>,
|
|
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<super::GetDiffStatsRequest>,
|
|
) -> std::result::Result<tonic::Response<super::DiffStats>, 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<super::GetDiffRequest>,
|
|
) -> std::result::Result<tonic::Response<super::GetDiffResponse>, tonic::Status>;
|
|
async fn get_commit_diff(
|
|
&self,
|
|
request: tonic::Request<super::GetCommitDiffRequest>,
|
|
) -> std::result::Result<tonic::Response<super::GetDiffResponse>, tonic::Status>;
|
|
/// Server streaming response type for the GetPatch method.
|
|
type GetPatchStream: tonic::codegen::tokio_stream::Stream<
|
|
Item = std::result::Result<super::GetPatchResponse, tonic::Status>,
|
|
>
|
|
+ std::marker::Send
|
|
+ 'static;
|
|
async fn get_patch(
|
|
&self,
|
|
request: tonic::Request<super::GetPatchRequest>,
|
|
) -> std::result::Result<tonic::Response<Self::GetPatchStream>, tonic::Status>;
|
|
async fn get_diff_stats(
|
|
&self,
|
|
request: tonic::Request<super::GetDiffStatsRequest>,
|
|
) -> std::result::Result<tonic::Response<super::DiffStats>, tonic::Status>;
|
|
}
|
|
#[derive(Debug)]
|
|
pub struct DiffServiceServer<T> {
|
|
inner: Arc<T>,
|
|
accept_compression_encodings: EnabledCompressionEncodings,
|
|
send_compression_encodings: EnabledCompressionEncodings,
|
|
max_decoding_message_size: Option<usize>,
|
|
max_encoding_message_size: Option<usize>,
|
|
}
|
|
impl<T> DiffServiceServer<T> {
|
|
pub fn new(inner: T) -> Self {
|
|
Self::from_arc(Arc::new(inner))
|
|
}
|
|
pub fn from_arc(inner: Arc<T>) -> 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> InterceptedService<Self, F>
|
|
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<T, B> tonic::codegen::Service<http::Request<B>> for DiffServiceServer<T>
|
|
where
|
|
T: DiffService,
|
|
B: Body + std::marker::Send + 'static,
|
|
B::Error: Into<StdError> + std::marker::Send + 'static,
|
|
{
|
|
type Response = http::Response<tonic::body::BoxBody>;
|
|
type Error = std::convert::Infallible;
|
|
type Future = BoxFuture<Self::Response, Self::Error>;
|
|
fn poll_ready(
|
|
&mut self,
|
|
_cx: &mut Context<'_>,
|
|
) -> Poll<std::result::Result<(), Self::Error>> {
|
|
Poll::Ready(Ok(()))
|
|
}
|
|
fn call(&mut self, req: http::Request<B>) -> Self::Future {
|
|
match req.uri().path() {
|
|
"/gitks.DiffService/GetDiff" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct GetDiffSvc<T: DiffService>(pub Arc<T>);
|
|
impl<
|
|
T: DiffService,
|
|
> tonic::server::UnaryService<super::GetDiffRequest>
|
|
for GetDiffSvc<T> {
|
|
type Response = super::GetDiffResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetDiffRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as DiffService>::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<T: DiffService>(pub Arc<T>);
|
|
impl<
|
|
T: DiffService,
|
|
> tonic::server::UnaryService<super::GetCommitDiffRequest>
|
|
for GetCommitDiffSvc<T> {
|
|
type Response = super::GetDiffResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetCommitDiffRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as DiffService>::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<T: DiffService>(pub Arc<T>);
|
|
impl<
|
|
T: DiffService,
|
|
> tonic::server::ServerStreamingService<super::GetPatchRequest>
|
|
for GetPatchSvc<T> {
|
|
type Response = super::GetPatchResponse;
|
|
type ResponseStream = T::GetPatchStream;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::ResponseStream>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetPatchRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as DiffService>::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<T: DiffService>(pub Arc<T>);
|
|
impl<
|
|
T: DiffService,
|
|
> tonic::server::UnaryService<super::GetDiffStatsRequest>
|
|
for GetDiffStatsSvc<T> {
|
|
type Response = super::DiffStats;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetDiffStatsRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as DiffService>::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<T> Clone for DiffServiceServer<T> {
|
|
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<T> tonic::server::NamedService for DiffServiceServer<T> {
|
|
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<Self> {
|
|
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<Self> {
|
|
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<u8>,
|
|
}
|
|
#[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<Oid>,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub ours_oid: ::core::option::Option<Oid>,
|
|
#[prost(message, optional, tag = "5")]
|
|
pub theirs_oid: ::core::option::Option<Oid>,
|
|
#[prost(message, repeated, tag = "6")]
|
|
pub sections: ::prost::alloc::vec::Vec<MergeConflictSection>,
|
|
#[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<Commit>,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub merge_base: ::core::option::Option<Oid>,
|
|
#[prost(message, repeated, tag = "4")]
|
|
pub conflicts: ::prost::alloc::vec::Vec<MergeConflict>,
|
|
#[prost(message, optional, tag = "5")]
|
|
pub stats: ::core::option::Option<DiffStats>,
|
|
#[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<Self> {
|
|
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<RepositoryHeader>,
|
|
#[prost(string, tag = "2")]
|
|
pub target_branch: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub source: ::core::option::Option<ObjectSelector>,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub committer: ::core::option::Option<Signature>,
|
|
#[prost(string, tag = "5")]
|
|
pub message: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "6")]
|
|
pub options: ::core::option::Option<MergeOptions>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct CheckMergeRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub target: ::core::option::Option<ObjectSelector>,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub source: ::core::option::Option<ObjectSelector>,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub options: ::core::option::Option<MergeOptions>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ListMergeConflictsRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub target: ::core::option::Option<ObjectSelector>,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub source: ::core::option::Option<ObjectSelector>,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub pagination: ::core::option::Option<Pagination>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ListMergeConflictsResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub conflicts: ::prost::alloc::vec::Vec<MergeConflict>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub page_info: ::core::option::Option<PageInfo>,
|
|
}
|
|
#[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<u8>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ResolveMergeConflictsRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
#[prost(string, tag = "2")]
|
|
pub target_branch: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub source: ::core::option::Option<ObjectSelector>,
|
|
#[prost(message, repeated, tag = "4")]
|
|
pub resolutions: ::prost::alloc::vec::Vec<ResolveMergeConflict>,
|
|
#[prost(message, optional, tag = "5")]
|
|
pub committer: ::core::option::Option<Signature>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(string, tag = "2")]
|
|
pub branch: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub upstream: ::core::option::Option<ObjectSelector>,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub committer: ::core::option::Option<Signature>,
|
|
}
|
|
#[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<Commit>,
|
|
#[prost(message, repeated, tag = "3")]
|
|
pub conflicts: ::prost::alloc::vec::Vec<MergeConflict>,
|
|
}
|
|
/// 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<Self> {
|
|
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<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl MergeServiceClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
|
|
where
|
|
D: TryInto<tonic::transport::Endpoint>,
|
|
D::Error: Into<StdError>,
|
|
{
|
|
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
|
|
Ok(Self::new(conn))
|
|
}
|
|
}
|
|
impl<T> MergeServiceClient<T>
|
|
where
|
|
T: tonic::client::GrpcService<tonic::body::BoxBody>,
|
|
T::Error: Into<StdError>,
|
|
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
|
|
<T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> MergeServiceClient<InterceptedService<T, F>>
|
|
where
|
|
F: tonic::service::Interceptor,
|
|
T::ResponseBody: Default,
|
|
T: tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
Response = http::Response<
|
|
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
|
|
>,
|
|
>,
|
|
<T as tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
>>::Error: Into<StdError> + 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<super::CheckMergeRequest>,
|
|
) -> std::result::Result<tonic::Response<super::MergeResult>, 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<super::MergeRequest>,
|
|
) -> std::result::Result<tonic::Response<super::MergeResult>, 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<super::ListMergeConflictsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListMergeConflictsResponse>,
|
|
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<super::ResolveMergeConflictsRequest>,
|
|
) -> std::result::Result<tonic::Response<super::MergeResult>, 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<super::RebaseRequest>,
|
|
) -> std::result::Result<tonic::Response<super::RebaseResult>, 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<super::CheckMergeRequest>,
|
|
) -> std::result::Result<tonic::Response<super::MergeResult>, tonic::Status>;
|
|
async fn merge(
|
|
&self,
|
|
request: tonic::Request<super::MergeRequest>,
|
|
) -> std::result::Result<tonic::Response<super::MergeResult>, tonic::Status>;
|
|
async fn list_merge_conflicts(
|
|
&self,
|
|
request: tonic::Request<super::ListMergeConflictsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListMergeConflictsResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn resolve_merge_conflicts(
|
|
&self,
|
|
request: tonic::Request<super::ResolveMergeConflictsRequest>,
|
|
) -> std::result::Result<tonic::Response<super::MergeResult>, tonic::Status>;
|
|
async fn rebase(
|
|
&self,
|
|
request: tonic::Request<super::RebaseRequest>,
|
|
) -> std::result::Result<tonic::Response<super::RebaseResult>, tonic::Status>;
|
|
}
|
|
#[derive(Debug)]
|
|
pub struct MergeServiceServer<T> {
|
|
inner: Arc<T>,
|
|
accept_compression_encodings: EnabledCompressionEncodings,
|
|
send_compression_encodings: EnabledCompressionEncodings,
|
|
max_decoding_message_size: Option<usize>,
|
|
max_encoding_message_size: Option<usize>,
|
|
}
|
|
impl<T> MergeServiceServer<T> {
|
|
pub fn new(inner: T) -> Self {
|
|
Self::from_arc(Arc::new(inner))
|
|
}
|
|
pub fn from_arc(inner: Arc<T>) -> 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> InterceptedService<Self, F>
|
|
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<T, B> tonic::codegen::Service<http::Request<B>> for MergeServiceServer<T>
|
|
where
|
|
T: MergeService,
|
|
B: Body + std::marker::Send + 'static,
|
|
B::Error: Into<StdError> + std::marker::Send + 'static,
|
|
{
|
|
type Response = http::Response<tonic::body::BoxBody>;
|
|
type Error = std::convert::Infallible;
|
|
type Future = BoxFuture<Self::Response, Self::Error>;
|
|
fn poll_ready(
|
|
&mut self,
|
|
_cx: &mut Context<'_>,
|
|
) -> Poll<std::result::Result<(), Self::Error>> {
|
|
Poll::Ready(Ok(()))
|
|
}
|
|
fn call(&mut self, req: http::Request<B>) -> Self::Future {
|
|
match req.uri().path() {
|
|
"/gitks.MergeService/CheckMerge" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct CheckMergeSvc<T: MergeService>(pub Arc<T>);
|
|
impl<
|
|
T: MergeService,
|
|
> tonic::server::UnaryService<super::CheckMergeRequest>
|
|
for CheckMergeSvc<T> {
|
|
type Response = super::MergeResult;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::CheckMergeRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as MergeService>::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<T: MergeService>(pub Arc<T>);
|
|
impl<
|
|
T: MergeService,
|
|
> tonic::server::UnaryService<super::MergeRequest> for MergeSvc<T> {
|
|
type Response = super::MergeResult;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::MergeRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as MergeService>::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<T: MergeService>(pub Arc<T>);
|
|
impl<
|
|
T: MergeService,
|
|
> tonic::server::UnaryService<super::ListMergeConflictsRequest>
|
|
for ListMergeConflictsSvc<T> {
|
|
type Response = super::ListMergeConflictsResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ListMergeConflictsRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as MergeService>::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<T: MergeService>(pub Arc<T>);
|
|
impl<
|
|
T: MergeService,
|
|
> tonic::server::UnaryService<super::ResolveMergeConflictsRequest>
|
|
for ResolveMergeConflictsSvc<T> {
|
|
type Response = super::MergeResult;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ResolveMergeConflictsRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as MergeService>::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<T: MergeService>(pub Arc<T>);
|
|
impl<
|
|
T: MergeService,
|
|
> tonic::server::UnaryService<super::RebaseRequest>
|
|
for RebaseSvc<T> {
|
|
type Response = super::RebaseResult;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::RebaseRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as MergeService>::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<T> Clone for MergeServiceServer<T> {
|
|
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<T> tonic::server::NamedService for MergeServiceServer<T> {
|
|
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<Oid>,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub peeled_oid: ::core::option::Option<Oid>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub protocol: ::core::option::Option<GitProtocolFeatures>,
|
|
#[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<ReferenceAdvertisement>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub protocol: ::core::option::Option<GitProtocolFeatures>,
|
|
#[prost(bytes = "vec", tag = "3")]
|
|
pub packet: ::prost::alloc::vec::Vec<u8>,
|
|
#[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<u8>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub protocol: ::core::option::Option<GitProtocolFeatures>,
|
|
#[prost(bytes = "vec", tag = "3")]
|
|
pub packet: ::prost::alloc::vec::Vec<u8>,
|
|
#[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<u8>,
|
|
#[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<Oid>,
|
|
#[prost(message, repeated, tag = "2")]
|
|
pub haves: ::prost::alloc::vec::Vec<Oid>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub options: ::core::option::Option<PackObjectsOptions>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct PackfileChunk {
|
|
#[prost(bytes = "vec", tag = "1")]
|
|
pub data: ::prost::alloc::vec::Vec<u8>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct IndexPackRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
#[prost(bytes = "vec", tag = "2")]
|
|
pub data: ::prost::alloc::vec::Vec<u8>,
|
|
#[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<Oid>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub pagination: ::core::option::Option<Pagination>,
|
|
}
|
|
#[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<Oid>,
|
|
#[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<PackfileInfo>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub page_info: ::core::option::Option<PageInfo>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct FsckRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
#[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<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl PackServiceClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
|
|
where
|
|
D: TryInto<tonic::transport::Endpoint>,
|
|
D::Error: Into<StdError>,
|
|
{
|
|
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
|
|
Ok(Self::new(conn))
|
|
}
|
|
}
|
|
impl<T> PackServiceClient<T>
|
|
where
|
|
T: tonic::client::GrpcService<tonic::body::BoxBody>,
|
|
T::Error: Into<StdError>,
|
|
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
|
|
<T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> PackServiceClient<InterceptedService<T, F>>
|
|
where
|
|
F: tonic::service::Interceptor,
|
|
T::ResponseBody: Default,
|
|
T: tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
Response = http::Response<
|
|
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
|
|
>,
|
|
>,
|
|
<T as tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
>>::Error: Into<StdError> + 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<super::AdvertiseRefsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::AdvertiseRefsResponse>,
|
|
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<Message = super::UploadPackRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<tonic::codec::Streaming<super::UploadPackResponse>>,
|
|
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::codec::Streaming<super::ReceivePackResponse>>,
|
|
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<super::PackObjectsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<tonic::codec::Streaming<super::PackfileChunk>>,
|
|
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<Message = super::IndexPackRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::IndexPackResponse>,
|
|
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<super::ListPackfilesRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListPackfilesResponse>,
|
|
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<super::FsckRequest>,
|
|
) -> std::result::Result<tonic::Response<super::FsckResponse>, 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<super::AdvertiseRefsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::AdvertiseRefsResponse>,
|
|
tonic::Status,
|
|
>;
|
|
/// Server streaming response type for the UploadPack method.
|
|
type UploadPackStream: tonic::codegen::tokio_stream::Stream<
|
|
Item = std::result::Result<super::UploadPackResponse, tonic::Status>,
|
|
>
|
|
+ std::marker::Send
|
|
+ 'static;
|
|
async fn upload_pack(
|
|
&self,
|
|
request: tonic::Request<tonic::Streaming<super::UploadPackRequest>>,
|
|
) -> std::result::Result<tonic::Response<Self::UploadPackStream>, tonic::Status>;
|
|
/// Server streaming response type for the ReceivePack method.
|
|
type ReceivePackStream: tonic::codegen::tokio_stream::Stream<
|
|
Item = std::result::Result<super::ReceivePackResponse, tonic::Status>,
|
|
>
|
|
+ std::marker::Send
|
|
+ 'static;
|
|
async fn receive_pack(
|
|
&self,
|
|
request: tonic::Request<tonic::Streaming<super::ReceivePackRequest>>,
|
|
) -> std::result::Result<
|
|
tonic::Response<Self::ReceivePackStream>,
|
|
tonic::Status,
|
|
>;
|
|
/// Server streaming response type for the PackObjects method.
|
|
type PackObjectsStream: tonic::codegen::tokio_stream::Stream<
|
|
Item = std::result::Result<super::PackfileChunk, tonic::Status>,
|
|
>
|
|
+ std::marker::Send
|
|
+ 'static;
|
|
async fn pack_objects(
|
|
&self,
|
|
request: tonic::Request<super::PackObjectsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<Self::PackObjectsStream>,
|
|
tonic::Status,
|
|
>;
|
|
async fn index_pack(
|
|
&self,
|
|
request: tonic::Request<tonic::Streaming<super::IndexPackRequest>>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::IndexPackResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn list_packfiles(
|
|
&self,
|
|
request: tonic::Request<super::ListPackfilesRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListPackfilesResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn fsck(
|
|
&self,
|
|
request: tonic::Request<super::FsckRequest>,
|
|
) -> std::result::Result<tonic::Response<super::FsckResponse>, tonic::Status>;
|
|
}
|
|
#[derive(Debug)]
|
|
pub struct PackServiceServer<T> {
|
|
inner: Arc<T>,
|
|
accept_compression_encodings: EnabledCompressionEncodings,
|
|
send_compression_encodings: EnabledCompressionEncodings,
|
|
max_decoding_message_size: Option<usize>,
|
|
max_encoding_message_size: Option<usize>,
|
|
}
|
|
impl<T> PackServiceServer<T> {
|
|
pub fn new(inner: T) -> Self {
|
|
Self::from_arc(Arc::new(inner))
|
|
}
|
|
pub fn from_arc(inner: Arc<T>) -> 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> InterceptedService<Self, F>
|
|
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<T, B> tonic::codegen::Service<http::Request<B>> for PackServiceServer<T>
|
|
where
|
|
T: PackService,
|
|
B: Body + std::marker::Send + 'static,
|
|
B::Error: Into<StdError> + std::marker::Send + 'static,
|
|
{
|
|
type Response = http::Response<tonic::body::BoxBody>;
|
|
type Error = std::convert::Infallible;
|
|
type Future = BoxFuture<Self::Response, Self::Error>;
|
|
fn poll_ready(
|
|
&mut self,
|
|
_cx: &mut Context<'_>,
|
|
) -> Poll<std::result::Result<(), Self::Error>> {
|
|
Poll::Ready(Ok(()))
|
|
}
|
|
fn call(&mut self, req: http::Request<B>) -> Self::Future {
|
|
match req.uri().path() {
|
|
"/gitks.PackService/AdvertiseRefs" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct AdvertiseRefsSvc<T: PackService>(pub Arc<T>);
|
|
impl<
|
|
T: PackService,
|
|
> tonic::server::UnaryService<super::AdvertiseRefsRequest>
|
|
for AdvertiseRefsSvc<T> {
|
|
type Response = super::AdvertiseRefsResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::AdvertiseRefsRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as PackService>::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<T: PackService>(pub Arc<T>);
|
|
impl<
|
|
T: PackService,
|
|
> tonic::server::StreamingService<super::UploadPackRequest>
|
|
for UploadPackSvc<T> {
|
|
type Response = super::UploadPackResponse;
|
|
type ResponseStream = T::UploadPackStream;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::ResponseStream>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<
|
|
tonic::Streaming<super::UploadPackRequest>,
|
|
>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as PackService>::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<T: PackService>(pub Arc<T>);
|
|
impl<
|
|
T: PackService,
|
|
> tonic::server::StreamingService<super::ReceivePackRequest>
|
|
for ReceivePackSvc<T> {
|
|
type Response = super::ReceivePackResponse;
|
|
type ResponseStream = T::ReceivePackStream;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::ResponseStream>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<
|
|
tonic::Streaming<super::ReceivePackRequest>,
|
|
>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as PackService>::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<T: PackService>(pub Arc<T>);
|
|
impl<
|
|
T: PackService,
|
|
> tonic::server::ServerStreamingService<super::PackObjectsRequest>
|
|
for PackObjectsSvc<T> {
|
|
type Response = super::PackfileChunk;
|
|
type ResponseStream = T::PackObjectsStream;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::ResponseStream>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::PackObjectsRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as PackService>::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<T: PackService>(pub Arc<T>);
|
|
impl<
|
|
T: PackService,
|
|
> tonic::server::ClientStreamingService<super::IndexPackRequest>
|
|
for IndexPackSvc<T> {
|
|
type Response = super::IndexPackResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<
|
|
tonic::Streaming<super::IndexPackRequest>,
|
|
>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as PackService>::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<T: PackService>(pub Arc<T>);
|
|
impl<
|
|
T: PackService,
|
|
> tonic::server::UnaryService<super::ListPackfilesRequest>
|
|
for ListPackfilesSvc<T> {
|
|
type Response = super::ListPackfilesResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ListPackfilesRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as PackService>::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<T: PackService>(pub Arc<T>);
|
|
impl<T: PackService> tonic::server::UnaryService<super::FsckRequest>
|
|
for FsckSvc<T> {
|
|
type Response = super::FsckResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::FsckRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as PackService>::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<T> Clone for PackServiceServer<T> {
|
|
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<T> tonic::server::NamedService for PackServiceServer<T> {
|
|
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<Oid>,
|
|
#[prost(enumeration = "ObjectType", tag = "4")]
|
|
pub target_type: i32,
|
|
#[prost(message, optional, tag = "5")]
|
|
pub tag_oid: ::core::option::Option<Oid>,
|
|
#[prost(bool, tag = "6")]
|
|
pub annotated: bool,
|
|
#[prost(message, optional, tag = "7")]
|
|
pub tagger: ::core::option::Option<Signature>,
|
|
#[prost(string, tag = "8")]
|
|
pub message: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "9")]
|
|
pub signature: ::core::option::Option<VerifiedSignature>,
|
|
#[prost(bytes = "vec", tag = "10")]
|
|
pub raw: ::prost::alloc::vec::Vec<u8>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ListTagsRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
#[prost(string, tag = "2")]
|
|
pub pattern: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub pagination: ::core::option::Option<Pagination>,
|
|
#[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<Tag>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub page_info: ::core::option::Option<PageInfo>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetTagRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(string, tag = "2")]
|
|
pub name: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub target: ::core::option::Option<ObjectSelector>,
|
|
#[prost(string, tag = "4")]
|
|
pub message: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "5")]
|
|
pub tagger: ::core::option::Option<Signature>,
|
|
#[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<RepositoryHeader>,
|
|
#[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<RepositoryHeader>,
|
|
#[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<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl TagServiceClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
|
|
where
|
|
D: TryInto<tonic::transport::Endpoint>,
|
|
D::Error: Into<StdError>,
|
|
{
|
|
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
|
|
Ok(Self::new(conn))
|
|
}
|
|
}
|
|
impl<T> TagServiceClient<T>
|
|
where
|
|
T: tonic::client::GrpcService<tonic::body::BoxBody>,
|
|
T::Error: Into<StdError>,
|
|
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
|
|
<T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> TagServiceClient<InterceptedService<T, F>>
|
|
where
|
|
F: tonic::service::Interceptor,
|
|
T::ResponseBody: Default,
|
|
T: tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
Response = http::Response<
|
|
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
|
|
>,
|
|
>,
|
|
<T as tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
>>::Error: Into<StdError> + 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<super::ListTagsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListTagsResponse>,
|
|
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<super::GetTagRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Tag>, 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<super::CreateTagRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Tag>, 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<super::DeleteTagRequest>,
|
|
) -> 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/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<super::VerifyTagRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::VerifiedSignature>,
|
|
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<super::ListTagsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListTagsResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn get_tag(
|
|
&self,
|
|
request: tonic::Request<super::GetTagRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Tag>, tonic::Status>;
|
|
async fn create_tag(
|
|
&self,
|
|
request: tonic::Request<super::CreateTagRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Tag>, tonic::Status>;
|
|
async fn delete_tag(
|
|
&self,
|
|
request: tonic::Request<super::DeleteTagRequest>,
|
|
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
|
|
async fn verify_tag(
|
|
&self,
|
|
request: tonic::Request<super::VerifyTagRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::VerifiedSignature>,
|
|
tonic::Status,
|
|
>;
|
|
}
|
|
#[derive(Debug)]
|
|
pub struct TagServiceServer<T> {
|
|
inner: Arc<T>,
|
|
accept_compression_encodings: EnabledCompressionEncodings,
|
|
send_compression_encodings: EnabledCompressionEncodings,
|
|
max_decoding_message_size: Option<usize>,
|
|
max_encoding_message_size: Option<usize>,
|
|
}
|
|
impl<T> TagServiceServer<T> {
|
|
pub fn new(inner: T) -> Self {
|
|
Self::from_arc(Arc::new(inner))
|
|
}
|
|
pub fn from_arc(inner: Arc<T>) -> 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> InterceptedService<Self, F>
|
|
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<T, B> tonic::codegen::Service<http::Request<B>> for TagServiceServer<T>
|
|
where
|
|
T: TagService,
|
|
B: Body + std::marker::Send + 'static,
|
|
B::Error: Into<StdError> + std::marker::Send + 'static,
|
|
{
|
|
type Response = http::Response<tonic::body::BoxBody>;
|
|
type Error = std::convert::Infallible;
|
|
type Future = BoxFuture<Self::Response, Self::Error>;
|
|
fn poll_ready(
|
|
&mut self,
|
|
_cx: &mut Context<'_>,
|
|
) -> Poll<std::result::Result<(), Self::Error>> {
|
|
Poll::Ready(Ok(()))
|
|
}
|
|
fn call(&mut self, req: http::Request<B>) -> Self::Future {
|
|
match req.uri().path() {
|
|
"/gitks.TagService/ListTags" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct ListTagsSvc<T: TagService>(pub Arc<T>);
|
|
impl<
|
|
T: TagService,
|
|
> tonic::server::UnaryService<super::ListTagsRequest>
|
|
for ListTagsSvc<T> {
|
|
type Response = super::ListTagsResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ListTagsRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as TagService>::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<T: TagService>(pub Arc<T>);
|
|
impl<T: TagService> tonic::server::UnaryService<super::GetTagRequest>
|
|
for GetTagSvc<T> {
|
|
type Response = super::Tag;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetTagRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as TagService>::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<T: TagService>(pub Arc<T>);
|
|
impl<
|
|
T: TagService,
|
|
> tonic::server::UnaryService<super::CreateTagRequest>
|
|
for CreateTagSvc<T> {
|
|
type Response = super::Tag;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::CreateTagRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as TagService>::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<T: TagService>(pub Arc<T>);
|
|
impl<
|
|
T: TagService,
|
|
> tonic::server::UnaryService<super::DeleteTagRequest>
|
|
for DeleteTagSvc<T> {
|
|
type Response = ();
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::DeleteTagRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as TagService>::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<T: TagService>(pub Arc<T>);
|
|
impl<
|
|
T: TagService,
|
|
> tonic::server::UnaryService<super::VerifyTagRequest>
|
|
for VerifyTagSvc<T> {
|
|
type Response = super::VerifiedSignature;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::VerifyTagRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as TagService>::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<T> Clone for TagServiceServer<T> {
|
|
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<T> tonic::server::NamedService for TagServiceServer<T> {
|
|
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<Oid>,
|
|
#[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<Self> {
|
|
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<Oid>,
|
|
#[prost(string, tag = "2")]
|
|
pub path: ::prost::alloc::string::String,
|
|
#[prost(message, repeated, tag = "3")]
|
|
pub entries: ::prost::alloc::vec::Vec<TreeEntry>,
|
|
#[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<Oid>,
|
|
#[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<u8>,
|
|
#[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<Oid>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub revision: ::core::option::Option<ObjectSelector>,
|
|
#[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<Pagination>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ListTreeResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub entries: ::prost::alloc::vec::Vec<TreeEntry>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub page_info: ::core::option::Option<PageInfo>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub revision: ::core::option::Option<ObjectSelector>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub revision: ::core::option::Option<ObjectSelector>,
|
|
#[prost(string, tag = "3")]
|
|
pub path: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub oid: ::core::option::Option<Oid>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub revision: ::core::option::Option<ObjectSelector>,
|
|
#[prost(string, tag = "3")]
|
|
pub path: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "4")]
|
|
pub oid: ::core::option::Option<Oid>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetRawBlobResponse {
|
|
#[prost(bytes = "vec", tag = "1")]
|
|
pub data: ::prost::alloc::vec::Vec<u8>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetFileMetadataRequest {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub repository: ::core::option::Option<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub revision: ::core::option::Option<ObjectSelector>,
|
|
#[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<RepositoryHeader>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub revision: ::core::option::Option<ObjectSelector>,
|
|
#[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<Pagination>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct FindFilesResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub files: ::prost::alloc::vec::Vec<FileMetadata>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub page_info: ::core::option::Option<PageInfo>,
|
|
}
|
|
/// 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<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl TreeServiceClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
|
|
where
|
|
D: TryInto<tonic::transport::Endpoint>,
|
|
D::Error: Into<StdError>,
|
|
{
|
|
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
|
|
Ok(Self::new(conn))
|
|
}
|
|
}
|
|
impl<T> TreeServiceClient<T>
|
|
where
|
|
T: tonic::client::GrpcService<tonic::body::BoxBody>,
|
|
T::Error: Into<StdError>,
|
|
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
|
|
<T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> TreeServiceClient<InterceptedService<T, F>>
|
|
where
|
|
F: tonic::service::Interceptor,
|
|
T::ResponseBody: Default,
|
|
T: tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
Response = http::Response<
|
|
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
|
|
>,
|
|
>,
|
|
<T as tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
>>::Error: Into<StdError> + 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<super::ListTreeRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListTreeResponse>,
|
|
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<super::GetTreeRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Tree>, 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<super::GetBlobRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Blob>, 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<super::GetRawBlobRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<tonic::codec::Streaming<super::GetRawBlobResponse>>,
|
|
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<super::GetFileMetadataRequest>,
|
|
) -> std::result::Result<tonic::Response<super::FileMetadata>, 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<super::FindFilesRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::FindFilesResponse>,
|
|
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<super::ListTreeRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListTreeResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn get_tree(
|
|
&self,
|
|
request: tonic::Request<super::GetTreeRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Tree>, tonic::Status>;
|
|
async fn get_blob(
|
|
&self,
|
|
request: tonic::Request<super::GetBlobRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Blob>, tonic::Status>;
|
|
/// Server streaming response type for the GetRawBlob method.
|
|
type GetRawBlobStream: tonic::codegen::tokio_stream::Stream<
|
|
Item = std::result::Result<super::GetRawBlobResponse, tonic::Status>,
|
|
>
|
|
+ std::marker::Send
|
|
+ 'static;
|
|
async fn get_raw_blob(
|
|
&self,
|
|
request: tonic::Request<super::GetRawBlobRequest>,
|
|
) -> std::result::Result<tonic::Response<Self::GetRawBlobStream>, tonic::Status>;
|
|
async fn get_file_metadata(
|
|
&self,
|
|
request: tonic::Request<super::GetFileMetadataRequest>,
|
|
) -> std::result::Result<tonic::Response<super::FileMetadata>, tonic::Status>;
|
|
async fn find_files(
|
|
&self,
|
|
request: tonic::Request<super::FindFilesRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::FindFilesResponse>,
|
|
tonic::Status,
|
|
>;
|
|
}
|
|
#[derive(Debug)]
|
|
pub struct TreeServiceServer<T> {
|
|
inner: Arc<T>,
|
|
accept_compression_encodings: EnabledCompressionEncodings,
|
|
send_compression_encodings: EnabledCompressionEncodings,
|
|
max_decoding_message_size: Option<usize>,
|
|
max_encoding_message_size: Option<usize>,
|
|
}
|
|
impl<T> TreeServiceServer<T> {
|
|
pub fn new(inner: T) -> Self {
|
|
Self::from_arc(Arc::new(inner))
|
|
}
|
|
pub fn from_arc(inner: Arc<T>) -> 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<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> InterceptedService<Self, F>
|
|
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<T, B> tonic::codegen::Service<http::Request<B>> for TreeServiceServer<T>
|
|
where
|
|
T: TreeService,
|
|
B: Body + std::marker::Send + 'static,
|
|
B::Error: Into<StdError> + std::marker::Send + 'static,
|
|
{
|
|
type Response = http::Response<tonic::body::BoxBody>;
|
|
type Error = std::convert::Infallible;
|
|
type Future = BoxFuture<Self::Response, Self::Error>;
|
|
fn poll_ready(
|
|
&mut self,
|
|
_cx: &mut Context<'_>,
|
|
) -> Poll<std::result::Result<(), Self::Error>> {
|
|
Poll::Ready(Ok(()))
|
|
}
|
|
fn call(&mut self, req: http::Request<B>) -> Self::Future {
|
|
match req.uri().path() {
|
|
"/gitks.TreeService/ListTree" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct ListTreeSvc<T: TreeService>(pub Arc<T>);
|
|
impl<
|
|
T: TreeService,
|
|
> tonic::server::UnaryService<super::ListTreeRequest>
|
|
for ListTreeSvc<T> {
|
|
type Response = super::ListTreeResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ListTreeRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as TreeService>::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<T: TreeService>(pub Arc<T>);
|
|
impl<
|
|
T: TreeService,
|
|
> tonic::server::UnaryService<super::GetTreeRequest>
|
|
for GetTreeSvc<T> {
|
|
type Response = super::Tree;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetTreeRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as TreeService>::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<T: TreeService>(pub Arc<T>);
|
|
impl<
|
|
T: TreeService,
|
|
> tonic::server::UnaryService<super::GetBlobRequest>
|
|
for GetBlobSvc<T> {
|
|
type Response = super::Blob;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetBlobRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as TreeService>::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<T: TreeService>(pub Arc<T>);
|
|
impl<
|
|
T: TreeService,
|
|
> tonic::server::ServerStreamingService<super::GetRawBlobRequest>
|
|
for GetRawBlobSvc<T> {
|
|
type Response = super::GetRawBlobResponse;
|
|
type ResponseStream = T::GetRawBlobStream;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::ResponseStream>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetRawBlobRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as TreeService>::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<T: TreeService>(pub Arc<T>);
|
|
impl<
|
|
T: TreeService,
|
|
> tonic::server::UnaryService<super::GetFileMetadataRequest>
|
|
for GetFileMetadataSvc<T> {
|
|
type Response = super::FileMetadata;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetFileMetadataRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as TreeService>::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<T: TreeService>(pub Arc<T>);
|
|
impl<
|
|
T: TreeService,
|
|
> tonic::server::UnaryService<super::FindFilesRequest>
|
|
for FindFilesSvc<T> {
|
|
type Response = super::FindFilesResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::FindFilesRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as TreeService>::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<T> Clone for TreeServiceServer<T> {
|
|
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<T> tonic::server::NamedService for TreeServiceServer<T> {
|
|
const NAME: &'static str = SERVICE_NAME;
|
|
}
|
|
}
|