docker / docker/go-events

Implement dispatcher type for efficient filtering

Open
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
135
Forks
27
Avg merge
1d 22h
Merged PRs (30d)
8

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing Broadcaster behavior and the proposed NewDispatcher, Dispatcher, Selector, Event, and Sink interfaces in the issue. Determine how selector-based dispatch should integrate with filtered sinks and worker-queue load balancing. Done means the dispatcher supports selecting zero or more sinks without requiring every message to scan the full listener set.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.