Add Pluggable Transports and support for Partisan#289
Open
sahilpohare wants to merge 9 commits intoelixir-horde:masterfrom
Open
Add Pluggable Transports and support for Partisan#289sahilpohare wants to merge 9 commits intoelixir-horde:masterfrom
sahilpohare wants to merge 9 commits intoelixir-horde:masterfrom
Conversation
Allow passing {:auto, ListenerModule} as the node manager option in
Horde.DynamicSupervisor and Horde.Registry (handled by
maybe_add_node_manager
and members). Add Horde.NodeListenerBehaviour to provide a behaviour and
default GenServer implementation for custom node listeners. Update
mix.exs
source_url to the new repository.
Introduce Horde.ClusterTransport behaviour plus Erlang and Partisan implementations. Add a :transport option to Horde.Registry (defaulting to Horde.ClusterTransport.Erlang) and store the transport module in registry metadata. Registry now delegates process liveness and remote calls to the configured transport. Also adjust NodeListenerBehaviour @impl to use GenServer and mark node callbacks optional.
Wrap Partisan modules in a Code.ensure_loaded? check and add rescue/error handling for :partisan_peer_service and :partisan_rpc calls
sleipnir
requested changes
Apr 6, 2026
Collaborator
|
Hi @sahilpohare, thanks for the PR, I'll review it soon. |
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.
What this solves
Horde assumes Erlang distribution throughout —
Node.list()for peer discovery,:erpcfor remotecalls, and a single hardcoded
Horde.NodeListenerfor membership. This makes Horde incompatible withalternative transports like Partisan, which replaces Erlang distribution entirely with its own mesh
networking layer.
What it introduces
Horde.NodeListenerBehaviourA
use-based behaviour for building custom node listeners. Theusemacro injects a full GenServerimplementation with sensible defaults — Erlang distribution monitoring,
handle_nodeup/handle_nodedown,and
set_members. The only required callback ismake_members/1. All injected functions aredefoverridable.Horde.RegistryandHorde.DynamicSupervisornow accept{:auto, ListenerModule}as the:membersoption to start a custom listener instead of the default
Horde.NodeListener.Horde.ClusterTransportbehaviourAbstracts the primitives Horde needs from the underlying cluster transport:
members/0process_alive?/1call/5Two implementations ship out of the box:
Horde.ClusterTransport.ErlangHorde.ClusterTransport.Partisan:partisan_peer_service+:partisan_rpcThe
:transportoption onHorde.Registryselects the implementation. The chosen module is stored inregistry ETS metadata at startup and read on every
lookup/2— one local ETS read, no GenServer call onthe hot path.
Horde.NodeListener.PartisanA ready-made Partisan node listener built on
Horde.NodeListenerBehaviour. Uses:partisan.monitor_nodes/1for monitoring and:partisan_peer_servicefor membership.Conditional compilation
Horde.ClusterTransport.PartisanandHorde.NodeListener.Partisanare wrapped inCode.ensure_loaded?(:partisan_peer_service)guards — only compiled when Partisan is present. No optionaldep entry in
mix.exs, no compile-time warnings in Partisan-free builds.Methodology
:transportdefaults toHorde.ClusterTransport.Erlang,{:auto, ListenerModule}is additive alongside the existing:auto.at runtime.
startup.
ClusterTest/NetworkPartitionTestare unrelated flaky distributed tests.