Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement dispatcher type for efficient filtering #2

Open
stevvooe opened this issue Mar 23, 2016 · 0 comments
Open

Implement dispatcher type for efficient filtering #2

stevvooe opened this issue Mar 23, 2016 · 0 comments

Comments

@stevvooe
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant