bastion-rs / bastion

Highly-available Distributed Fault-tolerant Runtime
https://www.bastion-rs.com
Apache License 2.0
2.8k stars 103 forks source link

Registry for active actors #158

Open Relrin opened 4 years ago

Relrin commented 4 years ago

Is your feature request related to a problem? Please describe. In Elixir / Erlang languages developers has a universal way to register running actors in the system and communicate with them depends of the required use case, for example:

For an inspiration you can look into the current Elixir documentation for registry usage with examples.

Describe the solution you'd like Use one of available registries out-of-the-box (like in Elixir), initialize and then pass it in the Bastion struct for the usage in the cluster after the start.

However, it also requires to have at least:

Describe alternatives you've considered Usage of the lazy_static! macro with other any available collections to use (wrapped in Arc's hashmaps/vectors, concurrent collections) for organizing desired communication and sharing data.

Relrin commented 4 years ago

What about implementing a registry based on the evmap / ccl crates? Also I think it makes a sense to share my ideas about implementation details:

  1. Start from the simple case: automatic registration/deletion for actors after creating or being stopped/killed.
  2. Any actor has an access to this init registry via the registry name, because in the future systems could be organized in the clusters, so that it will make it much easier to handle later on.
  3. The base registry for handling active actors should be added to the main Bastion struct and will be private field.
  4. Each actor after it starts, must send a information to the main registry with declaring the used module and function name (e.g. something like (actor_id, my_module::main, "main_func"). This part of the feature will help us not only to handle the active actors, but also build custom dispatch rules on the top of that.
xacrimon commented 4 years ago

Popping in here, for context. ccl is now deprecated in favor of the dashmap crate.

vertexclique commented 4 years ago

We were talking about this on Discord, we will go with either dashmap or flurry.