Skip to main content

pardarsh_core/
federation.rs

1//! Federation contracts (interfaces only; no network implementation yet).
2//!
3//! What is already in place to keep federation possible:
4//! * identifiers carry their origin ([`crate::id::RecordId`]),
5//! * relations may point at remote records and carry a `target_locator`,
6//! * bundles are self-verifying and imports enforce an origin policy
7//!   ([`crate::interchange::ImportPolicy`]),
8//! * imported events keep their original ids, so re-sync is idempotent.
9//!
10//! Open questions (discovery, signatures, key rotation, replay protection,
11//! tombstones, cross-domain moderation) are listed in `docs/federation.md`.
12
13use crate::error::Result;
14use crate::id::{Origin, RecordId};
15use crate::interchange::Bundle;
16
17/// Something that can fetch records published by another origin.
18pub trait RemoteSource {
19    fn origin(&self) -> &Origin;
20
21    /// Fetch a bundle containing `ids` (and their histories). Implementations
22    /// must treat the response as untrusted and pass it through
23    /// [`crate::interchange::parse_bundle`] before use.
24    fn fetch(&self, ids: &[RecordId]) -> Result<Bundle>;
25}