-
Notifications
You must be signed in to change notification settings - Fork 95
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
Named monitors #31
Comments
Can you just keep a map of Pid => Entity? |
The idea was about simplifying the machine code, and keeping the map in the state would be the opposite for my opinion. |
If anything it complicates the API for machine implementors as they already have a unique identifier in the pid and now need to provide yet another arbitrary one. Since you cannot use generators inside the state machine code this could become tricky. Is it that hard to maintain a map for your use case? What are these entities in your example? Do they ever restart? |
The identifier would not be unique. It would be from a predefined set. I should have explained it better. |
Ok I sortof get what you are asking for but there is no need to search if you maintain a map like Ra only maintains one monitor for each pid (unlike erlang) what should the logic be when it receives two monitor effects for the same pid but different entities? Should that result in two down commands being committed? I am still not sure about this feature as it is so simple to just maintain inside the state machine. |
Ra already maintains a map of pids and monitor refs. So complexity here is when machine tries to issue monitors for different types but the same pid. Technically it should not do that, but it would be hard to enforce, yes. |
Since monitors are supposed to be effects, it's not possible to take a monitor reference and save it in the state. When a machine needs to monitor more than one type of entity it has to scan through all of them to find the process which was monitored.
It would be nice to have some monitor references to keep dispatch code clean.
Example:
Monitor entity type1:
{monitor, process, entity1, Pid1}
Monitor entity type2:
{monitor, process, entity2, Pid2}
Handle down signal for entity1:
WDYT?
The text was updated successfully, but these errors were encountered: