Skip to main content

nox_core/traits/
service.rs

1use crate::models::payloads::RelayerPayload;
2use async_trait::async_trait;
3use thiserror::Error;
4
5#[derive(Debug, Error)]
6pub enum ServiceError {
7    #[error("Processing failed: {0}")]
8    ProcessingFailed(String),
9    #[error("Payload ignored")]
10    Ignored,
11}
12
13#[async_trait]
14pub trait ServiceHandler: Send + Sync {
15    fn name(&self) -> &'static str;
16    async fn handle(&self, packet_id: &str, payload: &RelayerPayload) -> Result<(), ServiceError>;
17}