1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! Stratum depth.
use crateDigest;
/// The maximum depth of strata that a [`Sedimentree`] can go to.
pub const MAX_STRATA_DEPTH: Depth = Depth;
/// How deep in the Sedimentree a stratum is.
///
/// The greater the depth, the more leading zeros, the (probabilistically) larger,
/// and thus "lower" the stratum. They become larger due to the fragmenting strategy.
/// This means that the same data can appear in multiple strata, but may be fragmented
/// into smaller or larger sections based on a hash hardness metric.
///
/// The depth is determined by the number of leading zeros in each hash in base 10.
/// If there's zero-or-more leading zeros, it may only live in the topmost (0th) layer.
/// If there is one leading zero (or more), it can only live in the 0th or 1st layer.
/// If there are two leading zeros (or more), it can only live in the 0th, 1st, or 2nd layer
/// (and so on).
///
/// ```diagram
/// ┌───┐ ┌───┐ ┌───┐ ┌─────────┐ ┌───┐ ┌───┐
/// Depth 0 │ 1 │ │ 1 │ │ 1 │ │ 2 │ │ 1 │ │ 1 │
/// └───┘ └───┘ └───┘ └─────────┘ └───┘ └───┘
/// ┌───────────────┐ ┌─────────────────────┐
/// Depth 1 │ 3 commits │ │ 4 commits │
/// └───────────────┘ └─────────────────────┘
/// ┌───────────────────────────────────────┐
/// Depth 2 │ 7 commits │
/// └───────────────────────────────────────┘
/// ```
;
/// A strategy for determining the depth of a commit based on its digest.