pub struct CooperationSetup {
pub identity: Arc<NodeIdentity>,
pub runtime: String,
pub repository: MeshRepositoryIdentity,
pub endpoints: Vec<String>,
pub version: String,
pub config: CooperationConfig,
pub trust: TrustConfig,
pub journal_path: Option<PathBuf>,
pub registry: Arc<MeshRegistry>,
pub transport: Arc<dyn LinkTransport>,
pub board: Option<Arc<PeerBoard>>,
pub checkout: CheckoutFacts,
}Expand description
Everything one runtime needs before it can link to another, gathered in one place so that the runtime never reaches for it later. Each field is a decision somebody else already made — the declaration’s policy, the checkout’s identity, this process’s key, the socket to speak through — and passing them in is what lets a test replace any of them without a fixture: a fake transport, an ephemeral key, a journal that never touches the disk.
use std::sync::Arc;
use majordomus_cli::mesh::config::{CooperationConfig, TrustConfig};
use majordomus_cli::mesh::cooperation::{CheckoutFacts, Cooperation, CooperationSetup};
use majordomus_cli::mesh::identity::NodeIdentity;
use majordomus_cli::mesh::link::HttpTransport;
use majordomus_cli::mesh::registry::MeshRegistry;
use majordomus_cli::mesh::repository::of_root_commits;
let setup = CooperationSetup {
identity: Arc::new(NodeIdentity::ephemeral().unwrap()),
runtime: "0000000000000001".into(),
repository: of_root_commits(&["root".into()]),
endpoints: vec!["127.0.0.1:9".into()],
version: "doc".into(),
config: CooperationConfig::default(),
trust: TrustConfig::default(),
journal_path: None,
registry: Arc::new(MeshRegistry::new()),
transport: Arc::new(HttpTransport),
board: None,
checkout: CheckoutFacts::default(),
};
let cooperation = Cooperation::new(setup).unwrap();
assert!(cooperation.runtime_key().ends_with("-0000000000000001"));Fields§
§identity: Arc<NodeIdentity>This node’s identity.
runtime: StringThis runtime’s slot, 16 hex.
repository: MeshRepositoryIdentityThe repository’s mesh identity.
endpoints: Vec<String>Where this runtime answers.
version: StringThe executable version.
config: CooperationConfigThe declaration’s cooperation section.
trust: TrustConfigThe declaration’s trust section.
journal_path: Option<PathBuf>Where the journal persists, when anywhere.
registry: Arc<MeshRegistry>The discovery registry candidates come from.
transport: Arc<dyn LinkTransport>How link messages travel.
board: Option<Arc<PeerBoard>>The peer board of this process, projected into the journal every heartbeat: each attached session becomes a mesh session and each of its announcements an advisory claim, so a board announcement is visible on every linked runtime.
checkout: CheckoutFactsFacts about this checkout the projected sessions carry.