package sublist
import "github.com/nats-io/gnatsd/sublist"
Sublist is a subject distribution data structure that can match subjects to interested subscribers. Subscribers can have wildcard subjects to match multiple published subjects.
Index ¶
Variables ¶
var ( ErrInvalidSubject = errors.New("Invalid Subject") ErrNotFound = errors.New("No Matches Found") )
Functions ¶
func IsValidLiteralSubject ¶
Types ¶
type Stats ¶
type Stats struct { NumSubs uint32 `json:"num_subscriptions"` NumCache uint32 `json:"num_cache"` NumInserts uint64 `json:"num_inserts"` NumRemoves uint64 `json:"num_removes"` NumMatches uint64 `json:"num_matches"` CacheHitRate float64 `json:"cache_hit_rate"` MaxFanout uint32 `json:"max_fanout"` AvgFanout float64 `json:"avg_fanout"` StatsTime time.Time `json:"stats_time"` }
Stats for the sublist
type Sublist ¶
type Sublist struct {
// contains filtered or unexported fields
}
A Sublist stores and efficiently retrieves subscriptions. It uses a tree structure and an efficient RR cache to achieve quick lookups.
func New ¶
func New() *Sublist
New will create a default sublist
func (*Sublist) Count ¶
Count return the number of stored items in the HashMap.
func (*Sublist) Insert ¶
func (*Sublist) Match ¶
Match will match all entries to the literal subject. It will return a slice of results.
func (*Sublist) Remove ¶
Remove will remove any item associated with key. It will track descent into the trie and prune upon successful removal.
func (*Sublist) ResetStats ¶
func (s *Sublist) ResetStats()
ResetStats will clear stats and update StatsTime to time.Now()
func (*Sublist) Stats ¶
Stats will return a stats structure for the current state.
Source Files ¶
- Version
- v0.6.0
- Published
- Jun 16, 2015
- Platform
- js/wasm
- Imports
- 6 packages
- Last checked
- 1 hour ago –
Tools for package owners.