Class FanoutBucket


class FanoutBucket extends InMemoryNoteBucket
A note tree holding only note subtrees, each named using a 2 digit hex name. The fanout buckets/trees contain on average 256 subtrees, naming the subtrees by a slice of the ObjectId contained within them, from "00" through "ff". Each fanout bucket has a InMemoryNoteBucket.prefixLen that defines how many digits it skips in an ObjectId before it gets to the digits matching table. The root tree has prefixLen == 0, and thus does not skip any digits. For ObjectId "c0ffee...", the note (if it exists) will be stored within the bucket table[0xc0]. The first level tree has prefixLen == 2, and thus skips the first two digits. For the same example "c0ffee..." object, its note would be found within the table[0xff] bucket (as first 2 digits "c0" are skipped). Each subtree is loaded on-demand, reducing startup latency for reads that only need to examine a few objects. However, due to the rather uniform distribution of the SHA-1 hash that is used for ObjectIds, accessing 256 objects is very likely to load all of the subtrees into memory. A FanoutBucket must be parsed from a tree object by NoteParser.