-
Notifications
You must be signed in to change notification settings - Fork 96
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
Add command reply modes for replying from a given member #314
Conversation
I left off adding the new reply-modes to notifications since they're currently batched in a way that makes it a little tricky to separate by reply-mode. I can leave that to the future if we find the right use-case for them or tackle this in a separate PR. What do you think @kjnilsson? |
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.
Looks great and I'd be happy to accept but have a question about the use of an options list and a couple of formatting comments.
@@ -2307,6 +2318,15 @@ add_reply(_, '$ra_no_reply', _, Effects, Notifys) -> | |||
{Effects, Notifys}; | |||
add_reply(#{from := From}, Reply, await_consensus, Effects, Notifys) -> | |||
{[{reply, From, {wrap_reply, Reply}} | Effects], Notifys}; | |||
add_reply(#{from := From}, Reply, | |||
{await_consensus, Options}, Effects, Notifys) -> | |||
Replier = case Options of |
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.
it feels a bit strange to have a list but only evaluate the first item. I wonder if perhaps we should skip the list for now or use a map perhaps?
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.
I switched to a map - if we need to add more options in the future I think it will be a better choice, and it's easier to work with than the list here since these options are mutually exclusive 👍
yes that is fine, would you mind creating an issue for this capturing some of the context you've got for the future? |
We introduce two new command reply modes: * `local`: reply to the sender of a command from a member on the same node as the sender of the command. * `{member, Server}`: reply to the sender from the given member.
Proposed Changes
This is a new effect which works the same as prior
reply
effects but is only executed by the given server. A caller may wish to block until a command has replicated to an arbitrary server, for example if that server is on the local node. This new reply mode ensures that the call to process the command will only return when the command is replicated to that given node.Types of Changes
What types of changes does your code introduce to this project?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creatingthe PR. If you're unsure about any of them, don't hesitate to ask on the
mailing list. We're here to help! This is simply a reminder of what we are
going to look for before merging your code.
CONTRIBUTING.md
document