#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BulkGenerateRequest {
#[prost(message, optional, tag = "1")]
pub config: ::core::option::Option<GenerationConfig>,
#[prost(uint64, tag = "2")]
pub entry_count: u64,
#[prost(enumeration = "OutputFormat", tag = "3")]
pub output_format: i32,
#[prost(bool, tag = "4")]
pub include_master_data: bool,
#[prost(bool, tag = "5")]
pub inject_anomalies: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BulkGenerateResponse {
#[prost(uint64, tag = "1")]
pub entries_generated: u64,
#[prost(uint64, tag = "2")]
pub duration_ms: u64,
#[prost(message, repeated, tag = "3")]
pub journal_entries: ::prost::alloc::vec::Vec<JournalEntryProto>,
#[prost(message, repeated, tag = "4")]
pub anomaly_labels: ::prost::alloc::vec::Vec<AnomalyLabelProto>,
#[prost(message, optional, tag = "5")]
pub stats: ::core::option::Option<GenerationStats>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamDataRequest {
#[prost(message, optional, tag = "1")]
pub config: ::core::option::Option<GenerationConfig>,
#[prost(uint32, tag = "2")]
pub events_per_second: u32,
#[prost(uint64, tag = "3")]
pub max_events: u64,
#[prost(bool, tag = "4")]
pub inject_anomalies: bool,
#[prost(float, tag = "5")]
pub anomaly_rate: f32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DataEvent {
#[prost(uint64, tag = "1")]
pub sequence: u64,
#[prost(message, optional, tag = "2")]
pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
#[prost(oneof = "data_event::Event", tags = "3, 4, 5, 6, 7")]
pub event: ::core::option::Option<data_event::Event>,
}
pub mod data_event {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Event {
#[prost(message, tag = "3")]
JournalEntry(super::JournalEntryProto),
#[prost(message, tag = "4")]
MasterData(super::MasterDataEvent),
#[prost(message, tag = "5")]
DocumentFlow(super::DocumentFlowEvent),
#[prost(message, tag = "6")]
Anomaly(super::AnomalyEvent),
#[prost(message, tag = "7")]
Metrics(super::MetricsEvent),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct JournalEntryProto {
#[prost(string, tag = "1")]
pub document_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub company_code: ::prost::alloc::string::String,
#[prost(uint32, tag = "3")]
pub fiscal_year: u32,
#[prost(uint32, tag = "4")]
pub fiscal_period: u32,
#[prost(string, tag = "5")]
pub posting_date: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub document_date: ::prost::alloc::string::String,
#[prost(string, tag = "7")]
pub created_at: ::prost::alloc::string::String,
#[prost(string, tag = "8")]
pub source: ::prost::alloc::string::String,
#[prost(string, optional, tag = "9")]
pub business_process: ::core::option::Option<::prost::alloc::string::String>,
#[prost(message, repeated, tag = "10")]
pub lines: ::prost::alloc::vec::Vec<JournalLineProto>,
#[prost(bool, tag = "11")]
pub is_anomaly: bool,
#[prost(string, optional, tag = "12")]
pub anomaly_type: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct JournalLineProto {
#[prost(uint32, tag = "1")]
pub line_number: u32,
#[prost(string, tag = "2")]
pub account_number: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub account_name: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub amount: ::prost::alloc::string::String,
#[prost(bool, tag = "5")]
pub is_debit: bool,
#[prost(string, optional, tag = "6")]
pub cost_center: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "7")]
pub profit_center: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "8")]
pub vendor_id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "9")]
pub customer_id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "10")]
pub material_id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "11")]
pub text: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MasterDataEvent {
#[prost(oneof = "master_data_event::Data", tags = "1, 2, 3, 4, 5")]
pub data: ::core::option::Option<master_data_event::Data>,
}
pub mod master_data_event {
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum Data {
#[prost(message, tag = "1")]
Vendor(super::VendorProto),
#[prost(message, tag = "2")]
Customer(super::CustomerProto),
#[prost(message, tag = "3")]
Material(super::MaterialProto),
#[prost(message, tag = "4")]
FixedAsset(super::FixedAssetProto),
#[prost(message, tag = "5")]
Employee(super::EmployeeProto),
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct VendorProto {
#[prost(string, tag = "1")]
pub vendor_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub country: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub currency: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub payment_terms: ::prost::alloc::string::String,
#[prost(bool, tag = "6")]
pub is_intercompany: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CustomerProto {
#[prost(string, tag = "1")]
pub customer_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub country: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub currency: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub credit_rating: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub credit_limit: ::prost::alloc::string::String,
#[prost(bool, tag = "7")]
pub is_intercompany: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MaterialProto {
#[prost(string, tag = "1")]
pub material_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub description: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub material_type: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub unit_of_measure: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub standard_cost: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FixedAssetProto {
#[prost(string, tag = "1")]
pub asset_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub description: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub asset_class: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub acquisition_value: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub acquisition_date: ::prost::alloc::string::String,
#[prost(uint32, tag = "6")]
pub useful_life_months: u32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct EmployeeProto {
#[prost(string, tag = "1")]
pub employee_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub department: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub job_title: ::prost::alloc::string::String,
#[prost(string, optional, tag = "5")]
pub manager_id: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DocumentFlowEvent {
#[prost(string, tag = "1")]
pub document_type: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub document_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub company_code: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub document_date: ::prost::alloc::string::String,
#[prost(string, optional, tag = "5")]
pub reference_document: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, tag = "6")]
pub total_amount: ::prost::alloc::string::String,
#[prost(string, tag = "7")]
pub currency: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnomalyEvent {
#[prost(string, tag = "1")]
pub anomaly_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub anomaly_type: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub document_id: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub description: ::prost::alloc::string::String,
#[prost(float, tag = "5")]
pub severity_score: f32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct MetricsEvent {
#[prost(uint64, tag = "1")]
pub total_entries: u64,
#[prost(uint64, tag = "2")]
pub entries_per_second: u64,
#[prost(float, tag = "3")]
pub anomaly_rate: f32,
#[prost(uint64, tag = "4")]
pub uptime_seconds: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ControlCommand {
#[prost(enumeration = "ControlAction", tag = "1")]
pub action: i32,
#[prost(string, optional, tag = "2")]
pub pattern_name: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ControlResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
#[prost(enumeration = "StreamStatus", tag = "3")]
pub current_status: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GenerationConfig {
#[prost(string, tag = "1")]
pub industry: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub start_date: ::prost::alloc::string::String,
#[prost(uint32, tag = "3")]
pub period_months: u32,
#[prost(uint64, tag = "4")]
pub seed: u64,
#[prost(string, tag = "5")]
pub coa_complexity: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "6")]
pub companies: ::prost::alloc::vec::Vec<CompanyConfigProto>,
#[prost(bool, tag = "7")]
pub fraud_enabled: bool,
#[prost(float, tag = "8")]
pub fraud_rate: f32,
#[prost(bool, tag = "9")]
pub generate_master_data: bool,
#[prost(bool, tag = "10")]
pub generate_document_flows: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompanyConfigProto {
#[prost(string, tag = "1")]
pub code: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub currency: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub country: ::prost::alloc::string::String,
#[prost(uint64, tag = "5")]
pub annual_transaction_volume: u64,
#[prost(float, tag = "6")]
pub volume_weight: f32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConfigRequest {
#[prost(message, optional, tag = "1")]
pub config: ::core::option::Option<GenerationConfig>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConfigResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub current_config: ::core::option::Option<GenerationConfig>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct MetricsResponse {
#[prost(uint64, tag = "1")]
pub total_entries_generated: u64,
#[prost(uint64, tag = "2")]
pub total_anomalies_injected: u64,
#[prost(uint64, tag = "3")]
pub uptime_seconds: u64,
#[prost(uint64, tag = "4")]
pub session_entries: u64,
#[prost(double, tag = "5")]
pub session_entries_per_second: f64,
#[prost(uint32, tag = "6")]
pub active_streams: u32,
#[prost(uint64, tag = "7")]
pub total_stream_events: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct HealthResponse {
#[prost(bool, tag = "1")]
pub healthy: bool,
#[prost(string, tag = "2")]
pub version: ::prost::alloc::string::String,
#[prost(uint64, tag = "3")]
pub uptime_seconds: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GenerationStats {
#[prost(uint64, tag = "1")]
pub total_entries: u64,
#[prost(uint64, tag = "2")]
pub total_lines: u64,
#[prost(string, tag = "3")]
pub total_debit_amount: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub total_credit_amount: ::prost::alloc::string::String,
#[prost(uint64, tag = "5")]
pub anomaly_count: u64,
#[prost(map = "string, uint64", tag = "6")]
pub entries_by_company: ::std::collections::HashMap<
::prost::alloc::string::String,
u64,
>,
#[prost(map = "string, uint64", tag = "7")]
pub entries_by_source: ::std::collections::HashMap<
::prost::alloc::string::String,
u64,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnomalyLabelProto {
#[prost(string, tag = "1")]
pub anomaly_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub document_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub anomaly_type: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub anomaly_category: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub description: ::prost::alloc::string::String,
#[prost(float, tag = "6")]
pub severity_score: f32,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ControlAction {
Unspecified = 0,
Pause = 1,
Resume = 2,
Stop = 3,
TriggerPattern = 4,
}
impl ControlAction {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "CONTROL_ACTION_UNSPECIFIED",
Self::Pause => "PAUSE",
Self::Resume => "RESUME",
Self::Stop => "STOP",
Self::TriggerPattern => "TRIGGER_PATTERN",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CONTROL_ACTION_UNSPECIFIED" => Some(Self::Unspecified),
"PAUSE" => Some(Self::Pause),
"RESUME" => Some(Self::Resume),
"STOP" => Some(Self::Stop),
"TRIGGER_PATTERN" => Some(Self::TriggerPattern),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum StreamStatus {
Unspecified = 0,
Running = 1,
Paused = 2,
Stopped = 3,
}
impl StreamStatus {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "STREAM_STATUS_UNSPECIFIED",
Self::Running => "RUNNING",
Self::Paused => "PAUSED",
Self::Stopped => "STOPPED",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STREAM_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
"RUNNING" => Some(Self::Running),
"PAUSED" => Some(Self::Paused),
"STOPPED" => Some(Self::Stopped),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum OutputFormat {
Unspecified = 0,
Json = 1,
Protobuf = 2,
Csv = 3,
Parquet = 4,
}
impl OutputFormat {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "OUTPUT_FORMAT_UNSPECIFIED",
Self::Json => "JSON",
Self::Protobuf => "PROTOBUF",
Self::Csv => "CSV",
Self::Parquet => "PARQUET",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"OUTPUT_FORMAT_UNSPECIFIED" => Some(Self::Unspecified),
"JSON" => Some(Self::Json),
"PROTOBUF" => Some(Self::Protobuf),
"CSV" => Some(Self::Csv),
"PARQUET" => Some(Self::Parquet),
_ => None,
}
}
}
pub mod synthetic_data_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 SyntheticDataServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl SyntheticDataServiceClient<tonic::transport::Channel> {
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> SyntheticDataServiceClient<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,
) -> SyntheticDataServiceClient<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,
{
SyntheticDataServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[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 bulk_generate(
&mut self,
request: impl tonic::IntoRequest<super::BulkGenerateRequest>,
) -> std::result::Result<
tonic::Response<super::BulkGenerateResponse>,
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(
"/synth.SyntheticDataService/BulkGenerate",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("synth.SyntheticDataService", "BulkGenerate"));
self.inner.unary(req, path, codec).await
}
pub async fn stream_data(
&mut self,
request: impl tonic::IntoRequest<super::StreamDataRequest>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::DataEvent>>,
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(
"/synth.SyntheticDataService/StreamData",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("synth.SyntheticDataService", "StreamData"));
self.inner.server_streaming(req, path, codec).await
}
pub async fn control(
&mut self,
request: impl tonic::IntoRequest<super::ControlCommand>,
) -> std::result::Result<
tonic::Response<super::ControlResponse>,
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(
"/synth.SyntheticDataService/Control",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("synth.SyntheticDataService", "Control"));
self.inner.unary(req, path, codec).await
}
pub async fn get_config(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<tonic::Response<super::ConfigResponse>, 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(
"/synth.SyntheticDataService/GetConfig",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("synth.SyntheticDataService", "GetConfig"));
self.inner.unary(req, path, codec).await
}
pub async fn set_config(
&mut self,
request: impl tonic::IntoRequest<super::ConfigRequest>,
) -> std::result::Result<tonic::Response<super::ConfigResponse>, 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(
"/synth.SyntheticDataService/SetConfig",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("synth.SyntheticDataService", "SetConfig"));
self.inner.unary(req, path, codec).await
}
pub async fn get_metrics(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<
tonic::Response<super::MetricsResponse>,
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(
"/synth.SyntheticDataService/GetMetrics",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("synth.SyntheticDataService", "GetMetrics"));
self.inner.unary(req, path, codec).await
}
pub async fn health_check(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<tonic::Response<super::HealthResponse>, 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(
"/synth.SyntheticDataService/HealthCheck",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("synth.SyntheticDataService", "HealthCheck"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod synthetic_data_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait SyntheticDataService: std::marker::Send + std::marker::Sync + 'static {
async fn bulk_generate(
&self,
request: tonic::Request<super::BulkGenerateRequest>,
) -> std::result::Result<
tonic::Response<super::BulkGenerateResponse>,
tonic::Status,
>;
type StreamDataStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::DataEvent, tonic::Status>,
>
+ std::marker::Send
+ 'static;
async fn stream_data(
&self,
request: tonic::Request<super::StreamDataRequest>,
) -> std::result::Result<tonic::Response<Self::StreamDataStream>, tonic::Status>;
async fn control(
&self,
request: tonic::Request<super::ControlCommand>,
) -> std::result::Result<tonic::Response<super::ControlResponse>, tonic::Status>;
async fn get_config(
&self,
request: tonic::Request<()>,
) -> std::result::Result<tonic::Response<super::ConfigResponse>, tonic::Status>;
async fn set_config(
&self,
request: tonic::Request<super::ConfigRequest>,
) -> std::result::Result<tonic::Response<super::ConfigResponse>, tonic::Status>;
async fn get_metrics(
&self,
request: tonic::Request<()>,
) -> std::result::Result<tonic::Response<super::MetricsResponse>, tonic::Status>;
async fn health_check(
&self,
request: tonic::Request<()>,
) -> std::result::Result<tonic::Response<super::HealthResponse>, tonic::Status>;
}
#[derive(Debug)]
pub struct SyntheticDataServiceServer<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> SyntheticDataServiceServer<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)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[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 SyntheticDataServiceServer<T>
where
T: SyntheticDataService,
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() {
"/synth.SyntheticDataService/BulkGenerate" => {
#[allow(non_camel_case_types)]
struct BulkGenerateSvc<T: SyntheticDataService>(pub Arc<T>);
impl<
T: SyntheticDataService,
> tonic::server::UnaryService<super::BulkGenerateRequest>
for BulkGenerateSvc<T> {
type Response = super::BulkGenerateResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::BulkGenerateRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SyntheticDataService>::bulk_generate(&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 = BulkGenerateSvc(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)
}
"/synth.SyntheticDataService/StreamData" => {
#[allow(non_camel_case_types)]
struct StreamDataSvc<T: SyntheticDataService>(pub Arc<T>);
impl<
T: SyntheticDataService,
> tonic::server::ServerStreamingService<super::StreamDataRequest>
for StreamDataSvc<T> {
type Response = super::DataEvent;
type ResponseStream = T::StreamDataStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::StreamDataRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SyntheticDataService>::stream_data(&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 = StreamDataSvc(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.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/synth.SyntheticDataService/Control" => {
#[allow(non_camel_case_types)]
struct ControlSvc<T: SyntheticDataService>(pub Arc<T>);
impl<
T: SyntheticDataService,
> tonic::server::UnaryService<super::ControlCommand>
for ControlSvc<T> {
type Response = super::ControlResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ControlCommand>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SyntheticDataService>::control(&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 = ControlSvc(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)
}
"/synth.SyntheticDataService/GetConfig" => {
#[allow(non_camel_case_types)]
struct GetConfigSvc<T: SyntheticDataService>(pub Arc<T>);
impl<T: SyntheticDataService> tonic::server::UnaryService<()>
for GetConfigSvc<T> {
type Response = super::ConfigResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SyntheticDataService>::get_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 = GetConfigSvc(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)
}
"/synth.SyntheticDataService/SetConfig" => {
#[allow(non_camel_case_types)]
struct SetConfigSvc<T: SyntheticDataService>(pub Arc<T>);
impl<
T: SyntheticDataService,
> tonic::server::UnaryService<super::ConfigRequest>
for SetConfigSvc<T> {
type Response = super::ConfigResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ConfigRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SyntheticDataService>::set_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 = SetConfigSvc(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)
}
"/synth.SyntheticDataService/GetMetrics" => {
#[allow(non_camel_case_types)]
struct GetMetricsSvc<T: SyntheticDataService>(pub Arc<T>);
impl<T: SyntheticDataService> tonic::server::UnaryService<()>
for GetMetricsSvc<T> {
type Response = super::MetricsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SyntheticDataService>::get_metrics(&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 = GetMetricsSvc(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)
}
"/synth.SyntheticDataService/HealthCheck" => {
#[allow(non_camel_case_types)]
struct HealthCheckSvc<T: SyntheticDataService>(pub Arc<T>);
impl<T: SyntheticDataService> tonic::server::UnaryService<()>
for HealthCheckSvc<T> {
type Response = super::HealthResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SyntheticDataService>::health_check(&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 = HealthCheckSvc(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 SyntheticDataServiceServer<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,
}
}
}
pub const SERVICE_NAME: &str = "synth.SyntheticDataService";
impl<T> tonic::server::NamedService for SyntheticDataServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}