Expand description
Routing bucket and vShard of an array tile.
A tile key orders tiles on a space-filling curve, so its top bits carry little entropy when tile indices are small. Routing therefore takes the top bits of a bijective mix of the key. Stored keys stay unchanged. The cluster router, the Data Plane shard filter and the snapshot paths use these functions, so a tile has one bucket and one vShard everywhere.
The router uses at most VShardId::BITS bucket bits. Bucket b of R
routing bits owns the vShards [b * stride, (b + 1) * stride), with
stride = VShardId::COUNT >> R. Its primary vShard is b * stride.
Structs§
- Prefix
Bits OutOf Range - An array routing granularity outside
1..=MAX_PREFIX_BITS. - Shard
Bucket - The bucket one shard serves. A shard read keeps only the tiles whose key falls in this bucket, so shards that share one Data Plane never return the same tile twice.
Constants§
- MAX_
PREFIX_ BITS - The largest routing granularity an array declares.
Functions§
- array_
vshard_ for_ tile - The primary vShard that owns the tile with key
tile_key. - bucket_
to_ vshard - The primary vShard of
bucketatbitsrouting bits.bitscomes fromrouting_bits, so it is at mostVShardId::BITS. - fmix64
- MurmurHash3 64-bit finalizer. A bijection on
u64: distinct keys keep distinct values, and every input bit affects every output bit. - prefix_
bucket - The routing bucket of tile key
tile_key: the topprefix_bitsbits offmix64(tile_key). Returns a value in[0, 2^prefix_bits). Withprefix_bits == 0every key maps to bucket 0. - routing_
bits - The bucket bits the router uses for
prefix_bits: at mostVShardId::BITS, since a finer bucket has no vShard of its own. - shard_
bucket_ admits - Whether
tile_keypasses the optional shard filter.Nonekeeps every tile.