diff --git a/dataext/pubsub.go b/dataext/pubsub.go index 71ccad8..2eb643f 100644 --- a/dataext/pubsub.go +++ b/dataext/pubsub.go @@ -10,6 +10,15 @@ import ( "time" ) +// PubSub is a simple Pub/Sub Broker +// Clients can subscribe to a namespace and receive published messages on this namespace +// Messages are broadcast to all subscribers +type PubSub[T any] struct { + masterLock *sync.Mutex + + subscriptions map[string][]*pubSubSubscription[T] +} + type PubSubSubscription interface { Unsubscribe() } @@ -32,12 +41,6 @@ func (p *pubSubSubscription[T]) Unsubscribe() { p.parent.unsubscribe(p) } -type PubSub[T any] struct { - masterLock *sync.Mutex - - subscriptions map[string][]*pubSubSubscription[T] -} - func NewPubSub[T any](capacity int) *PubSub[T] { return &PubSub[T]{ masterLock: &sync.Mutex{}, diff --git a/goextVersion.go b/goextVersion.go index 1cd3a60..3595348 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.591" +const GoextVersion = "0.0.592" -const GoextVersionTimestamp = "2025-07-16T12:44:55+0200" +const GoextVersionTimestamp = "2025-07-16T12:46:18+0200"