Skip to content
FeralthedoggPublic

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

Axactor

Rust actor runtime + cluster runtime workspace.

Workspace Layout

  • axactor: runtime crate (System, Registry, Supervisor, cluster, ref_api)
  • axactor-macros: procedural macros (#[actor], #[msg])
  • examples/axum_demo: local actor + axum demo
  • examples/axum_registry: keyed registry demo
  • examples/axum_cluster_chat: multi-node cluster chat demo (HTTP + cluster)

Current Runtime Model (Code-Aligned)

  • Local runtime
    • user/control mailbox split
    • restart policy + restart mailbox policy (Keep / DrainAndDrop)
    • link/monitor/trap-exit
    • lifecycle stream (Started, Restarted, Stopped)
  • Registry
    • sharded keyed registry
    • get_or_spawn(...) -> Result<Ref, RegistryError>
    • idle reaper
  • Cluster
    • shard lease ownership + epoch fencing (fail-closed)
    • ensure-once + slot-direct routing
    • monitor/demonitor/down with bounded retry queues
    • handshake dedup + protocol negotiation + request/response auth verification
    • runtime session ids per process; same-logical peer rotation is trusted only after handshake
    • control/data plane separation
    • overlays: InMemoryOverlay, TcpOverlay
    • lease stores: MemoryLeaseStore, optional Redis (redis-lease feature)
  • Ref API separation
    • LocalRef<M> for local zero-overhead hot path
    • RemoteRef<C> for wire-safe remote contracts
    • optional AnyRef<C> / Addr<C> for explicit location transparency
    • default wire codec: SimdJsonCodec

Security Defaults

Cluster secure mode is default:

  • ClusterConfig.allow_insecure_auth = false
  • ClusterConfig.auth_token is required in secure mode
  • ClusterNode::start(...) panics if secure mode is enabled with empty token

Use insecure mode only for local test/dev.

ClusterNode::start(NodeId::new("node-a"), ...) promotes the logical id into a runtime session id internally. The public NodeId you pass remains a stable logical name; the cluster runtime appends a @boot-<hex>-session-<n> suffix for wire identity and only treats that exact suffix shape as a session marker.

Non-handshake frames are accepted only from:

  • the exact local runtime node id for loopback
  • peers that have already completed handshake for their current runtime session

This keeps same-logical session rotation working without letting unauthenticated peers bypass cluster auth by spoofing a logical node name.

TcpOverlay enables OS-level SO_KEEPALIVE by default and supports tuning:

  • idle
  • interval
  • probes (platform-dependent)

Validation Commands

cargo check --workspace
cargo test --workspace --all-targets
cargo test -p axactor --no-default-features
cargo test -p axactor --all-features
cargo clippy --workspace --all-targets --all-features -- -D warnings

Targeted cluster chat E2E regression:

cargo test -p axum_cluster_chat --test e2e_chat -- --nocapture

Run Cluster Chat Example

cargo run -p axum_cluster_chat

Environment knobs:

  • CHAT_NODES (default 2)
  • CHAT_BASE_PORT (default 4100)
  • CHAT_TCP_OVERLAY=true to use TCP overlay
  • CHAT_CLUSTER_BASE_PORT (default CHAT_BASE_PORT + 1000)
  • CHAT_CLUSTER_TOKEN shared auth token
  • CHAT_TCP_KEEPALIVE=true|false (default true)
  • CHAT_TCP_KEEPALIVE_IDLE_MS (0 = OS default)
  • CHAT_TCP_KEEPALIVE_INTERVAL_MS (0 = OS default)
  • CHAT_TCP_KEEPALIVE_PROBES (0 = OS default)
  • CHAT_REDIS_URL + CHAT_REDIS_PREFIX for Redis lease store (--features redis-lease)

Docs

Troubleshooting

If cargo hangs at Blocking waiting for file lock on package/shared package cache:

Get-Process cargo,rustc -ErrorAction SilentlyContinue | Stop-Process -Force

Then rerun your command.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages