WeaveDocs
Weave Core

Facade

Top-level facade in Weave Core — single entry point that wires filesystem, network, identity, crypto, and model crates together.

Purpose

Facade over filesystem, network, storage, identity, crypto, and model crates.

This page follows the real source shape for Weave Core and explains the workflow a developer is likely to use first.

Developer workflow

Start from the smallest constructor or builder, perform one meaningful operation, inspect the returned state, then add the relevant policy, storage, or network integration. The examples below should be expanded whenever the crate API changes.

Primary types to know

  • AgentFs — libs/weave-core/src/filesystem/agentfs.rs
  • AgentFsConfig — libs/weave-core/src/filesystem/agentfs.rs
  • AgentFsEntry — libs/weave-core/src/filesystem/agentfs.rs
  • ContentAnnouncement — libs/weave-core/src/network/dht.rs
  • Dht — libs/weave-core/src/network/dht.rs
  • DhtBehaviour — libs/weave-core/src/network/dht.rs
  • DhtConfig — libs/weave-core/src/network/dht.rs
  • DhtStats — libs/weave-core/src/network/dht.rs
  • Did — libs/weave-core/src/identity/mod.rs
  • Diff — libs/weave-core/src/filesystem/diff.rs
  • DiffEntry — libs/weave-core/src/filesystem/diff.rs
  • DiffSummary — libs/weave-core/src/filesystem/diff.rs

Example shape

use std::sync::Arc;
use strand::{Strand, StrandConfig};
use tokio::sync::RwLock;
use weave_core::Weave;
use weave_identity::Ed25519Adapter;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Weave is a façade that composes a root Strand with Forum + Gnosis + Basis
    // sub-stores and an Identity adapter. Each subsystem owns its own strand.
    let dir = tempfile::tempdir()?;
    let mk = || async {
        Strand::new(StrandConfig::new().with_storage(dir.path())).await
    };
    let root = Arc::new(RwLock::new(mk().await?));
    let forum_s = Arc::new(RwLock::new(mk().await?));
    let gnosis_s = Arc::new(RwLock::new(mk().await?));
    let basis_vec = Arc::new(RwLock::new(mk().await?));
    let basis_idx = Arc::new(RwLock::new(mk().await?));

    let identity: Arc<dyn weave_identity::WeaveIdentityAdapter> = Arc::new(Ed25519Adapter::new());
    let weave = Weave::new(root.clone(), forum_s, gnosis_s, basis_vec, basis_idx, identity).await?;

    println!("root_strand_len={}", weave.root_strand.read().await.len());
    Ok(())
}