-
Notifications
You must be signed in to change notification settings - Fork 23
Adds ExActor.Common.server_pid/1 #28
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
base: master
Are you sure you want to change the base?
Changes from all commits
bdd5b29
c4718ef
5334756
266f898
f1c8d0e
50c4638
2185cc7
e0f6489
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| defmodule ExActor.Common do | ||
| @moduledoc false | ||
|
|
||
| # This module adds common functionality to all ExActor behaviours. | ||
| defmacro __using__(_opts) do | ||
| quote do | ||
| @doc """ | ||
| By default, the `server` argument given | ||
| to the different interface functions, is expected to be a process identifier, | ||
| unless overridden by the `export:` option. | ||
|
|
||
| But by providing a custom implementation of `server_pid/1`, you can map an identifier | ||
| to a PID by some other means. | ||
| """ | ||
| def server_pid(server_reference) do | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we should make this public. By doing it, we're by default adding extra function to the module's interface, and I'm not sure I like that. Preferably, this would be a
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, I think we shouldn't inject this function for the cases where a global |
||
| server_reference | ||
| end | ||
|
|
||
| defoverridable [server_pid: 1] | ||
| end | ||
| end | ||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're introducing this module, then moving the code of
ExActor.Helper.init_generation_stateto the__using__might be nice. That way, we get to keep the common boilerplate in the same place.