routing

package
v1.43.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 4 Imported by: 0

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