server/lib/src/generated/holger.metered.v1.rs
// @generated by `cargo xtask gen-proto` (protox + tonic-build, no protoc).
// DO NOT EDIT BY HAND. Regenerate after changing proto/holger.proto.
// This file is @generated by prost-build.
/// One signed fact about one repository. Field for field
/// `monetize_product::EntitlementFact` (tenant = repository).
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EntitlementFact {
#[prost(string, tag = "1")]
pub repository: ::prost::alloc::string::String,
/// The ORDER reference this verdict came from, or an operator's label. Called
/// `plan` in the signed canonical form, so the name cannot change without
/// invalidating every signature a deployed holger checks.
#[prost(string, tag = "2")]
pub plan: ::prost::alloc::string::String,
#[prost(enumeration = "EntitlementState", tag = "3")]
pub state: i32,
#[prost(uint64, optional, tag = "4")]
pub paid_until_unix_ms: ::core::option::Option<u64>,
/// Per-meter caps holger polices. Keys are the meter names `Usage.Read`
/// reports; a key holger cannot police is REFUSED at `Set` rather than stored
/// and quietly ignored. Absent = server default.
#[prost(map = "string, uint64", tag = "5")]
pub caps: ::std::collections::HashMap<::prost::alloc::string::String, u64>,
/// `operator` | `payment:<vendor>:<reference>` — recorded verbatim in the audit
/// log, which is holger's attestation trail.
#[prost(string, tag = "6")]
pub source: ::prost::alloc::string::String,
/// Ed25519 (64 bytes) by monetize-server's key, see the header.
///
/// **The V1 form**: it covers fields 1-6 and NOT the two below. That is
/// deliberate and permanent — it is the signature an appliance built before
/// 2026-09-17 computes, and it must keep verifying there for ever.
#[prost(bytes = "vec", tag = "7")]
pub signature: ::prost::alloc::vec::Vec<u8>,
/// **When monetize issued this verdict — the field that makes a fact good ONCE.**
///
/// Without it a fact is replayable for ever: capture a Paid fact, wait for the
/// repository to lapse, push the captured bytes back, and the signature still
/// verifies because it is a real signature. `paid_until` cannot tell the two
/// apart, because a lapse keeps the date and moves the state.
///
/// ⚠ It MUST be carried on the wire. A holger that dropped it would hand
/// `monetize_embed` a fact with no stamp, which that verifier accepts as the
/// legal unstamped case — so the replay guard would be lost silently, with
/// every signature still green.
#[prost(uint64, optional, tag = "8")]
pub issued_unix_ms: ::core::option::Option<u64>,
/// Ed25519 over the V2 form (fields 1-6 plus `issued_unix_ms`). Empty only for
/// an unstamped fact; present without `issued_unix_ms`, or the reverse, is a
/// tampering shape `monetize_embed` refuses by a different name.
#[prost(bytes = "vec", tag = "9")]
pub issued_signature: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PurgeRepositoryRequest {
#[prost(string, tag = "1")]
pub repository: ::prost::alloc::string::String,
/// Why — recorded verbatim in the audit log and the purge record.
#[prost(string, tag = "2")]
pub reason: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PurgeRepositoryResponse {
#[prost(string, tag = "1")]
pub repository: ::prost::alloc::string::String,
/// Artifacts deleted by THIS call.
#[prost(uint64, tag = "2")]
pub artifacts_deleted: u64,
/// Their bytes, as read before each delete.
#[prost(uint64, tag = "3")]
pub bytes_reclaimed: u64,
/// One line per artifact (or listing) that could not be removed. Non-empty =
/// the repository's data is PARTIALLY still there; no record is written.
#[prost(string, repeated, tag = "4")]
pub failures: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// The walk's own upload gate was lifted when it ended. `false` = a walk still
/// holds the repository (another call is walking it).
#[prost(bool, tag = "5")]
pub gate_released: bool,
/// The repository's stored state after the walk — `Suspended` or `Retention`
/// still refuses every upload on its own, which the purge does not lift.
#[prost(enumeration = "EntitlementState", tag = "6")]
pub state: i32,
/// The record written (`holger-purges/<file>`), empty when none was.
#[prost(string, tag = "7")]
pub record: ::prost::alloc::string::String,
/// One human line: what was deleted, from where.
#[prost(string, tag = "8")]
pub detail: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetEntitlementRequest {
#[prost(string, tag = "1")]
pub repository: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetEntitlementResponse {
/// Absent = the repository is Free (every repository a server carried before
/// entitlements existed reads as Free).
#[prost(message, optional, tag = "1")]
pub fact: ::core::option::Option<EntitlementFact>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetEntitlementRequest {
#[prost(message, optional, tag = "1")]
pub fact: ::core::option::Option<EntitlementFact>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SetEntitlementResponse {
/// The state holger now enforces (== fact.state when accepted).
#[prost(enumeration = "EntitlementState", tag = "1")]
pub state: i32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListEntitlementsRequest {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListEntitlementsResponse {
#[prost(message, repeated, tag = "1")]
pub facts: ::prost::alloc::vec::Vec<EntitlementFact>,
}
/// The ladder. Mirrors `monetize_product::State`.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum EntitlementState {
Unspecified = 0,
Free = 1,
Paid = 2,
Grace = 3,
Suspended = 4,
Retention = 5,
}
impl EntitlementState {
/// 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 => "ENTITLEMENT_STATE_UNSPECIFIED",
Self::Free => "ENTITLEMENT_STATE_FREE",
Self::Paid => "ENTITLEMENT_STATE_PAID",
Self::Grace => "ENTITLEMENT_STATE_GRACE",
Self::Suspended => "ENTITLEMENT_STATE_SUSPENDED",
Self::Retention => "ENTITLEMENT_STATE_RETENTION",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ENTITLEMENT_STATE_UNSPECIFIED" => Some(Self::Unspecified),
"ENTITLEMENT_STATE_FREE" => Some(Self::Free),
"ENTITLEMENT_STATE_PAID" => Some(Self::Paid),
"ENTITLEMENT_STATE_GRACE" => Some(Self::Grace),
"ENTITLEMENT_STATE_SUSPENDED" => Some(Self::Suspended),
"ENTITLEMENT_STATE_RETENTION" => Some(Self::Retention),
_ => None,
}
}
}
/// Generated client implementations.
pub mod entitlement_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 EntitlementServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl EntitlementServiceClient<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> EntitlementServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
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,
) -> EntitlementServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
EntitlementServiceClient::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(
&mut self,
request: impl tonic::IntoRequest<super::GetEntitlementRequest>,
) -> std::result::Result<
tonic::Response<super::GetEntitlementResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/holger.metered.v1.EntitlementService/Get",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("holger.metered.v1.EntitlementService", "Get"));
self.inner.unary(req, path, codec).await
}
/// ADMIN level. holger VERIFIES the signature against its configured monetize
/// public key BEFORE storing; a fact that does not verify is PERMISSION_DENIED
/// and nothing moves, a fact that is not well formed is INVALID_ARGUMENT.
/// Idempotent on (repository, source).
pub async fn set(
&mut self,
request: impl tonic::IntoRequest<super::SetEntitlementRequest>,
) -> std::result::Result<
tonic::Response<super::SetEntitlementResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/holger.metered.v1.EntitlementService/Set",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("holger.metered.v1.EntitlementService", "Set"));
self.inner.unary(req, path, codec).await
}
pub async fn list(
&mut self,
request: impl tonic::IntoRequest<super::ListEntitlementsRequest>,
) -> std::result::Result<
tonic::Response<super::ListEntitlementsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/holger.metered.v1.EntitlementService/List",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("holger.metered.v1.EntitlementService", "List"));
self.inner.unary(req, path, codec).await
}
/// ADMIN level, like `Set`. **Deletes every artifact of one repository** — the
/// owner's non-payment ruling (2026-09-29): read-only at once, deleted after the
/// grace the ONE box decides (holger keeps no day count of its own).
/// monetize's nonpay engine reaches it through `Product::purge_tenant` (a tenant
/// is a repository).
///
/// * closed to the roster: a repository this server does not serve is NOT_FOUND
/// (`holger-metered-5`);
/// * REFUSED (FAILED_PRECONDITION, `holger-metered-7`) unless the repository's
/// STORED fact is `Suspended` or `Retention`, or a `Paid`/`Grace` fact whose
/// period ended by holger's own clock — holger's own guard, whoever asks: a
/// free or paying repository is never purged;
/// * while it walks the repository is GATED: every upload is refused by name
/// (`holger-metered-6`), on every write door;
/// * every artifact is deleted through the repository's backend; one that could
/// not be (an immutable znippy archive cannot delete in place) is named in
/// `failures` — never a false success;
/// * a purge with no failures writes ONE immutable record
/// `<data_root>/holger-purges/<repository>-<at_unix_ms>.json`, which the twin's
/// estate pull carries and the twin applies to its own copy;
/// * idempotent: a purge of an emptied repository is OK with 0.
///
/// A second call while a walk of the same repository runs answers at once with
/// `gate_released = false` and nothing deleted by it: ask again.
pub async fn purge(
&mut self,
request: impl tonic::IntoRequest<super::PurgeRepositoryRequest>,
) -> std::result::Result<
tonic::Response<super::PurgeRepositoryResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/holger.metered.v1.EntitlementService/Purge",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("holger.metered.v1.EntitlementService", "Purge"),
);
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod entitlement_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 EntitlementServiceServer.
#[async_trait]
pub trait EntitlementService: std::marker::Send + std::marker::Sync + 'static {
async fn get(
&self,
request: tonic::Request<super::GetEntitlementRequest>,
) -> std::result::Result<
tonic::Response<super::GetEntitlementResponse>,
tonic::Status,
>;
/// ADMIN level. holger VERIFIES the signature against its configured monetize
/// public key BEFORE storing; a fact that does not verify is PERMISSION_DENIED
/// and nothing moves, a fact that is not well formed is INVALID_ARGUMENT.
/// Idempotent on (repository, source).
async fn set(
&self,
request: tonic::Request<super::SetEntitlementRequest>,
) -> std::result::Result<
tonic::Response<super::SetEntitlementResponse>,
tonic::Status,
>;
async fn list(
&self,
request: tonic::Request<super::ListEntitlementsRequest>,
) -> std::result::Result<
tonic::Response<super::ListEntitlementsResponse>,
tonic::Status,
>;
/// ADMIN level, like `Set`. **Deletes every artifact of one repository** — the
/// owner's non-payment ruling (2026-09-29): read-only at once, deleted after the
/// grace the ONE box decides (holger keeps no day count of its own).
/// monetize's nonpay engine reaches it through `Product::purge_tenant` (a tenant
/// is a repository).
///
/// * closed to the roster: a repository this server does not serve is NOT_FOUND
/// (`holger-metered-5`);
/// * REFUSED (FAILED_PRECONDITION, `holger-metered-7`) unless the repository's
/// STORED fact is `Suspended` or `Retention`, or a `Paid`/`Grace` fact whose
/// period ended by holger's own clock — holger's own guard, whoever asks: a
/// free or paying repository is never purged;
/// * while it walks the repository is GATED: every upload is refused by name
/// (`holger-metered-6`), on every write door;
/// * every artifact is deleted through the repository's backend; one that could
/// not be (an immutable znippy archive cannot delete in place) is named in
/// `failures` — never a false success;
/// * a purge with no failures writes ONE immutable record
/// `<data_root>/holger-purges/<repository>-<at_unix_ms>.json`, which the twin's
/// estate pull carries and the twin applies to its own copy;
/// * idempotent: a purge of an emptied repository is OK with 0.
///
/// A second call while a walk of the same repository runs answers at once with
/// `gate_released = false` and nothing deleted by it: ask again.
async fn purge(
&self,
request: tonic::Request<super::PurgeRepositoryRequest>,
) -> std::result::Result<
tonic::Response<super::PurgeRepositoryResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct EntitlementServiceServer<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> EntitlementServiceServer<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 EntitlementServiceServer<T>
where
T: EntitlementService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
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() {
"/holger.metered.v1.EntitlementService/Get" => {
#[allow(non_camel_case_types)]
struct GetSvc<T: EntitlementService>(pub Arc<T>);
impl<
T: EntitlementService,
> tonic::server::UnaryService<super::GetEntitlementRequest>
for GetSvc<T> {
type Response = super::GetEntitlementResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetEntitlementRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as EntitlementService>::get(&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 = GetSvc(inner);
let codec = tonic_prost::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)
}
"/holger.metered.v1.EntitlementService/Set" => {
#[allow(non_camel_case_types)]
struct SetSvc<T: EntitlementService>(pub Arc<T>);
impl<
T: EntitlementService,
> tonic::server::UnaryService<super::SetEntitlementRequest>
for SetSvc<T> {
type Response = super::SetEntitlementResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SetEntitlementRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as EntitlementService>::set(&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 = SetSvc(inner);
let codec = tonic_prost::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)
}
"/holger.metered.v1.EntitlementService/List" => {
#[allow(non_camel_case_types)]
struct ListSvc<T: EntitlementService>(pub Arc<T>);
impl<
T: EntitlementService,
> tonic::server::UnaryService<super::ListEntitlementsRequest>
for ListSvc<T> {
type Response = super::ListEntitlementsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListEntitlementsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as EntitlementService>::list(&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 = ListSvc(inner);
let codec = tonic_prost::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)
}
"/holger.metered.v1.EntitlementService/Purge" => {
#[allow(non_camel_case_types)]
struct PurgeSvc<T: EntitlementService>(pub Arc<T>);
impl<
T: EntitlementService,
> tonic::server::UnaryService<super::PurgeRepositoryRequest>
for PurgeSvc<T> {
type Response = super::PurgeRepositoryResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::PurgeRepositoryRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as EntitlementService>::purge(&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 = PurgeSvc(inner);
let codec = tonic_prost::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(
tonic::body::Body::default(),
);
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 EntitlementServiceServer<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 = "holger.metered.v1.EntitlementService";
impl<T> tonic::server::NamedService for EntitlementServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}