hyperqueue

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package hyperqueue provides a sharded WorkqueueService implementation that consistently distributes keys across N backend workqueue services using consistent hashing.

Hyperqueue acts as a transparent router that implements the WorkqueueService gRPC interface. It takes a slice of backend WorkqueueServiceClients and routes incoming requests to the appropriate shard based on the request key.

Keys are assigned to shards using FNV-1a hashing:

hash(key) % len(backends) -> shard index

This ensures:

  • Deterministic routing: the same key always routes to the same shard
  • Even distribution: keys are roughly evenly distributed across shards
  • Fast computation: FNV-1a is a fast non-cryptographic hash

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New creates a sharded WorkqueueServiceServer from the provided backend clients. The shard count is determined by len(backends). Keys are consistently routed to shards using hash(key) % len(backends).

Example

ExampleNew demonstrates creating a hyperqueue server from a set of backend WorkqueueServiceClient instances.

package main

import (
	"fmt"

	"chainguard.dev/driftlessaf/workqueue/hyperqueue"
)

func main() {
	// In production, pass real gRPC clients connected to backend workqueue
	// services. New returns an error if no backends are provided.
	_, err := hyperqueue.New(nil)
	fmt.Println("error with no backends:", err)
}
Output:
error with no backends: at least one backend is required

Types

This section is empty.

Jump to

Keyboard shortcuts

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