shard

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package shard is the hashing WaveHouse places keys with: Jump maps a key to one of n buckets so that changing n moves as few keys as possible, and Mix derives a second, independent hash from one already taken. The external broker's partitions and shards, the ingest processes' shard assignment and the DynamoDB dedupe table's buckets are all placed with them, so a tool outside this module can compute where any of them lives. What they return is routed on and stored, so it never changes: tests pin it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Jump

func Jump(key uint64, n int) int

Jump is the jump consistent hash (Lamping and Veach, 2014): key's bucket among n, for n ≥ 1. Growing n to n+1 moves a key only into bucket n, and each key with probability 1/(n+1), where a modulus would move nearly all.

func Mix

func Mix(z uint64) uint64

Mix is splitmix64's finalizer: a hash of z with every bit of z mixed into every bit of the result, independent of z itself. Placing a key twice from one hash needs it: Jump(h, 2) = 1 forces Jump(h, 4) ≠ 0, so a second placement from the same h would leave buckets empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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