MARS documentation
Rust librariesmars-serverFederation

mars-server · federation::worker

Public declarations and documentation for mars-server::federation::worker.

Package: mars-server · Workspace version: 0.1.0 · Module: federation::worker

This reference follows declared modules and public syntax, including public implementation methods. Function bodies and constant values are omitted. Feature conditions are retained. Private-module re-exports and trait resolution require the compiler; not every declaration is a root import.

federation::worker::FederationWorkerConfig

Bounded synchronization worker policy.

#[derive(Debug, Clone)]
pub struct FederationWorkerConfig {
pub max_concurrency: u32,
pub batch_size: u32,
pub sync_interval: Duration,
pub lease_duration: Duration,
pub request_timeout: StdDuration,
pub retry_base: Duration,
pub retry_max: Duration,
pub jitter_bps: u16,
pub breaker_failure_threshold: u32,
pub breaker_cooldown: Duration
}

Source line: 29.

federation::worker::FederationWorkerConfig::validate

pub fn validate(&self) -> Result<(), FederationWorkerError>;

Source line: 43.

federation::worker::FederationRunSummary

Aggregate result of one bounded worker pass.

#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub struct FederationRunSummary {
pub attempted_peers: u32,
pub completed_peers: u32,
pub failed_peers: u32,
pub imported: u64,
pub retained_local: u64,
pub duplicate_deliveries: u64,
pub quarantined: u64
}

Source line: 65.

federation::worker::FederationWorkerError

Worker construction or durable-state failure.

#[derive(Debug, thiserror::Error)]
pub enum FederationWorkerError {
    #[error("federation worker configuration is invalid")]
    InvalidConfig,
    #[error("federation durable state failed: {0}")]
    Store(#[from] ServerError),
    #[error("federation worker task failed")]
    Task,
}

Source line: 91.

federation::worker::FederationSyncWorker

Pull-based worker. Claims commit before network activity, imports are idempotent, and cursor completion commits only after every payload has been validated or quarantined.

#[derive(Clone)]
pub struct FederationSyncWorker {

}

Source line: 104.

federation::worker::FederationSyncWorker::new

#[allow(clippy::too_many_arguments)]
pub fn new(
        worker_id: impl Into<String>,
        store: Arc<dyn EntryStore>,
        transport: Arc<dyn FederationTransport>,
        signer: FederationSigner,
        verifier: FederationEnvelopeVerifier,
        validation: ValidationPipeline,
        config: FederationWorkerConfig,
    ) -> Result<Self, FederationWorkerError>;

Source line: 116.

federation::worker::FederationSyncWorker::run_once

Run one bounded synchronization pass.

pub async fn run_once(
        &self,
        now: DateTime<Utc>,
    ) -> Result<FederationRunSummary, FederationWorkerError>;

Source line: 142.

federation::worker::FederationSyncWorker::run_until_shutdown

Run bounded passes until shutdown. Transient pass failures are recorded and retried on the next interval; they never erase durable cursor or breaker state.

pub async fn run_until_shutdown(
        self,
        interval: StdDuration,
        mut shutdown: tokio::sync::watch::Receiver<bool>,
    );

Source line: 176.

Source provenance

Source: mars-server/src/federation/worker.rs · SHA-256 bb16d7061087244544fddbcb4201908bcae30f2ad129ad074e8ad4fd42d71aa8. Package overview.

On this page