Documentation
¶
Index ¶
- Variables
- func IntersectStree[T1 any, T2 comparable](st *stree.SubjectTree[T1], sl *GenericSublist[T2], ...)
- type GenericSublist
- func (s *GenericSublist[T]) Count() uint32
- func (s *GenericSublist[T]) HasInterest(subject string) bool
- func (s *GenericSublist[T]) Insert(subject string, value T) error
- func (s *GenericSublist[T]) Match(subject string, cb func(T))
- func (s *GenericSublist[T]) MatchBytes(subject []byte, cb func(T))
- func (s *GenericSublist[T]) NumInterest(subject string) (np int)
- func (s *GenericSublist[T]) Remove(subject string, value T) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidSubject = errors.New("gsl: invalid subject") ErrNotFound = errors.New("gsl: no matches found") ErrNilChan = errors.New("gsl: nil channel") ErrAlreadyRegistered = errors.New("gsl: notification already registered") )
Sublist related errors
Functions ¶
func IntersectStree ¶
func IntersectStree[T1 any, T2 comparable](st *stree.SubjectTree[T1], sl *GenericSublist[T2], cb func(subj []byte, entry *T1))
IntersectStree will match all items in the given subject tree that have interest expressed in the given sublist. The callback will only be called once for each subject, regardless of overlapping subscriptions in the sublist.
Types ¶
type GenericSublist ¶
type GenericSublist[T comparable] struct { sync.RWMutex // contains filtered or unexported fields }
A GenericSublist stores and efficiently retrieves subscriptions.
func NewSublist ¶
func NewSublist[T comparable]() *GenericSublist[T]
NewSublist will create a default sublist with caching enabled per the flag.
func (*GenericSublist[T]) Count ¶
func (s *GenericSublist[T]) Count() uint32
Count returns the number of subscriptions.
func (*GenericSublist[T]) HasInterest ¶
func (s *GenericSublist[T]) HasInterest(subject string) bool
HasInterest will return whether or not there is any interest in the subject. In cases where more detail is not required, this may be faster than Match.
func (*GenericSublist[T]) Insert ¶
func (s *GenericSublist[T]) Insert(subject string, value T) error
Insert adds a subscription into the sublist
func (*GenericSublist[T]) Match ¶
func (s *GenericSublist[T]) Match(subject string, cb func(T))
Match will match all entries to the literal subject. It will return a set of results for both normal and queue subscribers.
func (*GenericSublist[T]) MatchBytes ¶
func (s *GenericSublist[T]) MatchBytes(subject []byte, cb func(T))
MatchBytes will match all entries to the literal subject. It will return a set of results for both normal and queue subscribers.
func (*GenericSublist[T]) NumInterest ¶
func (s *GenericSublist[T]) NumInterest(subject string) (np int)
NumInterest will return the number of subs interested in the subject. In cases where more detail is not required, this may be faster than Match.
func (*GenericSublist[T]) Remove ¶
func (s *GenericSublist[T]) Remove(subject string, value T) error
Remove will remove a subscription.