Expand description
§Net SDK
Ergonomic Rust SDK for the Net mesh network.
The core net crate is the engine. This SDK is what developers actually import.
§Example
use net_sdk::{Net, Backpressure};
use futures::StreamExt;
let node = Net::builder()
.shards(4)
.backpressure(Backpressure::DropOldest)
.memory()
.build()
.await?;
// Emit events
node.emit(&serde_json::json!({"token": "hello"}))?;
node.emit_raw(b"{\"token\": \"world\"}" as &[u8])?;
// Subscribe to a stream
let mut stream = node.subscribe(Default::default());
while let Some(event) = stream.next().await {
let event = event?;
println!("{}", event.raw_str().unwrap_or("<non-utf8>"));
}
node.shutdown().await?;Re-exports§
pub use crate::config::Backpressure;pub use crate::config::NetBuilder;pub use crate::stream::EventStream;pub use crate::stream::SubscribeOpts;pub use crate::stream::TypedEventStream;pub use crate::mesh::Mesh;pub use crate::mesh::MeshBuilder;pub use crate::mesh::SubscribeOptions;pub use crate::compute::DaemonError as ComputeDaemonError;pub use crate::compute::DaemonHandle;pub use crate::compute::DaemonRuntime;pub use crate::compute::MigrationHandle;pub use crate::compute::MigrationOpts;pub use crate::identity::Identity;
Modules§
- aggregator
- Aggregator + lifecycle surfaces.
- capabilities
- Capability declarations — what a node can do.
- compute
- Compute surface —
MeshDaemon+DaemonRuntime. - config
- Simplified configuration builder for the SDK.
- cortex
- CortEX + RedEX + NetDb surface.
- dataforts
- Dataforts SDK surface — operator-facing re-exports for the mesh-native blob storage adapter.
- error
- Unified SDK error type.
- groups
- HA / scaling overlays on top of
DaemonRuntime. - identity
- Identity handle — keypair + token cache.
- mesh
- Multi-peer mesh handle for the SDK.
- mesh_
rpc - nRPC SDK surface — typed
serve_rpc_typed/call_typedover the underlyingMeshNode::serve_rpc/callraw-bytes API. - mesh_
rpc_ resilience - Caller-side resilience helpers for nRPC calls.
- meshdb
- MeshDB SDK surface — federated query plane above the substrate’s chains.
- meshos
- MeshOS SDK — daemon-author surface.
- stream
- Async stream-based event consumption.
- subnets
- Subnet assignment — hierarchical 4-level grouping for routing and visibility.
- tool
- AI tool-calling surface — SDK-side helpers built atop the
substrate’s
cortex::toolmodule. - transport
- Transport SDK surface — fairscheduler transport, blob transfer, directory transfer.
Structs§
- Batch
Config - Batch aggregation configuration.
- Capability
Filter - Filter for querying capabilities
- Capability
Set - Complete capability set for a node.
- Causal
Event - A causal event: link + payload.
- Causal
Link - Causal link — 32 bytes prepended to each event in causal-framed EventFrames.
- Channel
Config - Channel configuration with capability-based access control.
- Channel
Id - A channel identifier: name + cached canonical hash.
- Channel
Name - A validated channel name.
- Daemon
Host Config - Configuration for a daemon host.
- Daemon
Stats - Runtime statistics for a daemon.
- Event
- An opaque event - any valid JSON value.
- Mesh
Node - Multi-peer mesh node.
- Mesh
Stream - A typed handle to a logical stream within a peer session.
- Net
- A node on the Net mesh.
- NetAdapter
Config - Configuration for the Net adapter.
- Permission
Token - A signed, delegatable permission token.
- Poll
Request - Options for a one-shot poll request.
- Poll
Response - Response from a poll request.
- Publish
Config - Builder-style configuration for a
ChannelPublisher. - Publish
Report - Outcome of one
publish/publish_manycall. - RawEvent
- A pre-serialized event with cached hash.
- Receipt
- Receipt from a successful ingestion.
- Scaling
Policy - Policy configuration for dynamic shard scaling.
- State
Snapshot - A serializable state snapshot at a point in the causal chain.
- Stats
- Ingestion statistics.
- Stored
Event - An event retrieved from storage with its backend-specific ID.
- Stream
Config - Per-stream configuration supplied at
open_streamtime. - Stream
Stats - Per-stream statistics snapshot. Cheap to produce (reads a handful of atomics) and safe to poll at arbitrary frequency.
- Subnet
Id - Hierarchical subnet identifier.
- Subnet
Policy - Policy for assigning nodes to subnets based on capability tags.
- Token
Scope - Actions a token can authorize.
Enums§
- AckReason
- Why a
SubscribeorUnsubscribewas rejected. - Close
Behavior - What to do with pending outbound packets when a stream is closed.
- Filter
- A filter predicate for matching events.
- Migration
Error - Errors from migration operations.
- Migration
Phase - Phases of daemon migration.
- OnFailure
- What to do when one of the per-peer fan-out sends fails.
- Ordering
- Ordering mode for consumed events.
- Reliability
- Reliability mode chosen per stream.
- Token
Error - Errors from token operations.
- Visibility
- Channel visibility scope.
Constants§
- VERSION
- Crate version, sourced from
Cargo.tomlat build time. Re- exported so downstream binaries (thenetCLI in particular) can report the embedded SDK version without hardcoding a literal that silently drifts on every workspace bump.
Traits§
- Mesh
Daemon - A daemon that runs on the mesh.