Skip to main content

Crate atomr

Crate atomr 

Source
Expand description

§atomr

A native Rust runtime for actor-based concurrent and distributed systems. One programming model — addressable units of state plus behavior, communicating by asynchronous messages — that scales from a single core to a cluster, and increasingly from CPU to GPU.

This is the umbrella crate. Pull in additional subsystems via Cargo feature flags; each feature also re-exports the underlying crate under a stable namespace.

[dependencies]
atomr = { version = "0.1", features = ["cluster", "persistence", "streams"] }
use atomr::prelude::*;
use atomr::cluster;          // re-export of `atomr-cluster`
use atomr::persistence;      // re-export of `atomr-persistence`
use atomr::streams;          // re-export of `atomr-streams`

§Quick start

use atomr::prelude::*;

#[derive(Default)]
struct Greeter;

#[async_trait::async_trait]
impl Actor for Greeter {
    type Msg = String;
    async fn handle(&mut self, _ctx: &mut Context<Self>, msg: String) {
        println!("hi {msg}");
    }
}

let system = ActorSystem::create("S", Config::empty()).await?;
let greeter = system.actor_of(Props::create(Greeter::default), "greeter")?;
greeter.tell("world".to_string());
system.terminate().await;

§Feature flags

FeatureRe-exports asWhat it adds
macros (default)atomr::macros#[derive(Actor)], props!, #[derive(Receive)]
testkitatomr::testkitProbes, virtual time, multi-node spec
remoteatomr::remoteCross-process / cross-host messaging
clusteratomr::clusterMembership, gossip, reachability, SBR
cluster-toolsatomr::cluster_toolsSingleton, distributed pub/sub, cluster client
cluster-shardingatomr::cluster_shardingSharded entities with rebalance
cluster-metricsatomr::cluster_metricsAdaptive load balancing
distributed-dataatomr::distributed_dataCRDT replicator
persistenceatomr::persistenceEvent sourcing — journals + snapshots
persistence-queryatomr::persistence_queryTagged event streams
streamsatomr::streamsTyped reactive streams DSL
patternsatomr::patternsDDD/CQRS aggregates + readers + sagas
coordinationatomr::coordinationLease primitives
discoveryatomr::discoveryService discovery
diatomr::diDI container
hostingatomr::hostingBuilder API
telemetryatomr::telemetryTracing, metrics, exporters
full(everything above)Every subsystem + macros + testkit
cluster-app(cluster-grade subset)Cluster-grade application bundle

Each subsystem also publishes as its own crate (atomr-cluster, atomr-persistence, …). If you only need one, depending on it directly avoids the umbrella’s resolver indirection.

See the repository README for architecture and the actors-and-agentic-computing doc for the unified-compute thesis.

Re-exports§

pub use atomr_config as config;
pub use atomr_core as core;
pub use atomr_macros as macros;macros
pub use atomr_testkit as testkit;testkit
pub use atomr_remote as remote;remote
pub use atomr_cluster as cluster;cluster
pub use atomr_cluster_tools as cluster_tools;cluster-tools
pub use atomr_cluster_sharding as cluster_sharding;cluster-sharding
pub use atomr_cluster_metrics as cluster_metrics;cluster-metrics
pub use atomr_distributed_data as distributed_data;distributed-data
pub use atomr_persistence as persistence;persistence
pub use atomr_persistence_query as persistence_query;persistence-query
pub use atomr_streams as streams;streams
pub use atomr_patterns as patterns;patterns
pub use atomr_coordination as coordination;coordination
pub use atomr_discovery as discovery;discovery
pub use atomr_di as di;di
pub use atomr_hosting as hosting;hosting
pub use atomr_telemetry as telemetry;telemetry

Modules§

prelude
Re-exports of the most commonly used types.