Repository navigation
Conversation
The next change installs the adapter's event handler for each Commanded application's scope with :syn.set_event_handler/2. Released syn 3.4.2 has no such function. It is proposed upstream in ostinelli/syn#93 (issue ostinelli/syn#91) and lives in the Qarma-inspect/syn fork at 1b4a030, which this branch pins by commit. mix hex.build fails on this branch, because Hex refuses git dependencies. main stays on released syn and is what goes to Hex. Refs #1
syn keeps one event handler per node. The adapter took that handler over, passed the callbacks of other scopes on to the handler it had found, and imitated syn's default rule for them when there was none. A handler the host installed afterwards replaced the adapter's in every scope and had to pass the adapter's scopes back through adapter_scope?/1. Without that, a host handler that resolved conflicts itself left the loser of a conflict in the adapter's scopes running next to the winner, and one that left conflicts to syn had syn kill the loser with an exit the adapter treats as a crash, which reached the supervisors. :syn.set_event_handler/2 installs a handler for one scope, and syn then calls it for that scope alone. The adapter installs ConflictResolution that way, before the node joins the scope, and sets no other handler in syn. The forwarding, the imitation of syn's rule and adapter_scope?/1 go with it. Removing adapter_scope?/1 is a breaking change, and so is the end of the forwarding for a host that named ConflictResolution under config :syn, event_handler:; the CHANGELOG says what each host has to change. This ships as 0.2.0 when it reaches main. Refs #1
The syn fork at 1b4a030 already carries the snapshot fix proposed in ostinelli/syn#90, so the README's advice to keep scopes small until syn releases it applies to syn 3.4.2 only. ConflictResolution named under config :syn, event_handler: decides conflicts in the host's own scopes by the adapter's rule when both registrations carry :started_at; the CHANGELOG only described the other case. The comment on install_for_scope/1 said the order protects the conflict rule. A conflict needs a registration of the node's own, which comes later; the order keeps the callbacks of the first exchange away from a host's node-wide handler. Refs #1
The Qarma-inspect/syn fork's integration branch now carries upstream master, where ostinelli/syn#90, #94 and #95 and the maintainer's fixes of snapshot races have landed, with the per-scope event handlers of ostinelli/syn#93 on top. Refs #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The adapter now sets its conflict handler for each Commanded application's scope with
:syn.set_event_handler/2and leaves syn's node-wide handler alone.ConflictResolution.adapter_scope?/1goes away, so this ships as 0.2.0; the CHANGELOG lists what a host has to change.This stays a draft until syn releases
:syn.set_event_handler/2(ostinelli/syn#93). Until then the branch takes syn from the Qarma-inspect/syn fork at 260ea0b and is merged intointegration, which applications pin by commit. Hex refuses git dependencies, somix hex.buildfails on this branch, and its CI step hascontinue-on-erroruntil the dependency goes back to Hex.Closes #1