Riker is a framework for building modern, concurrent and resilient systems using the Rust language. Riker aims to make working with state and behavior in concurrent systems as easy and scalable as possible. The Actor Model has been chosen to realize this because of the familiar and inherent simplicity it provides while also providing strong guarantees that are easy to reason about. The Actor Model also provides a firm foundation for resilient systems through the use of the actor hierarchy and actor supervision.
Riker provides:
futures::execution::ThreadPool
Cargo.toml
:
[dependencies]
riker = "0.4.1"
main.rs
:
use std::time::Duration;
use riker::actors::*;
#[derive(Default)]
struct MyActor;
// implement the Actor trait
impl Actor for MyActor {
type Msg = String;
fn recv(&mut self,
_ctx: &Context<String>,
msg: String,
_sender: Sender) {
println!("Received: {}", msg);
}
}
// start the system and create an actor
fn main() {
let sys = ActorSystem::new().unwrap();
let my_actor = sys.actor_of::<MyActor>("my-actor").unwrap();
my_actor.tell("Hello my actor!".to_string(), None);
std::thread::sleep(Duration::from_millis(500));
}
Official crates that provide additional functionality:
transform!
and 'ask'The next major theme on the project roadmap is clustering and location transparency:
Riker is a full-featured actor model implementation that scales to hundreds or thousands of microservices and that equally can run exceptionally well on resource limited hardware to drive drones, IoT and robotics. The Rust language makes this possible.
Rust empowers developers with control over memory management, requiring no garbage collection and runtime overhead, while also providing modern semantics and expressive syntax such as the trait system. The result is a language that can solve problems equally for Web and IoT.
Riker adds to this by providing a familiar actor model API which in turn makes concurrent, resilient systems programming easy.
Riker is currently built using the latest Rust Nightly.
Riker is looking for contributors - join the project! You don't need to be an expert in actors, concurrent systems, or even Rust. Great ideas come from everyone.
There are multiple ways to contribute:
Before you commit your code pre-commit integrates as a git hook to automatically check your code. Please don't skip git hooks (even if you do the travis TravisCI build will still fail).
There are two different approaches you can use to run pre-commit
pre-commit run -a
yarn
yarn lint
npm run install
npn run lint