MARS documentation
Rust librariesmars-server

mars-server · federation

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

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

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.

pub use discovery::{FederatedDiscoveryConfig, FederatedDiscoveryCoordinator};

pub use discovery::{FederatedDiscoveryConfig, FederatedDiscoveryCoordinator};

Source line: 16.

pub use envelope::{

canonical_digest, envelope_digest, FederationEnvelopeError, FederationEnvelopeVerifier, FederationSigner, VerifiedFederationMessage, };

pub use envelope::{
    canonical_digest, envelope_digest, FederationEnvelopeError, FederationEnvelopeVerifier,
    FederationSigner, VerifiedFederationMessage,
};

Source line: 17.

pub use policy::{

resolve_peer_endpoint, resolve_verified_conflict, validate_peer_url_and_addresses, ConflictResolutionError, ConflictWinner, PeerNetworkError, VersionTrust, };

pub use policy::{
    resolve_peer_endpoint, resolve_verified_conflict, validate_peer_url_and_addresses,
    ConflictResolutionError, ConflictWinner, PeerNetworkError, VersionTrust,
};

Source line: 21.

pub use service::FederationService;

pub use service::FederationService;

Source line: 25.

pub use transport::{

FederationTransport, FederationTransportError, FederationTransportRegistry, ReqwestFederationTransport, };

pub use transport::{
    FederationTransport, FederationTransportError, FederationTransportRegistry,
    ReqwestFederationTransport,
};

Source line: 26.

pub use worker::{

FederationRunSummary, FederationSyncWorker, FederationWorkerConfig, FederationWorkerError, };

pub use worker::{
    FederationRunSummary, FederationSyncWorker, FederationWorkerConfig, FederationWorkerError,
};

Source line: 30.

federation::FederationManager

Manages federation sync operations between MARS registries.

pub struct FederationManager {

}

Source line: 54.

federation::FederationManager::new

Create a new federation manager.

pub fn new(config: FederationConfig, store: Arc<dyn EntryStore>) -> Self;

Source line: 63.

federation::FederationManager::handle_sync

Handle an incoming sync request from a peer.

Returns a [SyncResponse] containing entries whose sequence number is greater than req.from_sequence, up to req.max_entries.

pub async fn handle_sync(&self, req: &SyncRequest) -> Result<SyncResponse, ServerError>;

Source line: 71.

federation::FederationManager::is_enabled

Returns whether federation is enabled.

pub fn is_enabled(&self) -> bool;

Source line: 108.

federation::FederationManager::sync_interval_secs

Returns the configured sync interval in seconds.

pub fn sync_interval_secs(&self) -> u64;

Source line: 113.

federation::ShardedFederationManager

Shard-aware federation manager extension.

When the sharding feature is enabled, this adds shard metadata to sync responses so that receiving peers can place entries in the correct shard.

#[cfg(feature = "sharding")]
pub struct ShardedFederationManager {
/// Base federation manager.

pub inner: FederationManager
}

Source line: 127.

federation::ShardedFederationManager::new

Create a new shard-aware federation manager.

#[cfg(feature = "sharding")]
pub fn new(
        config: FederationConfig,
        store: Arc<dyn EntryStore>,
        sharded_store: Arc<dyn crate::store::ShardedStore>,
    ) -> Self;

Source line: 137.

federation::ShardedFederationManager::handle_sharded_sync

Handle a sync request, annotating entries with their shard assignments.

#[cfg(feature = "sharding")]
pub async fn handle_sharded_sync(
        &self,
        req: &mars_protocol::federation::SyncRequest,
    ) -> Result<ShardedSyncResponse, ServerError>;

Source line: 149.

federation::ShardedSyncResponse

A sync response extended with shard placement metadata.

#[cfg(feature = "sharding")]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ShardedSyncResponse {
/// The base sync response.

#[serde(flatten)]
pub base: mars_protocol::federation::SyncResponse,
/// Entry DID -> shard ID assignments for each synced entry.

pub shard_assignments: Vec<(String, String)>,
/// All shard IDs known to the source registry.

pub shard_ids: Vec<String>
}

Source line: 179.

federation::verify_anchor_for_conflict

Verify that a conflict entry has a genuine on-chain anchor, not just metadata.

This verifies only the persisted receipt material. Live provider queries belong behind the MARS-owned anchor worker port and never run during federation conflict resolution.

Returns true if the entry has a verified on-chain anchor.

Errors

#[cfg(feature = "sigil")]
pub fn verify_anchor_for_conflict(
    entry: &MarsEntry,
    anchor: &mars_protocol::anchor::AnchorRecord,
) -> bool;

Source line: 205.

Source provenance

Source: mars-server/src/federation/mod.rs · SHA-256 c9af129e4e0a7761a81dd78d2f22610e29ffb14b9b7ae4ee0685f84bbd653870. Package overview.

On this page