1#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct BulkGenerateRequest {
4 #[prost(message, optional, tag = "1")]
6 pub config: ::core::option::Option<GenerationConfig>,
7 #[prost(uint64, tag = "2")]
9 pub entry_count: u64,
10 #[prost(enumeration = "OutputFormat", tag = "3")]
12 pub output_format: i32,
13 #[prost(bool, tag = "4")]
15 pub include_master_data: bool,
16 #[prost(bool, tag = "5")]
18 pub inject_anomalies: bool,
19}
20#[derive(Clone, PartialEq, ::prost::Message)]
21pub struct BulkGenerateResponse {
22 #[prost(uint64, tag = "1")]
24 pub entries_generated: u64,
25 #[prost(uint64, tag = "2")]
27 pub duration_ms: u64,
28 #[prost(message, repeated, tag = "3")]
30 pub journal_entries: ::prost::alloc::vec::Vec<JournalEntryProto>,
31 #[prost(message, repeated, tag = "4")]
33 pub anomaly_labels: ::prost::alloc::vec::Vec<AnomalyLabelProto>,
34 #[prost(message, optional, tag = "5")]
36 pub stats: ::core::option::Option<GenerationStats>,
37}
38#[derive(Clone, PartialEq, ::prost::Message)]
39pub struct StreamDataRequest {
40 #[prost(message, optional, tag = "1")]
42 pub config: ::core::option::Option<GenerationConfig>,
43 #[prost(uint32, tag = "2")]
45 pub events_per_second: u32,
46 #[prost(uint64, tag = "3")]
48 pub max_events: u64,
49 #[prost(bool, tag = "4")]
51 pub inject_anomalies: bool,
52 #[prost(float, tag = "5")]
54 pub anomaly_rate: f32,
55}
56#[derive(Clone, PartialEq, ::prost::Message)]
57pub struct DataEvent {
58 #[prost(uint64, tag = "1")]
60 pub sequence: u64,
61 #[prost(message, optional, tag = "2")]
63 pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
64 #[prost(oneof = "data_event::Event", tags = "3, 4, 5, 6, 7")]
66 pub event: ::core::option::Option<data_event::Event>,
67}
68pub mod data_event {
70 #[derive(Clone, PartialEq, ::prost::Oneof)]
72 pub enum Event {
73 #[prost(message, tag = "3")]
74 JournalEntry(super::JournalEntryProto),
75 #[prost(message, tag = "4")]
76 MasterData(super::MasterDataEvent),
77 #[prost(message, tag = "5")]
78 DocumentFlow(super::DocumentFlowEvent),
79 #[prost(message, tag = "6")]
80 Anomaly(super::AnomalyEvent),
81 #[prost(message, tag = "7")]
82 Metrics(super::MetricsEvent),
83 }
84}
85#[derive(Clone, PartialEq, ::prost::Message)]
86pub struct JournalEntryProto {
87 #[prost(string, tag = "1")]
88 pub document_id: ::prost::alloc::string::String,
89 #[prost(string, tag = "2")]
90 pub company_code: ::prost::alloc::string::String,
91 #[prost(uint32, tag = "3")]
92 pub fiscal_year: u32,
93 #[prost(uint32, tag = "4")]
94 pub fiscal_period: u32,
95 #[prost(string, tag = "5")]
96 pub posting_date: ::prost::alloc::string::String,
97 #[prost(string, tag = "6")]
98 pub document_date: ::prost::alloc::string::String,
99 #[prost(string, tag = "7")]
100 pub created_at: ::prost::alloc::string::String,
101 #[prost(string, tag = "8")]
102 pub source: ::prost::alloc::string::String,
103 #[prost(string, optional, tag = "9")]
104 pub business_process: ::core::option::Option<::prost::alloc::string::String>,
105 #[prost(message, repeated, tag = "10")]
106 pub lines: ::prost::alloc::vec::Vec<JournalLineProto>,
107 #[prost(bool, tag = "11")]
108 pub is_anomaly: bool,
109 #[prost(string, optional, tag = "12")]
110 pub anomaly_type: ::core::option::Option<::prost::alloc::string::String>,
111}
112#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
113pub struct JournalLineProto {
114 #[prost(uint32, tag = "1")]
115 pub line_number: u32,
116 #[prost(string, tag = "2")]
117 pub account_number: ::prost::alloc::string::String,
118 #[prost(string, tag = "3")]
119 pub account_name: ::prost::alloc::string::String,
120 #[prost(string, tag = "4")]
122 pub amount: ::prost::alloc::string::String,
123 #[prost(bool, tag = "5")]
124 pub is_debit: bool,
125 #[prost(string, optional, tag = "6")]
126 pub cost_center: ::core::option::Option<::prost::alloc::string::String>,
127 #[prost(string, optional, tag = "7")]
128 pub profit_center: ::core::option::Option<::prost::alloc::string::String>,
129 #[prost(string, optional, tag = "8")]
130 pub vendor_id: ::core::option::Option<::prost::alloc::string::String>,
131 #[prost(string, optional, tag = "9")]
132 pub customer_id: ::core::option::Option<::prost::alloc::string::String>,
133 #[prost(string, optional, tag = "10")]
134 pub material_id: ::core::option::Option<::prost::alloc::string::String>,
135 #[prost(string, optional, tag = "11")]
136 pub text: ::core::option::Option<::prost::alloc::string::String>,
137}
138#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
139pub struct MasterDataEvent {
140 #[prost(oneof = "master_data_event::Data", tags = "1, 2, 3, 4, 5")]
141 pub data: ::core::option::Option<master_data_event::Data>,
142}
143pub mod master_data_event {
145 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
146 pub enum Data {
147 #[prost(message, tag = "1")]
148 Vendor(super::VendorProto),
149 #[prost(message, tag = "2")]
150 Customer(super::CustomerProto),
151 #[prost(message, tag = "3")]
152 Material(super::MaterialProto),
153 #[prost(message, tag = "4")]
154 FixedAsset(super::FixedAssetProto),
155 #[prost(message, tag = "5")]
156 Employee(super::EmployeeProto),
157 }
158}
159#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
160pub struct VendorProto {
161 #[prost(string, tag = "1")]
162 pub vendor_id: ::prost::alloc::string::String,
163 #[prost(string, tag = "2")]
164 pub name: ::prost::alloc::string::String,
165 #[prost(string, tag = "3")]
166 pub country: ::prost::alloc::string::String,
167 #[prost(string, tag = "4")]
168 pub currency: ::prost::alloc::string::String,
169 #[prost(string, tag = "5")]
170 pub payment_terms: ::prost::alloc::string::String,
171 #[prost(bool, tag = "6")]
172 pub is_intercompany: bool,
173}
174#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
175pub struct CustomerProto {
176 #[prost(string, tag = "1")]
177 pub customer_id: ::prost::alloc::string::String,
178 #[prost(string, tag = "2")]
179 pub name: ::prost::alloc::string::String,
180 #[prost(string, tag = "3")]
181 pub country: ::prost::alloc::string::String,
182 #[prost(string, tag = "4")]
183 pub currency: ::prost::alloc::string::String,
184 #[prost(string, tag = "5")]
185 pub credit_rating: ::prost::alloc::string::String,
186 #[prost(string, tag = "6")]
187 pub credit_limit: ::prost::alloc::string::String,
188 #[prost(bool, tag = "7")]
189 pub is_intercompany: bool,
190}
191#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
192pub struct MaterialProto {
193 #[prost(string, tag = "1")]
194 pub material_id: ::prost::alloc::string::String,
195 #[prost(string, tag = "2")]
196 pub description: ::prost::alloc::string::String,
197 #[prost(string, tag = "3")]
198 pub material_type: ::prost::alloc::string::String,
199 #[prost(string, tag = "4")]
200 pub unit_of_measure: ::prost::alloc::string::String,
201 #[prost(string, tag = "5")]
202 pub standard_cost: ::prost::alloc::string::String,
203}
204#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
205pub struct FixedAssetProto {
206 #[prost(string, tag = "1")]
207 pub asset_id: ::prost::alloc::string::String,
208 #[prost(string, tag = "2")]
209 pub description: ::prost::alloc::string::String,
210 #[prost(string, tag = "3")]
211 pub asset_class: ::prost::alloc::string::String,
212 #[prost(string, tag = "4")]
213 pub acquisition_value: ::prost::alloc::string::String,
214 #[prost(string, tag = "5")]
215 pub acquisition_date: ::prost::alloc::string::String,
216 #[prost(uint32, tag = "6")]
217 pub useful_life_months: u32,
218}
219#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
220pub struct EmployeeProto {
221 #[prost(string, tag = "1")]
222 pub employee_id: ::prost::alloc::string::String,
223 #[prost(string, tag = "2")]
224 pub name: ::prost::alloc::string::String,
225 #[prost(string, tag = "3")]
226 pub department: ::prost::alloc::string::String,
227 #[prost(string, tag = "4")]
228 pub job_title: ::prost::alloc::string::String,
229 #[prost(string, optional, tag = "5")]
230 pub manager_id: ::core::option::Option<::prost::alloc::string::String>,
231}
232#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
233pub struct DocumentFlowEvent {
234 #[prost(string, tag = "1")]
235 pub document_type: ::prost::alloc::string::String,
236 #[prost(string, tag = "2")]
237 pub document_id: ::prost::alloc::string::String,
238 #[prost(string, tag = "3")]
239 pub company_code: ::prost::alloc::string::String,
240 #[prost(string, tag = "4")]
241 pub document_date: ::prost::alloc::string::String,
242 #[prost(string, optional, tag = "5")]
243 pub reference_document: ::core::option::Option<::prost::alloc::string::String>,
244 #[prost(string, tag = "6")]
245 pub total_amount: ::prost::alloc::string::String,
246 #[prost(string, tag = "7")]
247 pub currency: ::prost::alloc::string::String,
248}
249#[derive(Clone, PartialEq, ::prost::Message)]
250pub struct AnomalyEvent {
251 #[prost(string, tag = "1")]
252 pub anomaly_id: ::prost::alloc::string::String,
253 #[prost(string, tag = "2")]
254 pub anomaly_type: ::prost::alloc::string::String,
255 #[prost(string, tag = "3")]
256 pub document_id: ::prost::alloc::string::String,
257 #[prost(string, tag = "4")]
258 pub description: ::prost::alloc::string::String,
259 #[prost(float, tag = "5")]
260 pub severity_score: f32,
261}
262#[derive(Clone, Copy, PartialEq, ::prost::Message)]
263pub struct MetricsEvent {
264 #[prost(uint64, tag = "1")]
265 pub total_entries: u64,
266 #[prost(uint64, tag = "2")]
267 pub entries_per_second: u64,
268 #[prost(float, tag = "3")]
269 pub anomaly_rate: f32,
270 #[prost(uint64, tag = "4")]
271 pub uptime_seconds: u64,
272}
273#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
274pub struct ControlCommand {
275 #[prost(enumeration = "ControlAction", tag = "1")]
276 pub action: i32,
277 #[prost(string, optional, tag = "2")]
279 pub pattern_name: ::core::option::Option<::prost::alloc::string::String>,
280}
281#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
282pub struct ControlResponse {
283 #[prost(bool, tag = "1")]
284 pub success: bool,
285 #[prost(string, tag = "2")]
286 pub message: ::prost::alloc::string::String,
287 #[prost(enumeration = "StreamStatus", tag = "3")]
288 pub current_status: i32,
289}
290#[derive(Clone, PartialEq, ::prost::Message)]
291pub struct GenerationConfig {
292 #[prost(string, tag = "1")]
294 pub industry: ::prost::alloc::string::String,
295 #[prost(string, tag = "2")]
297 pub start_date: ::prost::alloc::string::String,
298 #[prost(uint32, tag = "3")]
300 pub period_months: u32,
301 #[prost(uint64, tag = "4")]
303 pub seed: u64,
304 #[prost(string, tag = "5")]
306 pub coa_complexity: ::prost::alloc::string::String,
307 #[prost(message, repeated, tag = "6")]
309 pub companies: ::prost::alloc::vec::Vec<CompanyConfigProto>,
310 #[prost(bool, tag = "7")]
312 pub fraud_enabled: bool,
313 #[prost(float, tag = "8")]
315 pub fraud_rate: f32,
316 #[prost(bool, tag = "9")]
318 pub generate_master_data: bool,
319 #[prost(bool, tag = "10")]
321 pub generate_document_flows: bool,
322}
323#[derive(Clone, PartialEq, ::prost::Message)]
324pub struct CompanyConfigProto {
325 #[prost(string, tag = "1")]
326 pub code: ::prost::alloc::string::String,
327 #[prost(string, tag = "2")]
328 pub name: ::prost::alloc::string::String,
329 #[prost(string, tag = "3")]
330 pub currency: ::prost::alloc::string::String,
331 #[prost(string, tag = "4")]
332 pub country: ::prost::alloc::string::String,
333 #[prost(uint64, tag = "5")]
334 pub annual_transaction_volume: u64,
335 #[prost(float, tag = "6")]
336 pub volume_weight: f32,
337}
338#[derive(Clone, PartialEq, ::prost::Message)]
339pub struct ConfigRequest {
340 #[prost(message, optional, tag = "1")]
341 pub config: ::core::option::Option<GenerationConfig>,
342}
343#[derive(Clone, PartialEq, ::prost::Message)]
344pub struct ConfigResponse {
345 #[prost(bool, tag = "1")]
346 pub success: bool,
347 #[prost(string, tag = "2")]
348 pub message: ::prost::alloc::string::String,
349 #[prost(message, optional, tag = "3")]
350 pub current_config: ::core::option::Option<GenerationConfig>,
351}
352#[derive(Clone, Copy, PartialEq, ::prost::Message)]
353pub struct MetricsResponse {
354 #[prost(uint64, tag = "1")]
356 pub total_entries_generated: u64,
357 #[prost(uint64, tag = "2")]
358 pub total_anomalies_injected: u64,
359 #[prost(uint64, tag = "3")]
360 pub uptime_seconds: u64,
361 #[prost(uint64, tag = "4")]
363 pub session_entries: u64,
364 #[prost(double, tag = "5")]
365 pub session_entries_per_second: f64,
366 #[prost(uint32, tag = "6")]
368 pub active_streams: u32,
369 #[prost(uint64, tag = "7")]
370 pub total_stream_events: u64,
371}
372#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
373pub struct HealthResponse {
374 #[prost(bool, tag = "1")]
375 pub healthy: bool,
376 #[prost(string, tag = "2")]
377 pub version: ::prost::alloc::string::String,
378 #[prost(uint64, tag = "3")]
379 pub uptime_seconds: u64,
380}
381#[derive(Clone, PartialEq, ::prost::Message)]
382pub struct GenerationStats {
383 #[prost(uint64, tag = "1")]
384 pub total_entries: u64,
385 #[prost(uint64, tag = "2")]
386 pub total_lines: u64,
387 #[prost(string, tag = "3")]
388 pub total_debit_amount: ::prost::alloc::string::String,
389 #[prost(string, tag = "4")]
390 pub total_credit_amount: ::prost::alloc::string::String,
391 #[prost(uint64, tag = "5")]
392 pub anomaly_count: u64,
393 #[prost(map = "string, uint64", tag = "6")]
394 pub entries_by_company: ::std::collections::HashMap<
395 ::prost::alloc::string::String,
396 u64,
397 >,
398 #[prost(map = "string, uint64", tag = "7")]
399 pub entries_by_source: ::std::collections::HashMap<
400 ::prost::alloc::string::String,
401 u64,
402 >,
403}
404#[derive(Clone, PartialEq, ::prost::Message)]
405pub struct AnomalyLabelProto {
406 #[prost(string, tag = "1")]
407 pub anomaly_id: ::prost::alloc::string::String,
408 #[prost(string, tag = "2")]
409 pub document_id: ::prost::alloc::string::String,
410 #[prost(string, tag = "3")]
411 pub anomaly_type: ::prost::alloc::string::String,
412 #[prost(string, tag = "4")]
413 pub anomaly_category: ::prost::alloc::string::String,
414 #[prost(string, tag = "5")]
415 pub description: ::prost::alloc::string::String,
416 #[prost(float, tag = "6")]
417 pub severity_score: f32,
418}
419#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
420#[repr(i32)]
421pub enum ControlAction {
422 Unspecified = 0,
423 Pause = 1,
424 Resume = 2,
425 Stop = 3,
426 TriggerPattern = 4,
428}
429impl ControlAction {
430 pub fn as_str_name(&self) -> &'static str {
435 match self {
436 Self::Unspecified => "CONTROL_ACTION_UNSPECIFIED",
437 Self::Pause => "PAUSE",
438 Self::Resume => "RESUME",
439 Self::Stop => "STOP",
440 Self::TriggerPattern => "TRIGGER_PATTERN",
441 }
442 }
443 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
445 match value {
446 "CONTROL_ACTION_UNSPECIFIED" => Some(Self::Unspecified),
447 "PAUSE" => Some(Self::Pause),
448 "RESUME" => Some(Self::Resume),
449 "STOP" => Some(Self::Stop),
450 "TRIGGER_PATTERN" => Some(Self::TriggerPattern),
451 _ => None,
452 }
453 }
454}
455#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
456#[repr(i32)]
457pub enum StreamStatus {
458 Unspecified = 0,
459 Running = 1,
460 Paused = 2,
461 Stopped = 3,
462}
463impl StreamStatus {
464 pub fn as_str_name(&self) -> &'static str {
469 match self {
470 Self::Unspecified => "STREAM_STATUS_UNSPECIFIED",
471 Self::Running => "RUNNING",
472 Self::Paused => "PAUSED",
473 Self::Stopped => "STOPPED",
474 }
475 }
476 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
478 match value {
479 "STREAM_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
480 "RUNNING" => Some(Self::Running),
481 "PAUSED" => Some(Self::Paused),
482 "STOPPED" => Some(Self::Stopped),
483 _ => None,
484 }
485 }
486}
487#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
488#[repr(i32)]
489pub enum OutputFormat {
490 Unspecified = 0,
491 Json = 1,
492 Protobuf = 2,
493 Csv = 3,
494 Parquet = 4,
495}
496impl OutputFormat {
497 pub fn as_str_name(&self) -> &'static str {
502 match self {
503 Self::Unspecified => "OUTPUT_FORMAT_UNSPECIFIED",
504 Self::Json => "JSON",
505 Self::Protobuf => "PROTOBUF",
506 Self::Csv => "CSV",
507 Self::Parquet => "PARQUET",
508 }
509 }
510 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
512 match value {
513 "OUTPUT_FORMAT_UNSPECIFIED" => Some(Self::Unspecified),
514 "JSON" => Some(Self::Json),
515 "PROTOBUF" => Some(Self::Protobuf),
516 "CSV" => Some(Self::Csv),
517 "PARQUET" => Some(Self::Parquet),
518 _ => None,
519 }
520 }
521}
522pub mod synthetic_data_service_client {
524 #![allow(
525 unused_variables,
526 dead_code,
527 missing_docs,
528 clippy::wildcard_imports,
529 clippy::let_unit_value,
530 )]
531 use tonic::codegen::*;
532 use tonic::codegen::http::Uri;
533 #[derive(Debug, Clone)]
535 pub struct SyntheticDataServiceClient<T> {
536 inner: tonic::client::Grpc<T>,
537 }
538 impl SyntheticDataServiceClient<tonic::transport::Channel> {
539 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
541 where
542 D: TryInto<tonic::transport::Endpoint>,
543 D::Error: Into<StdError>,
544 {
545 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
546 Ok(Self::new(conn))
547 }
548 }
549 impl<T> SyntheticDataServiceClient<T>
550 where
551 T: tonic::client::GrpcService<tonic::body::Body>,
552 T::Error: Into<StdError>,
553 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
554 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
555 {
556 pub fn new(inner: T) -> Self {
557 let inner = tonic::client::Grpc::new(inner);
558 Self { inner }
559 }
560 pub fn with_origin(inner: T, origin: Uri) -> Self {
561 let inner = tonic::client::Grpc::with_origin(inner, origin);
562 Self { inner }
563 }
564 pub fn with_interceptor<F>(
565 inner: T,
566 interceptor: F,
567 ) -> SyntheticDataServiceClient<InterceptedService<T, F>>
568 where
569 F: tonic::service::Interceptor,
570 T::ResponseBody: Default,
571 T: tonic::codegen::Service<
572 http::Request<tonic::body::Body>,
573 Response = http::Response<
574 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
575 >,
576 >,
577 <T as tonic::codegen::Service<
578 http::Request<tonic::body::Body>,
579 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
580 {
581 SyntheticDataServiceClient::new(InterceptedService::new(inner, interceptor))
582 }
583 #[must_use]
588 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
589 self.inner = self.inner.send_compressed(encoding);
590 self
591 }
592 #[must_use]
594 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
595 self.inner = self.inner.accept_compressed(encoding);
596 self
597 }
598 #[must_use]
602 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
603 self.inner = self.inner.max_decoding_message_size(limit);
604 self
605 }
606 #[must_use]
610 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
611 self.inner = self.inner.max_encoding_message_size(limit);
612 self
613 }
614 pub async fn bulk_generate(
616 &mut self,
617 request: impl tonic::IntoRequest<super::BulkGenerateRequest>,
618 ) -> std::result::Result<
619 tonic::Response<super::BulkGenerateResponse>,
620 tonic::Status,
621 > {
622 self.inner
623 .ready()
624 .await
625 .map_err(|e| {
626 tonic::Status::unknown(
627 format!("Service was not ready: {}", e.into()),
628 )
629 })?;
630 let codec = tonic_prost::ProstCodec::default();
631 let path = http::uri::PathAndQuery::from_static(
632 "/synth.SyntheticDataService/BulkGenerate",
633 );
634 let mut req = request.into_request();
635 req.extensions_mut()
636 .insert(GrpcMethod::new("synth.SyntheticDataService", "BulkGenerate"));
637 self.inner.unary(req, path, codec).await
638 }
639 pub async fn stream_data(
641 &mut self,
642 request: impl tonic::IntoRequest<super::StreamDataRequest>,
643 ) -> std::result::Result<
644 tonic::Response<tonic::codec::Streaming<super::DataEvent>>,
645 tonic::Status,
646 > {
647 self.inner
648 .ready()
649 .await
650 .map_err(|e| {
651 tonic::Status::unknown(
652 format!("Service was not ready: {}", e.into()),
653 )
654 })?;
655 let codec = tonic_prost::ProstCodec::default();
656 let path = http::uri::PathAndQuery::from_static(
657 "/synth.SyntheticDataService/StreamData",
658 );
659 let mut req = request.into_request();
660 req.extensions_mut()
661 .insert(GrpcMethod::new("synth.SyntheticDataService", "StreamData"));
662 self.inner.server_streaming(req, path, codec).await
663 }
664 pub async fn control(
666 &mut self,
667 request: impl tonic::IntoRequest<super::ControlCommand>,
668 ) -> std::result::Result<
669 tonic::Response<super::ControlResponse>,
670 tonic::Status,
671 > {
672 self.inner
673 .ready()
674 .await
675 .map_err(|e| {
676 tonic::Status::unknown(
677 format!("Service was not ready: {}", e.into()),
678 )
679 })?;
680 let codec = tonic_prost::ProstCodec::default();
681 let path = http::uri::PathAndQuery::from_static(
682 "/synth.SyntheticDataService/Control",
683 );
684 let mut req = request.into_request();
685 req.extensions_mut()
686 .insert(GrpcMethod::new("synth.SyntheticDataService", "Control"));
687 self.inner.unary(req, path, codec).await
688 }
689 pub async fn get_config(
691 &mut self,
692 request: impl tonic::IntoRequest<()>,
693 ) -> std::result::Result<tonic::Response<super::ConfigResponse>, tonic::Status> {
694 self.inner
695 .ready()
696 .await
697 .map_err(|e| {
698 tonic::Status::unknown(
699 format!("Service was not ready: {}", e.into()),
700 )
701 })?;
702 let codec = tonic_prost::ProstCodec::default();
703 let path = http::uri::PathAndQuery::from_static(
704 "/synth.SyntheticDataService/GetConfig",
705 );
706 let mut req = request.into_request();
707 req.extensions_mut()
708 .insert(GrpcMethod::new("synth.SyntheticDataService", "GetConfig"));
709 self.inner.unary(req, path, codec).await
710 }
711 pub async fn set_config(
712 &mut self,
713 request: impl tonic::IntoRequest<super::ConfigRequest>,
714 ) -> std::result::Result<tonic::Response<super::ConfigResponse>, tonic::Status> {
715 self.inner
716 .ready()
717 .await
718 .map_err(|e| {
719 tonic::Status::unknown(
720 format!("Service was not ready: {}", e.into()),
721 )
722 })?;
723 let codec = tonic_prost::ProstCodec::default();
724 let path = http::uri::PathAndQuery::from_static(
725 "/synth.SyntheticDataService/SetConfig",
726 );
727 let mut req = request.into_request();
728 req.extensions_mut()
729 .insert(GrpcMethod::new("synth.SyntheticDataService", "SetConfig"));
730 self.inner.unary(req, path, codec).await
731 }
732 pub async fn get_metrics(
734 &mut self,
735 request: impl tonic::IntoRequest<()>,
736 ) -> std::result::Result<
737 tonic::Response<super::MetricsResponse>,
738 tonic::Status,
739 > {
740 self.inner
741 .ready()
742 .await
743 .map_err(|e| {
744 tonic::Status::unknown(
745 format!("Service was not ready: {}", e.into()),
746 )
747 })?;
748 let codec = tonic_prost::ProstCodec::default();
749 let path = http::uri::PathAndQuery::from_static(
750 "/synth.SyntheticDataService/GetMetrics",
751 );
752 let mut req = request.into_request();
753 req.extensions_mut()
754 .insert(GrpcMethod::new("synth.SyntheticDataService", "GetMetrics"));
755 self.inner.unary(req, path, codec).await
756 }
757 pub async fn health_check(
758 &mut self,
759 request: impl tonic::IntoRequest<()>,
760 ) -> std::result::Result<tonic::Response<super::HealthResponse>, tonic::Status> {
761 self.inner
762 .ready()
763 .await
764 .map_err(|e| {
765 tonic::Status::unknown(
766 format!("Service was not ready: {}", e.into()),
767 )
768 })?;
769 let codec = tonic_prost::ProstCodec::default();
770 let path = http::uri::PathAndQuery::from_static(
771 "/synth.SyntheticDataService/HealthCheck",
772 );
773 let mut req = request.into_request();
774 req.extensions_mut()
775 .insert(GrpcMethod::new("synth.SyntheticDataService", "HealthCheck"));
776 self.inner.unary(req, path, codec).await
777 }
778 }
779}
780pub mod synthetic_data_service_server {
782 #![allow(
783 unused_variables,
784 dead_code,
785 missing_docs,
786 clippy::wildcard_imports,
787 clippy::let_unit_value,
788 )]
789 use tonic::codegen::*;
790 #[async_trait]
792 pub trait SyntheticDataService: std::marker::Send + std::marker::Sync + 'static {
793 async fn bulk_generate(
795 &self,
796 request: tonic::Request<super::BulkGenerateRequest>,
797 ) -> std::result::Result<
798 tonic::Response<super::BulkGenerateResponse>,
799 tonic::Status,
800 >;
801 type StreamDataStream: tonic::codegen::tokio_stream::Stream<
803 Item = std::result::Result<super::DataEvent, tonic::Status>,
804 >
805 + std::marker::Send
806 + 'static;
807 async fn stream_data(
809 &self,
810 request: tonic::Request<super::StreamDataRequest>,
811 ) -> std::result::Result<tonic::Response<Self::StreamDataStream>, tonic::Status>;
812 async fn control(
814 &self,
815 request: tonic::Request<super::ControlCommand>,
816 ) -> std::result::Result<tonic::Response<super::ControlResponse>, tonic::Status>;
817 async fn get_config(
819 &self,
820 request: tonic::Request<()>,
821 ) -> std::result::Result<tonic::Response<super::ConfigResponse>, tonic::Status>;
822 async fn set_config(
823 &self,
824 request: tonic::Request<super::ConfigRequest>,
825 ) -> std::result::Result<tonic::Response<super::ConfigResponse>, tonic::Status>;
826 async fn get_metrics(
828 &self,
829 request: tonic::Request<()>,
830 ) -> std::result::Result<tonic::Response<super::MetricsResponse>, tonic::Status>;
831 async fn health_check(
832 &self,
833 request: tonic::Request<()>,
834 ) -> std::result::Result<tonic::Response<super::HealthResponse>, tonic::Status>;
835 }
836 #[derive(Debug)]
838 pub struct SyntheticDataServiceServer<T> {
839 inner: Arc<T>,
840 accept_compression_encodings: EnabledCompressionEncodings,
841 send_compression_encodings: EnabledCompressionEncodings,
842 max_decoding_message_size: Option<usize>,
843 max_encoding_message_size: Option<usize>,
844 }
845 impl<T> SyntheticDataServiceServer<T> {
846 pub fn new(inner: T) -> Self {
847 Self::from_arc(Arc::new(inner))
848 }
849 pub fn from_arc(inner: Arc<T>) -> Self {
850 Self {
851 inner,
852 accept_compression_encodings: Default::default(),
853 send_compression_encodings: Default::default(),
854 max_decoding_message_size: None,
855 max_encoding_message_size: None,
856 }
857 }
858 pub fn with_interceptor<F>(
859 inner: T,
860 interceptor: F,
861 ) -> InterceptedService<Self, F>
862 where
863 F: tonic::service::Interceptor,
864 {
865 InterceptedService::new(Self::new(inner), interceptor)
866 }
867 #[must_use]
869 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
870 self.accept_compression_encodings.enable(encoding);
871 self
872 }
873 #[must_use]
875 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
876 self.send_compression_encodings.enable(encoding);
877 self
878 }
879 #[must_use]
883 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
884 self.max_decoding_message_size = Some(limit);
885 self
886 }
887 #[must_use]
891 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
892 self.max_encoding_message_size = Some(limit);
893 self
894 }
895 }
896 impl<T, B> tonic::codegen::Service<http::Request<B>>
897 for SyntheticDataServiceServer<T>
898 where
899 T: SyntheticDataService,
900 B: Body + std::marker::Send + 'static,
901 B::Error: Into<StdError> + std::marker::Send + 'static,
902 {
903 type Response = http::Response<tonic::body::Body>;
904 type Error = std::convert::Infallible;
905 type Future = BoxFuture<Self::Response, Self::Error>;
906 fn poll_ready(
907 &mut self,
908 _cx: &mut Context<'_>,
909 ) -> Poll<std::result::Result<(), Self::Error>> {
910 Poll::Ready(Ok(()))
911 }
912 fn call(&mut self, req: http::Request<B>) -> Self::Future {
913 match req.uri().path() {
914 "/synth.SyntheticDataService/BulkGenerate" => {
915 #[allow(non_camel_case_types)]
916 struct BulkGenerateSvc<T: SyntheticDataService>(pub Arc<T>);
917 impl<
918 T: SyntheticDataService,
919 > tonic::server::UnaryService<super::BulkGenerateRequest>
920 for BulkGenerateSvc<T> {
921 type Response = super::BulkGenerateResponse;
922 type Future = BoxFuture<
923 tonic::Response<Self::Response>,
924 tonic::Status,
925 >;
926 fn call(
927 &mut self,
928 request: tonic::Request<super::BulkGenerateRequest>,
929 ) -> Self::Future {
930 let inner = Arc::clone(&self.0);
931 let fut = async move {
932 <T as SyntheticDataService>::bulk_generate(&inner, request)
933 .await
934 };
935 Box::pin(fut)
936 }
937 }
938 let accept_compression_encodings = self.accept_compression_encodings;
939 let send_compression_encodings = self.send_compression_encodings;
940 let max_decoding_message_size = self.max_decoding_message_size;
941 let max_encoding_message_size = self.max_encoding_message_size;
942 let inner = self.inner.clone();
943 let fut = async move {
944 let method = BulkGenerateSvc(inner);
945 let codec = tonic_prost::ProstCodec::default();
946 let mut grpc = tonic::server::Grpc::new(codec)
947 .apply_compression_config(
948 accept_compression_encodings,
949 send_compression_encodings,
950 )
951 .apply_max_message_size_config(
952 max_decoding_message_size,
953 max_encoding_message_size,
954 );
955 let res = grpc.unary(method, req).await;
956 Ok(res)
957 };
958 Box::pin(fut)
959 }
960 "/synth.SyntheticDataService/StreamData" => {
961 #[allow(non_camel_case_types)]
962 struct StreamDataSvc<T: SyntheticDataService>(pub Arc<T>);
963 impl<
964 T: SyntheticDataService,
965 > tonic::server::ServerStreamingService<super::StreamDataRequest>
966 for StreamDataSvc<T> {
967 type Response = super::DataEvent;
968 type ResponseStream = T::StreamDataStream;
969 type Future = BoxFuture<
970 tonic::Response<Self::ResponseStream>,
971 tonic::Status,
972 >;
973 fn call(
974 &mut self,
975 request: tonic::Request<super::StreamDataRequest>,
976 ) -> Self::Future {
977 let inner = Arc::clone(&self.0);
978 let fut = async move {
979 <T as SyntheticDataService>::stream_data(&inner, request)
980 .await
981 };
982 Box::pin(fut)
983 }
984 }
985 let accept_compression_encodings = self.accept_compression_encodings;
986 let send_compression_encodings = self.send_compression_encodings;
987 let max_decoding_message_size = self.max_decoding_message_size;
988 let max_encoding_message_size = self.max_encoding_message_size;
989 let inner = self.inner.clone();
990 let fut = async move {
991 let method = StreamDataSvc(inner);
992 let codec = tonic_prost::ProstCodec::default();
993 let mut grpc = tonic::server::Grpc::new(codec)
994 .apply_compression_config(
995 accept_compression_encodings,
996 send_compression_encodings,
997 )
998 .apply_max_message_size_config(
999 max_decoding_message_size,
1000 max_encoding_message_size,
1001 );
1002 let res = grpc.server_streaming(method, req).await;
1003 Ok(res)
1004 };
1005 Box::pin(fut)
1006 }
1007 "/synth.SyntheticDataService/Control" => {
1008 #[allow(non_camel_case_types)]
1009 struct ControlSvc<T: SyntheticDataService>(pub Arc<T>);
1010 impl<
1011 T: SyntheticDataService,
1012 > tonic::server::UnaryService<super::ControlCommand>
1013 for ControlSvc<T> {
1014 type Response = super::ControlResponse;
1015 type Future = BoxFuture<
1016 tonic::Response<Self::Response>,
1017 tonic::Status,
1018 >;
1019 fn call(
1020 &mut self,
1021 request: tonic::Request<super::ControlCommand>,
1022 ) -> Self::Future {
1023 let inner = Arc::clone(&self.0);
1024 let fut = async move {
1025 <T as SyntheticDataService>::control(&inner, request).await
1026 };
1027 Box::pin(fut)
1028 }
1029 }
1030 let accept_compression_encodings = self.accept_compression_encodings;
1031 let send_compression_encodings = self.send_compression_encodings;
1032 let max_decoding_message_size = self.max_decoding_message_size;
1033 let max_encoding_message_size = self.max_encoding_message_size;
1034 let inner = self.inner.clone();
1035 let fut = async move {
1036 let method = ControlSvc(inner);
1037 let codec = tonic_prost::ProstCodec::default();
1038 let mut grpc = tonic::server::Grpc::new(codec)
1039 .apply_compression_config(
1040 accept_compression_encodings,
1041 send_compression_encodings,
1042 )
1043 .apply_max_message_size_config(
1044 max_decoding_message_size,
1045 max_encoding_message_size,
1046 );
1047 let res = grpc.unary(method, req).await;
1048 Ok(res)
1049 };
1050 Box::pin(fut)
1051 }
1052 "/synth.SyntheticDataService/GetConfig" => {
1053 #[allow(non_camel_case_types)]
1054 struct GetConfigSvc<T: SyntheticDataService>(pub Arc<T>);
1055 impl<T: SyntheticDataService> tonic::server::UnaryService<()>
1056 for GetConfigSvc<T> {
1057 type Response = super::ConfigResponse;
1058 type Future = BoxFuture<
1059 tonic::Response<Self::Response>,
1060 tonic::Status,
1061 >;
1062 fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
1063 let inner = Arc::clone(&self.0);
1064 let fut = async move {
1065 <T as SyntheticDataService>::get_config(&inner, request)
1066 .await
1067 };
1068 Box::pin(fut)
1069 }
1070 }
1071 let accept_compression_encodings = self.accept_compression_encodings;
1072 let send_compression_encodings = self.send_compression_encodings;
1073 let max_decoding_message_size = self.max_decoding_message_size;
1074 let max_encoding_message_size = self.max_encoding_message_size;
1075 let inner = self.inner.clone();
1076 let fut = async move {
1077 let method = GetConfigSvc(inner);
1078 let codec = tonic_prost::ProstCodec::default();
1079 let mut grpc = tonic::server::Grpc::new(codec)
1080 .apply_compression_config(
1081 accept_compression_encodings,
1082 send_compression_encodings,
1083 )
1084 .apply_max_message_size_config(
1085 max_decoding_message_size,
1086 max_encoding_message_size,
1087 );
1088 let res = grpc.unary(method, req).await;
1089 Ok(res)
1090 };
1091 Box::pin(fut)
1092 }
1093 "/synth.SyntheticDataService/SetConfig" => {
1094 #[allow(non_camel_case_types)]
1095 struct SetConfigSvc<T: SyntheticDataService>(pub Arc<T>);
1096 impl<
1097 T: SyntheticDataService,
1098 > tonic::server::UnaryService<super::ConfigRequest>
1099 for SetConfigSvc<T> {
1100 type Response = super::ConfigResponse;
1101 type Future = BoxFuture<
1102 tonic::Response<Self::Response>,
1103 tonic::Status,
1104 >;
1105 fn call(
1106 &mut self,
1107 request: tonic::Request<super::ConfigRequest>,
1108 ) -> Self::Future {
1109 let inner = Arc::clone(&self.0);
1110 let fut = async move {
1111 <T as SyntheticDataService>::set_config(&inner, request)
1112 .await
1113 };
1114 Box::pin(fut)
1115 }
1116 }
1117 let accept_compression_encodings = self.accept_compression_encodings;
1118 let send_compression_encodings = self.send_compression_encodings;
1119 let max_decoding_message_size = self.max_decoding_message_size;
1120 let max_encoding_message_size = self.max_encoding_message_size;
1121 let inner = self.inner.clone();
1122 let fut = async move {
1123 let method = SetConfigSvc(inner);
1124 let codec = tonic_prost::ProstCodec::default();
1125 let mut grpc = tonic::server::Grpc::new(codec)
1126 .apply_compression_config(
1127 accept_compression_encodings,
1128 send_compression_encodings,
1129 )
1130 .apply_max_message_size_config(
1131 max_decoding_message_size,
1132 max_encoding_message_size,
1133 );
1134 let res = grpc.unary(method, req).await;
1135 Ok(res)
1136 };
1137 Box::pin(fut)
1138 }
1139 "/synth.SyntheticDataService/GetMetrics" => {
1140 #[allow(non_camel_case_types)]
1141 struct GetMetricsSvc<T: SyntheticDataService>(pub Arc<T>);
1142 impl<T: SyntheticDataService> tonic::server::UnaryService<()>
1143 for GetMetricsSvc<T> {
1144 type Response = super::MetricsResponse;
1145 type Future = BoxFuture<
1146 tonic::Response<Self::Response>,
1147 tonic::Status,
1148 >;
1149 fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
1150 let inner = Arc::clone(&self.0);
1151 let fut = async move {
1152 <T as SyntheticDataService>::get_metrics(&inner, request)
1153 .await
1154 };
1155 Box::pin(fut)
1156 }
1157 }
1158 let accept_compression_encodings = self.accept_compression_encodings;
1159 let send_compression_encodings = self.send_compression_encodings;
1160 let max_decoding_message_size = self.max_decoding_message_size;
1161 let max_encoding_message_size = self.max_encoding_message_size;
1162 let inner = self.inner.clone();
1163 let fut = async move {
1164 let method = GetMetricsSvc(inner);
1165 let codec = tonic_prost::ProstCodec::default();
1166 let mut grpc = tonic::server::Grpc::new(codec)
1167 .apply_compression_config(
1168 accept_compression_encodings,
1169 send_compression_encodings,
1170 )
1171 .apply_max_message_size_config(
1172 max_decoding_message_size,
1173 max_encoding_message_size,
1174 );
1175 let res = grpc.unary(method, req).await;
1176 Ok(res)
1177 };
1178 Box::pin(fut)
1179 }
1180 "/synth.SyntheticDataService/HealthCheck" => {
1181 #[allow(non_camel_case_types)]
1182 struct HealthCheckSvc<T: SyntheticDataService>(pub Arc<T>);
1183 impl<T: SyntheticDataService> tonic::server::UnaryService<()>
1184 for HealthCheckSvc<T> {
1185 type Response = super::HealthResponse;
1186 type Future = BoxFuture<
1187 tonic::Response<Self::Response>,
1188 tonic::Status,
1189 >;
1190 fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
1191 let inner = Arc::clone(&self.0);
1192 let fut = async move {
1193 <T as SyntheticDataService>::health_check(&inner, request)
1194 .await
1195 };
1196 Box::pin(fut)
1197 }
1198 }
1199 let accept_compression_encodings = self.accept_compression_encodings;
1200 let send_compression_encodings = self.send_compression_encodings;
1201 let max_decoding_message_size = self.max_decoding_message_size;
1202 let max_encoding_message_size = self.max_encoding_message_size;
1203 let inner = self.inner.clone();
1204 let fut = async move {
1205 let method = HealthCheckSvc(inner);
1206 let codec = tonic_prost::ProstCodec::default();
1207 let mut grpc = tonic::server::Grpc::new(codec)
1208 .apply_compression_config(
1209 accept_compression_encodings,
1210 send_compression_encodings,
1211 )
1212 .apply_max_message_size_config(
1213 max_decoding_message_size,
1214 max_encoding_message_size,
1215 );
1216 let res = grpc.unary(method, req).await;
1217 Ok(res)
1218 };
1219 Box::pin(fut)
1220 }
1221 _ => {
1222 Box::pin(async move {
1223 let mut response = http::Response::new(
1224 tonic::body::Body::default(),
1225 );
1226 let headers = response.headers_mut();
1227 headers
1228 .insert(
1229 tonic::Status::GRPC_STATUS,
1230 (tonic::Code::Unimplemented as i32).into(),
1231 );
1232 headers
1233 .insert(
1234 http::header::CONTENT_TYPE,
1235 tonic::metadata::GRPC_CONTENT_TYPE,
1236 );
1237 Ok(response)
1238 })
1239 }
1240 }
1241 }
1242 }
1243 impl<T> Clone for SyntheticDataServiceServer<T> {
1244 fn clone(&self) -> Self {
1245 let inner = self.inner.clone();
1246 Self {
1247 inner,
1248 accept_compression_encodings: self.accept_compression_encodings,
1249 send_compression_encodings: self.send_compression_encodings,
1250 max_decoding_message_size: self.max_decoding_message_size,
1251 max_encoding_message_size: self.max_encoding_message_size,
1252 }
1253 }
1254 }
1255 pub const SERVICE_NAME: &str = "synth.SyntheticDataService";
1257 impl<T> tonic::server::NamedService for SyntheticDataServiceServer<T> {
1258 const NAME: &'static str = SERVICE_NAME;
1259 }
1260}