exporting ECB

This commit is contained in:
Priec
2026-08-13 09:11:41 +02:00
parent f8e483efa8
commit fe8ea680e3
24 changed files with 895 additions and 1 deletions

Binary file not shown.

View File

@@ -1,4 +1,75 @@
// This file is @generated by prost-build.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetEcbPipelineStatusRequest {
/// Optional. How many recent import attempts to return. Zero uses 20; the
/// maximum is 100.
#[prost(int32, tag = "1")]
pub batch_limit: i32,
}
/// One row of the append-only import audit log.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct EcbImportBatch {
#[prost(int64, tag = "1")]
pub batch_id: i64,
/// "running", "succeeded" or "failed".
#[prost(string, tag = "2")]
pub status: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub requested_from: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub requested_through: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub endpoint: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub started_at: ::prost::alloc::string::String,
#[prost(string, optional, tag = "7")]
pub completed_at: ::core::option::Option<::prost::alloc::string::String>,
/// Present on a batch that advanced coverage.
#[prost(string, optional, tag = "8")]
pub verified_through_date: ::core::option::Option<::prost::alloc::string::String>,
#[prost(int32, optional, tag = "9")]
pub observation_count: ::core::option::Option<i32>,
/// May be lower than observation_count: an observation already recorded by an
/// earlier batch is kept rather than replaced.
#[prost(int32, optional, tag = "10")]
pub inserted_observation_count: ::core::option::Option<i32>,
#[prost(string, optional, tag = "11")]
pub error_message: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetEcbPipelineStatusResponse {
/// Latest date a successful batch verified. Absent when nothing has ever
/// succeeded, which is what a pipeline that has never run looks like.
#[prost(string, optional, tag = "1")]
pub verified_through_date: ::core::option::Option<::prost::alloc::string::String>,
/// The date coverage should have reached by now, derived from the same
/// publication rule the importer schedules against. Comparing the two is what
/// "healthy" means.
#[prost(string, tag = "2")]
pub latest_verifiable_date: ::prost::alloc::string::String,
/// True when verified coverage has reached latest_verifiable_date. A
/// conversion whose publication date falls beyond coverage is refused, so
/// this answers "will posting work right now".
#[prost(bool, tag = "3")]
pub healthy: bool,
/// Publication days between coverage and latest_verifiable_date. Zero when
/// healthy.
#[prost(int32, tag = "4")]
pub days_behind: i32,
/// True while a batch holds the single-running lock.
#[prost(bool, tag = "5")]
pub import_running: bool,
/// When the scheduler next wakes, from the same cutoff the importer uses.
#[prost(string, tag = "6")]
pub next_import_at: ::prost::alloc::string::String,
/// Newest first, running and failed attempts included.
#[prost(message, repeated, tag = "7")]
pub batches: ::prost::alloc::vec::Vec<EcbImportBatch>,
/// Distinct currencies observed on verified_through_date, so a coverage gap
/// for one currency is visible even when the date itself is covered.
#[prost(string, repeated, tag = "8")]
pub covered_currencies: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Exact inputs for a conversion preview. Decimal values are strings so the
/// client never loses precision through binary floating point.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
@@ -349,6 +420,35 @@ pub mod ecb_service_client {
);
self.inner.unary(req, path, codec).await
}
/// Health of the reference-rate import pipeline: how far verified coverage
/// reaches, how far it should reach by now, and how the recent import
/// attempts went. Not profile-scoped -- one pipeline feeds every profile.
pub async fn get_ecb_pipeline_status(
&mut self,
request: impl tonic::IntoRequest<super::GetEcbPipelineStatusRequest>,
) -> std::result::Result<
tonic::Response<super::GetEcbPipelineStatusResponse>,
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(
"/komp_ac.ecb.EcbService/GetEcbPipelineStatus",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("komp_ac.ecb.EcbService", "GetEcbPipelineStatus"),
);
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
@@ -381,6 +481,16 @@ pub mod ecb_service_server {
tonic::Response<super::ListEcbConversionEvidenceResponse>,
tonic::Status,
>;
/// Health of the reference-rate import pipeline: how far verified coverage
/// reaches, how far it should reach by now, and how the recent import
/// attempts went. Not profile-scoped -- one pipeline feeds every profile.
async fn get_ecb_pipeline_status(
&self,
request: tonic::Request<super::GetEcbPipelineStatusRequest>,
) -> std::result::Result<
tonic::Response<super::GetEcbPipelineStatusResponse>,
tonic::Status,
>;
}
/// Read-only access to ECB conversion previews and audit evidence.
///
@@ -561,6 +671,52 @@ pub mod ecb_service_server {
};
Box::pin(fut)
}
"/komp_ac.ecb.EcbService/GetEcbPipelineStatus" => {
#[allow(non_camel_case_types)]
struct GetEcbPipelineStatusSvc<T: EcbService>(pub Arc<T>);
impl<
T: EcbService,
> tonic::server::UnaryService<super::GetEcbPipelineStatusRequest>
for GetEcbPipelineStatusSvc<T> {
type Response = super::GetEcbPipelineStatusResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetEcbPipelineStatusRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as EcbService>::get_ecb_pipeline_status(&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 = GetEcbPipelineStatusSvc(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(