package events import ( "sync" "go.neonxp.dev/djson/internal/model" ) type stdDispatcher struct { tree subscriberNode } func New() Dispatcher { return &stdDispatcher{ tree: subscriberNode{ children: make(map[string]*subscriberNode), channels: make(map[string]chan model.Mutation), parent: nil, mu: sync.RWMutex{}, }, } } func (ed *stdDispatcher) Subscribe(path []string, id string, ch chan model.Mutation) { ed.tree.subscribe(path, id, ch) } func (ed *stdDispatcher) Unsubscribe(path []string, id string) { ed.tree.unsubscribe(path, id) } func (ed *stdDispatcher) Notify(path []string, event *model.Mutation) { ed.tree.notify(path, event) }