Skip to content

Feature: Draft actor system. #6

@Zhou-London

Description

@Zhou-London

Outlines v1

  • Core entities: Stage, Interface, Dispatcher, Actor.
  • Stage is the tier 0 instance. Data won't run out of an Stage.
  • Users interact with Stage using Interface. interface only passes these "subscriptions and publishes" to Stage and Dispathcer, and never really define them.
auto actor = stage.introduce([&](Interface& iface){
    // Define subscription
    iface.subscribe<GreetingMessage>(func);
}, [&](){
    // Define the function to be called when being added into the Stage
    iface.publish<GreetingMessage>(otherActor, Args...)
}
);
  • The publish & subscribe is one-way by default, based on Stream (a SPSC ring buffer).
  • Dispatcher defines how Stage manages and execute its actors, using single-thread dispatching, or one-thread-per-actor dispathcing.
  • Thread pool dispatching will be taken into consideration, but not for now since it's a bit complex in this case. Feel free to reserve a dummy interface for it.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions