Skip to main content

Crate datasynth_server

Crate datasynth_server 

Source
Expand description

§synth-server

gRPC and REST server for synthetic data generation.

This crate provides a server that exposes the synthetic data generation capabilities via gRPC and REST APIs for integration with other systems.

§Features

  • Bulk Generation: Generate large batches of data synchronously
  • Streaming: Continuous real-time data generation with configurable throughput
  • Control: Pause, resume, and stop generation streams
  • Configuration: Dynamic configuration updates via API
  • Metrics: Real-time generation statistics and health monitoring
  • WebSocket: Real-time metrics and event streaming

§gRPC Usage

use datasynth_server::{SynthService, SyntheticDataServiceServer};
use tonic::transport::Server;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let addr = "[::1]:50051".parse()?;
    let service = SynthService::new(default_generator_config());

    Server::builder()
        .add_service(SyntheticDataServiceServer::new(service))
        .serve(addr)
        .await?;

    Ok(())
}

§REST Usage

use datasynth_server::{rest, SynthService, grpc::service::default_generator_config};
use axum::Router;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let service = SynthService::new(default_generator_config());
    let router = rest::create_router(service);

    let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await?;
    axum::serve(listener, router).await?;

    Ok(())
}

Re-exports§

pub use grpc::SynthService;
pub use grpc::SyntheticDataServiceServer;

Modules§

config_loader
External config loading for multi-instance deployments.
grpc
gRPC service implementation for synthetic data generation.
jobs
Async job queue for generation jobs.
observability
Observability infrastructure for the DataSynth server.
rest
REST and WebSocket API implementation.
tls
Optional TLS configuration for the REST server.