feat(pubsub): allow binary channels, not just atoms#390
Open
Taure wants to merge 1 commit into
Open
Conversation
Widen nova_pubsub channel type from atom() to a new channel() type (atom() | binary()). pg already accepts any term, so this is a pure type/spec change with no runtime impact. Binary channels let callers use dynamic, per-entity channels (e.g. per-tenant "tenant:<id>") for isolated server-push without growing the atom table. Adds a binary-channel join/broadcast/leave test.
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
Widen the
nova_pubsubchannel type fromatom()to a new exportedchannel()type (atom() | binary()), and update the#nova_pubsub.channelrecord field accordingly.Why
nova_pubsubis backed bypg, which already accepts any term as a group key - so this is a pure type/spec change with no runtime behaviour change. Atom-only channels force dynamic, per-entity pub/sub (e.g. one channel per tenant) to either mint atoms at runtime (atom table never shrinks) or share a global channel (cross-entity message leakage). Allowing binary channels lets callers use<<"tenant:", Id/binary>>-style channels safely.Changes
nova_pubsub: new-type channel() :: atom() | binary().(exported + documented), all specs updated.nova_pubsub.hrl:channelfield widened toatom() | binary().Backwards compatible - existing atom channels are unaffected.