back) and may significantly delay checkpoint advances when
`state.hash.size` is large and `writeback-rate-max` is small.
+## [hash.*] and [hash.NAME] sections
+
+A **hash domain** defines one hash function used to fingerprint data blocks.
+Each `[hash.NAME]` section is one domain; the `NAME` suffix is an arbitrary
+label (it is *not* the function name, though the built-in domain happens to use
+`[hash.crc64]`). At least one domain must be configured — bees fails to start
+with no `[hash.NAME]` section.
+
+The `[hash.*]` wildcard section sets defaults inherited by every named domain,
+exactly like `[scan.extent.*]` and `[filter.*]`.
+
+> **Scope on this release.** The multi-domain model exists for forward
+> compatibility with csum-tree scanning, but only one domain does any work
+> today: bees uses the **highest-priority insert-enabled domain** as the single
+> global hash function for all scanning and lookup. Every other domain is
+> parsed, validated, and held in reserve. Several keys are therefore locked to
+> one legal value (see each key below); setting any other value is a hard
+> startup error rather than a silent default, so a future release can relax the
+> restriction without changing the meaning of an existing file.
+
+### Wildcard defaults: [hash.*]
+
+* **`function`**
+ The hash algorithm. This key has **no default** — it is the defining
+ identity of a domain, so each concrete `[hash.NAME]` section must set its own.
+ Supported values:
+ * `crc64` — CRC-64; produces the same 64-bit table keys as bees v0.11, so it
+ is backward-compatible with an existing `beeshash.dat`. This is the
+ function the built-in `[hash.crc64]` domain uses.
+ * `cityhash` — CityHash64.
+ * `xxhash` — XXHash64.
+ * `xxhash3` — XXHash3 (64-bit); faster than `xxhash` on modern hardware.
+ Changing the function changes every key written to the hash table, so a
+ filesystem's `beeshash.dat` is only meaningful under the function that wrote
+ it (see [Notes](#hash-domain-notes)).
+ The values `btrfs`, `crc32c`, `sha256`, and `blake2` are reserved for future
+ implementation and rejected with a clear message.
+
+* **`priority`**
+ Lookup priority. The highest-priority insert-enabled domain becomes the
+ global hash function; ties are broken by config-file order. `0` disables
+ lookup for the domain.
+ Default: `100`.
+
+* **`step`**
+ Distance in bytes between the start of one hash window and the next.
+ Must equal the btrfs checksum block size, `4096`.
+ Default: `4096`.
+
+* **`size`**
+ Number of bytes consumed by each hash window.
+ Must equal the btrfs checksum block size, `4096`.
+ Default: `4096`.
+
+* **`seed`**
+ Collision-domain IV used to partition otherwise-identical hashes into
+ separate domains. Must be `0` on this release.
+ Default: `0`.
+
+* **`insert`**
+ Whether this domain publishes its hashes into `beeshash.dat`. Must be `yes`
+ on this release (at least one insert-enabled domain is required).
+ Default: `yes`.
+
+### Named domain sections: [hash.NAME]
+
+A `[hash.NAME]` section defines a concrete domain and inherits every `[hash.*]`
+default. In practice the only key a named section must set is `function`; the
+built-in configuration therefore reduces to:
+
+```ini
+[hash.crc64]
+ function = crc64
+```
+
+To select a different global function, define a domain with a higher priority
+than the built-in one — for example:
+
+```ini
+[hash.fast]
+ function = xxhash3
+ priority = 200
+```
+
+The `[hash.fast]` domain (priority 200) outranks the built-in `[hash.crc64]`
+(priority 100) and becomes the global hash function.
+
+### Hash domain notes
+
+* **The hash table is tied to its function.** `beeshash.dat` stores 64-bit
+ keys produced by whichever function was active when each entry was written.
+ Switching `function` does not migrate existing entries--matches found before
+ the change will no longer line up. Old entries will be evicted from
+ the table without matching new data.
+
## [thread] section
The `[thread]` section sets how many worker threads bees runs and how aggressively it ramps up under system load.
[hash.*]
- # Step between successive hash windows in bytes.
- # Must equal the btrfs checksum block size (4096).
+ # Window step; must equal the btrfs csum block size (4096).
step = 4096
- # Bytes consumed per hash window.
- # Must equal the btrfs checksum block size (4096).
+ # Window size; must equal the btrfs csum block size (4096).
size = 4096
- # Seed / collision-domain IV for explicit domain partitioning.
- # Must be 0.
+ # Collision-domain seed; must be 0 in this version.
seed = 0
- # Publish this domain's hashes into beeshash.dat.
- # Must be yes.
+ # Publish this domain's hashes into beeshash.dat; must be yes in this version.
insert = yes
- # Lookup priority. Highest value is used first.
- # 0 disables lookup for this domain.
+ # Lookup priority; highest wins, 0 disables lookup for this domain.
priority = 100
-# Legacy hash domain. Inherits all [hash.*] defaults.
-# Produces the same 64-bit table keys as bees v0.11 (backward
-# compatible with existing beeshash.dat files).
+# Built-in domain; same 64-bit keys as bees v0.11. function has no default,
+# so each [hash.NAME] sets its own: crc64, cityhash, xxhash, or xxhash3.
[hash.crc64]