Closed stuartcarnie closed 3 weeks ago
I'm not opposed to doing this, but TypeId
s are somewhat unstable, especially over networks and between releases, which is why it's a closed functionality within the lib. I have no problem if you want to expose a retrieval call, but imho you'd be better off with the supervisor keeping a collection of ActorId
s in it's state, and matching on those. This is what's commonly done, and is guaranteed to be stable across process/network/release boundaries etc.
imho you'd be better off with the supervisor keeping a collection of ActorIds in it's state, and matching on those
That's what we're doing now - since the parents generally spawn the children, we can continue to keep track of the supervised actors grouped by type.
@stuartcarnie and I were looking for a short circuit to switch on type instead of searching through collections to determine the type. We're not currently sending actor information over network - we're all intra-process.
Ahh right, clustered actors.
@philjb – clustered actors are quite handy for process introspection. Previously, using Proto.Actor (in Go), I used the clustering feature to create a CLI to connect to the process and query actors directly.
This should be pretty straightforward to add. I don't really think it's that big of a risk, as long as it's clear with a comment. Do you want to put up a PR? I'm happy to review it.
This needs more test coverage before i'll merge it, but the idea is in here. https://github.com/slawlor/ractor/pull/277
Does that work for what you want?
@slawlor those look like nice improvements and the docs are clear regarding the caveats.
Awesome, thanks!
Thanks for the suggestions! It's released in 0.12.4, let me know if it works for your case!
Is your feature request related to a problem? Please describe.
At runtime, when a supervisor event occurs in
handle_supervisor_evt
, we would like to perform specific handling depending on the actor type.Describe the solution you'd like
One solution we be to allow the
type_id
of anActorCell
to be queried at runtime, similarly to how it is performed by the runtime to verify the type, introduced in #12.Describe alternatives you've considered
Currently, we store the ID of the actor at creation and then use the
ActorCell::get_id
to find the match.