class LeafBucket extends InMemoryNoteBucket
FanoutBucket and the LeafBucket
will appear only as a cell of a FanoutBucket.
Entries within the LeafBucket are stored sorted by ObjectId, and lookup is
performed using binary search. As the entry list should contain fewer than
256 elements, the average number of compares to find an element should be
less than 8 due to the O(log N) lookup behavior.
A LeafBucket must be parsed from a tree object by NoteParser.| Modifier and Type | Field and Description |
|---|---|
private int |
cnt
Number of items in
notes. |
(package private) static int |
MAX_SIZE |
private Note[] |
notes
All note blobs in this bucket, sorted sequentially.
|
nonNotes, prefixLen| Constructor and Description |
|---|
LeafBucket(int prefixLen) |
| Modifier and Type | Method and Description |
|---|---|
(package private) InMemoryNoteBucket |
append(Note note) |
private TreeFormatter |
build() |
(package private) int |
estimateSize(AnyObjectId noteOn,
ObjectReader or) |
(package private) Note |
get(int index) |
(package private) Note |
getNote(AnyObjectId objId,
ObjectReader or) |
(package private) ObjectId |
getTreeId() |
private void |
growIfFull() |
(package private) java.util.Iterator<Note> |
iterator(AnyObjectId objId,
ObjectReader reader) |
(package private) void |
parseOneEntry(AnyObjectId noteOn,
AnyObjectId noteData) |
private int |
search(AnyObjectId objId) |
(package private) InMemoryNoteBucket |
set(AnyObjectId noteOn,
AnyObjectId noteData,
ObjectReader or) |
private boolean |
shouldSplit() |
(package private) int |
size() |
(package private) FanoutBucket |
split() |
private int |
treeSize(int nameLen) |
(package private) ObjectId |
writeTree(ObjectInserter inserter) |
static final int MAX_SIZE
private Note[] notes
private int cnt
notes.private int search(AnyObjectId objId)
Note getNote(AnyObjectId objId, ObjectReader or)
getNote in class NoteBucketNote get(int index)
int size()
java.util.Iterator<Note> iterator(AnyObjectId objId, ObjectReader reader)
iterator in class NoteBucketint estimateSize(AnyObjectId noteOn, ObjectReader or) throws java.io.IOException
estimateSize in class NoteBucketjava.io.IOExceptionInMemoryNoteBucket set(AnyObjectId noteOn, AnyObjectId noteData, ObjectReader or) throws java.io.IOException
set in class NoteBucketjava.io.IOExceptionObjectId writeTree(ObjectInserter inserter) throws java.io.IOException
writeTree in class NoteBucketjava.io.IOExceptionObjectId getTreeId()
getTreeId in class NoteBucketprivate TreeFormatter build()
private int treeSize(int nameLen)
void parseOneEntry(AnyObjectId noteOn, AnyObjectId noteData)
InMemoryNoteBucket append(Note note)
append in class InMemoryNoteBucketprivate void growIfFull()
private boolean shouldSplit()
FanoutBucket split()