pub mod api;
#[cfg(feature = "client")]
pub mod client;
pub mod persistence;
pub mod service;
pub mod state;
pub mod types;
#[cfg(feature = "client")]
pub use client::{AggregationServiceClient, ClientError};
pub use persistence::{
FilePersistence, NoPersistence, PersistedTaskState, PersistedThresholdType, PersistenceBackend,
PersistenceError,
};
pub use service::{
create_signing_message, AggregationService, CleanupWorkerHandle, ServiceConfig, ServiceError,
ServiceStats,
};
pub use state::{
AggregationState, OperatorInfo, TaskConfig, TaskCounts, TaskForAggregation, TaskState,
TaskStatus, ThresholdType,
};
pub use types::*;
pub async fn run(addr: &str, config: ServiceConfig) -> Result<(), Box<dyn std::error::Error>> {
use std::sync::Arc;
use tracing::info;
let service = Arc::new(AggregationService::new(config));
let app = api::router(service);
let listener = tokio::net::TcpListener::bind(addr).await?;
info!("Aggregation service listening on {}", addr);
axum::serve(listener, app).await?;
Ok(())
}