Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Actor Systems in Rust (Boston Rust Meetup Version)

Andrew J. Stone
March 15, 2018
61

Actor Systems in Rust (Boston Rust Meetup Version)

Andrew J. Stone

March 15, 2018
Tweet

Transcript

  1. Haret Backend • Versioned persistent trie per consensus group •

    CAS on entire subtrees • Typed Leaves • Blob • Queue • Set
  2. pub trait Process<M, T=ExecutorTerminal<M>> : Send where T: Terminal<M> {

    /// Handle messages from other actors fn handle(&mut self, msg: Msg<M>, from: Pid, terminal: &mut T); } Processes
  3. Terminal pub trait Terminal<T> { fn send(&mut self, to: Pid,

    msg: T); fn start_timer(&mut self, Duration) -> TimerId; fn cancel_timer(&mut self, TimerId); }
  4. Echo Server P1 (Client) Envelope { to: P2, from: P1,

    msg: Msg::User<Hello> } Envelope { to: P1, from: P2, msg: Msg::User<Hello> } P2 (Server)
  5. impl<T> Process<Hello, T> for EchoServer where T: Terminal<Hello> { fn

    handle(&mut self, msg: Msg<Hello>, from: Pid, terminal: &mut T) { match msg { Msg::User(Hello) => { terminal.send(from, Hello); }, _ => () } } }
  6. Property Based Testing 1. Construct a group of processes in

    an initial state 2. Generate a schedule of test messages 3. Call the handle method of a process with a test message 4. Collect output messages of handle method from terminal 5. Schedule output messages
  7. Improvements • Use String Interning for Pids • Add more

    histograms and better debugging support • Use associated types instead of generics for processes? • Add support for supervision via catch_unwind • Rewrite the docs to cover the latest design