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 aFanoutBucketand 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) InMemoryNoteBucketappend(Note note)private TreeFormatterbuild()(package private) intestimateSize(AnyObjectId noteOn, ObjectReader or)(package private) Noteget(int index)(package private) NotegetNote(AnyObjectId objId, ObjectReader or)(package private) ObjectIdgetTreeId()private voidgrowIfFull()(package private) java.util.Iterator<Note>iterator(AnyObjectId objId, ObjectReader reader)(package private) voidparseOneEntry(AnyObjectId noteOn, AnyObjectId noteData)private intsearch(AnyObjectId objId)(package private) InMemoryNoteBucketset(AnyObjectId noteOn, AnyObjectId noteData, ObjectReader or)private booleanshouldSplit()(package private) intsize()(package private) FanoutBucketsplit()private inttreeSize(int nameLen)(package private) ObjectIdwriteTree(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:
getNotein classNoteBucket
-
get
Note get(int index)
-
size
int size()
-
iterator
java.util.Iterator<Note> iterator(AnyObjectId objId, ObjectReader reader)
- Specified by:
iteratorin classNoteBucket
-
estimateSize
int estimateSize(AnyObjectId noteOn, ObjectReader or) throws java.io.IOException
- Specified by:
estimateSizein classNoteBucket- Throws:
java.io.IOException
-
set
InMemoryNoteBucket set(AnyObjectId noteOn, AnyObjectId noteData, ObjectReader or) throws java.io.IOException
- Specified by:
setin classNoteBucket- Throws:
java.io.IOException
-
writeTree
ObjectId writeTree(ObjectInserter inserter) throws java.io.IOException
- Specified by:
writeTreein classNoteBucket- Throws:
java.io.IOException
-
getTreeId
ObjectId getTreeId()
- Specified by:
getTreeIdin 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:
appendin classInMemoryNoteBucket
-
growIfFull
private void growIfFull()
-
shouldSplit
private boolean shouldSplit()
-
split
FanoutBucket split()
-
-