v0.0.592
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m30s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m30s
This commit is contained in:
parent
64f2cd7219
commit
52e74b59f5
@ -10,6 +10,15 @@ import (
|
|||||||
"time"
|
"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 {
|
type PubSubSubscription interface {
|
||||||
Unsubscribe()
|
Unsubscribe()
|
||||||
}
|
}
|
||||||
@ -32,12 +41,6 @@ func (p *pubSubSubscription[T]) Unsubscribe() {
|
|||||||
p.parent.unsubscribe(p)
|
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] {
|
func NewPubSub[T any](capacity int) *PubSub[T] {
|
||||||
return &PubSub[T]{
|
return &PubSub[T]{
|
||||||
masterLock: &sync.Mutex{},
|
masterLock: &sync.Mutex{},
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package goext
|
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"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user