Skip to main content

Crate net_sdk

Crate net_sdk 

Source
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§

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_typed over the underlying MeshNode::serve_rpc / call raw-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.

Structs§

BatchConfig
Batch aggregation configuration.
CapabilityFilter
Filter for querying capabilities
CapabilitySet
Complete capability set for a node.
CausalEvent
A causal event: link + payload.
CausalLink
Causal link — 32 bytes prepended to each event in causal-framed EventFrames.
ChannelConfig
Channel configuration with capability-based access control.
ChannelId
A channel identifier: name + cached canonical hash.
ChannelName
A validated channel name.
DaemonHostConfig
Configuration for a daemon host.
DaemonStats
Runtime statistics for a daemon.
Event
An opaque event - any valid JSON value.
MeshStream
A typed handle to a logical stream within a peer session.
Net
A node on the Net mesh.
NetAdapterConfig
Configuration for the Net adapter.
PermissionToken
A signed, delegatable permission token.
PollRequest
Options for a one-shot poll request.
PollResponse
Response from a poll request.
PublishConfig
Builder-style configuration for a ChannelPublisher.
PublishReport
Outcome of one publish / publish_many call.
RawEvent
A pre-serialized event with cached hash.
Receipt
Receipt from a successful ingestion.
ScalingPolicy
Policy configuration for dynamic shard scaling.
StateSnapshot
A serializable state snapshot at a point in the causal chain.
Stats
Ingestion statistics.
StoredEvent
An event retrieved from storage with its backend-specific ID.
StreamConfig
Per-stream configuration supplied at open_stream time.
StreamStats
Per-stream statistics snapshot. Cheap to produce (reads a handful of atomics) and safe to poll at arbitrary frequency.
SubnetId
Hierarchical subnet identifier.
SubnetPolicy
Policy for assigning nodes to subnets based on capability tags.
TokenScope
Actions a token can authorize.

Enums§

AckReason
Why a Subscribe or Unsubscribe was rejected.
CloseBehavior
What to do with pending outbound packets when a stream is closed.
Filter
A filter predicate for matching events.
MigrationError
Errors from migration operations.
MigrationPhase
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.
TokenError
Errors from token operations.
Visibility
Channel visibility scope.

Constants§

VERSION
Crate version, sourced from Cargo.toml at build time. Re- exported so downstream binaries (the net CLI in particular) can report the embedded SDK version without hardcoding a literal that silently drifts on every workspace bump.

Traits§

MeshDaemon
A daemon that runs on the mesh.