Skip to content

brittonr/clanker-actor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clanker-actor

Erlang-style actor primitives on tokio.

Provides a process registry with named processes, bidirectional linking, monitors, signals, and supervision trees. Processes are native tokio tasks — no WASM, no message boxing, no runtime overhead beyond what tokio gives you.

Features

  • Process Registry — spawn named async tasks, look them up, send signals
  • Linking — bidirectional: when one linked process dies abnormally, the other gets killed (configurable via die_when_link_dies)
  • Monitors — unidirectional: get notified when a watched process dies, without dying yourself
  • Signals — Kill, Shutdown (with grace period), LinkDied, and Custom
  • Supervision — OneForOne, OneForAll, and RestForOne restart strategies with rate limiting

Usage

use clanker_actor::{ProcessRegistry, Signal, DeathReason};
use std::time::Duration;

#[tokio::main]
async fn main() {
    let registry = ProcessRegistry::new();

    // Spawn a named process
    let id = registry.spawn("worker", async {
        loop { tokio::time::sleep(Duration::from_secs(1)).await; }
    }).await;

    // Look it up
    assert!(registry.lookup("worker").is_some());

    // Shut it down
    registry.send_signal(id, Signal::Shutdown).await;
}

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages