Skip to content

Implement dispatcher type for efficient filtering #2

@stevvooe

Description

@stevvooe

Broadcaster distributing to a set of filtered sinks is fairly efficient in practice but still requires O(N) for every message sent. Provide the following interface definition to allow implementation of efficient event dispatch:

func NewDispatcher(selector Selector) *Dispatcher

type Selector interface {
    // Select zero or more sinks on which the event should be sent.
    Select(event Event) []Sink
}

This will allow events to be dispatched to a large set of listeners without incurring O(N) overhead for all messages.

This can also be used to implement load balancing of messages to support worker queues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions