Expand description
§mnem-transport
Offline transport for mnem: export a subtree of the content-addressed
DAG to a CAR v1 archive, ship it anywhere (USB stick, email, scp,
S3), import on the other side.
CAR (Content-Addressable aRchive) is IPFS’s standard bundling
format: a stream of (varint length, CID, bytes) triples preceded
by a varint-framed DAG-CBOR header that lists the root CIDs. It is
streamable in both directions; this crate implements the
CAR v1 wire shape exactly.
§Shape
exportwalks theBlockstorefrom a root CID via theBlockstore::iter_from_rootdefault impl, writing every reachable block to astd::io::Write.importreads a CAR from astd::io::Readand inserts every block into a target blockstore, verifying the CID on each block.carexposes the lower-level CAR reader / writer used by the above, for callers that need to interleave CAR parsing with other work.
In addition to the file-format half, this crate is home to the shapes of mnem’s remote wire protocol:
protocolfreezes theprotocol::PROTOCOL_VERSIONinteger, theprotocol::PROTOCOL_HEADERHTTP header name, and theprotocol::Capabilityvocabulary. PR 2 does not ship any wire code; it ships the agreement surface so PR 3 can add verbs without a version bump.remotedefinesremote::RemoteConfig, the in-memory type parsed from the[remote.<name>]section of.mnem/config.toml.have_setdefines thehave_set::HaveSettrait and thehave_set::BloomHaveSetreference back-end used to summarise “blocks I already have” onfetch- blocks/push-blocks.
Everything in those three modules is pure data + pure functions.
HTTP wiring lives in mnem http; the CLI glue (mnem remote add
etc.) lives in mnem-cli; neither lands until PR 3.
§Constraints
- WASM-clean. No tokio, no async. The entire interface is
std::io::{Read, Write}with?Sizedsupport. - No filesystem helpers; callers open files and pass the handles. Keeps this crate usable inside HTTP streams, pipes, etc.
- Deterministic ordering:
exportwrites blocks initer_from_root’s depth-first order so the same root produces a byte-identical CAR across runs.
Re-exports§
pub use error::ClientError;pub use error::TransportError;pub use export::ExportStats;pub use export::export;pub use have_set::BloomHaveSet;pub use have_set::HaveSet;pub use have_set::build_have_set;pub use import::ImportStats;pub use import::import;pub use protocol::CAPABILITIES_HEADER;pub use protocol::Capability;pub use protocol::CapabilitySet;pub use protocol::PROTOCOL_HEADER;pub use protocol::PROTOCOL_VERSION;pub use protocol::parse_capabilities;pub use protocol::serialize_capabilities;pub use remote::RemoteConfig;pub use remote::RemoteConfigFile;pub use remote::RemoteSection;pub use remote::parse_config;pub use secret_token::SecretToken;pub use client::HttpRemoteClient;pub use client::PushResponse;pub use client::RefsResponse;pub use client::RemoteClient;
Modules§
- car
- CAR v1 reader + writer.
- client
- Async HTTP
RemoteClient. - error
- Transport-layer error type.
- export
- Export a reachable subtree of a
Blockstoreto CAR v1. - have_
set HaveSettrait and the PR-2BloomHaveSetreference implementation.- import
- Import a CAR v1 archive into a
Blockstore. - protocol
- Wire-level protocol constants and capability vocabulary for mnem’s remote transport.
- remote
RemoteConfigand the.mnem/config.toml[remote.<name>]schema.- secret_
token - Opaque bearer-token newtype used by the remote transport.
Constants§
- VERSION
- Library version (tracks the workspace package version).