Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registry for active actors #158

Open
Relrin opened this issue Jan 23, 2020 · 3 comments
Open

Registry for active actors #158

Relrin opened this issue Jan 23, 2020 · 3 comments

Comments

@Relrin
Copy link
Member

Relrin commented Jan 23, 2020

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:

  • Communication between the actors is more preferable by names rather then by id, because the id can change in runtime (due unexpected restarts, killing by the supervisor, etc.).
  • Has a requirement to broadcast to the certain group of actors defined by a custom dispatching rule or with the usage of PubSub.
  • Has a necessity to store properties that can be shared across the actors.
  • Can be used as the part of the hot-code swapping feature.

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:

  • Auto-remove from registries failed / stopped / killed actors
  • An implementation of bunch of methods for getting access to the desired registry
  • Default trait(s) for any registry for interacting from the actor

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
Copy link
Member Author

Relrin commented Jan 31, 2020

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
Copy link

xacrimon commented Feb 1, 2020

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

@vertexclique
Copy link
Member

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

@Relrin Relrin mentioned this issue Feb 3, 2020
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants