Package org.eclipse.jgit.notes
Class LeafBucket
- java.lang.Object
-
- org.eclipse.jgit.notes.NoteBucket
-
- org.eclipse.jgit.notes.InMemoryNoteBucket
-
- org.eclipse.jgit.notes.LeafBucket
-
class LeafBucket extends InMemoryNoteBucket
A note tree holding only notes, with no subtrees. The leaf bucket contains on average less than 256 notes, all of whom share the same leading prefix. If a notes branch has less than 256 notes, the top level tree of the branch should be a LeafBucket. Once a notes branch has more than 256 notes, the root should be aFanoutBucket
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 byNoteParser
.
-
-
Constructor Summary
Constructors Constructor Description LeafBucket(int prefixLen)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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)
-
-
-
Field Detail
-
MAX_SIZE
static final int MAX_SIZE
- See Also:
- Constant Field Values
-
notes
private Note[] notes
All note blobs in this bucket, sorted sequentially.
-
cnt
private int cnt
Number of items innotes
.
-
-
Method Detail
-
search
private int search(AnyObjectId objId)
-
getNote
Note getNote(AnyObjectId objId, ObjectReader or)
- Specified by:
getNote
in classNoteBucket
-
get
Note get(int index)
-
size
int size()
-
iterator
java.util.Iterator<Note> iterator(AnyObjectId objId, ObjectReader reader)
- Specified by:
iterator
in classNoteBucket
-
estimateSize
int estimateSize(AnyObjectId noteOn, ObjectReader or) throws java.io.IOException
- Specified by:
estimateSize
in classNoteBucket
- Throws:
java.io.IOException
-
set
InMemoryNoteBucket set(AnyObjectId noteOn, AnyObjectId noteData, ObjectReader or) throws java.io.IOException
- Specified by:
set
in classNoteBucket
- Throws:
java.io.IOException
-
writeTree
ObjectId writeTree(ObjectInserter inserter) throws java.io.IOException
- Specified by:
writeTree
in classNoteBucket
- Throws:
java.io.IOException
-
getTreeId
ObjectId getTreeId()
- Specified by:
getTreeId
in classNoteBucket
-
build
private TreeFormatter build()
-
treeSize
private int treeSize(int nameLen)
-
parseOneEntry
void parseOneEntry(AnyObjectId noteOn, AnyObjectId noteData)
-
append
InMemoryNoteBucket append(Note note)
- Specified by:
append
in classInMemoryNoteBucket
-
growIfFull
private void growIfFull()
-
shouldSplit
private boolean shouldSplit()
-
split
FanoutBucket split()
-
-