routing

package
v1.53.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package routing implements sticky leader selection for (org, namespace, taskQueue) triples. The leader is the validator whose hash(org|ns|tq|seed) is smallest in the current validator set; on membership change the table is recomputed and a MembershipChanged event lets the dispatcher re-target subscribers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key struct {
	Org       string
	Namespace string
	TaskQueue string
}

Key uniquely identifies a leader assignment.

type NodeID

type NodeID string

NodeID is the validator id used by the router. Wire is opaque; in practice this is the same identifier the consensus engine uses.

type Router

type Router interface {
	LeaderFor(k Key) (NodeID, bool)
	IsLeader(k Key) bool
	Validators() []NodeID
	SetMembership(local NodeID, validators []NodeID)
	OnChange(fn func())
}

Router picks a deterministic leader for every Key.

func NewHash

func NewHash(seed []byte) Router

NewHash returns a deterministic leader router seeded by seed (any stable bytes; cluster id, k8s service name, etc.).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL