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
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 a
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
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
Number of items innotes
.(package private) static final int
private Note[]
All note blobs in this bucket, sorted sequentially.Fields inherited from class org.eclipse.jgit.notes.InMemoryNoteBucket
nonNotes, prefixLen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) InMemoryNoteBucket
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
private void
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
(package private) int
size()
(package private) FanoutBucket
split()
private int
treeSize
(int nameLen) (package private) ObjectId
writeTree
(ObjectInserter inserter)
-
Field Details
-
MAX_SIZE
static final int MAX_SIZE- See Also:
-
notes
All note blobs in this bucket, sorted sequentially. -
cnt
private int cntNumber of items innotes
.
-
-
Constructor Details
-
LeafBucket
LeafBucket(int prefixLen)
-
-
Method Details
-
search
-
getNote
- Specified by:
getNote
in classNoteBucket
-
get
-
size
int size() -
iterator
- Specified by:
iterator
in classNoteBucket
-
estimateSize
- Specified by:
estimateSize
in classNoteBucket
- Throws:
IOException
-
set
InMemoryNoteBucket set(AnyObjectId noteOn, AnyObjectId noteData, ObjectReader or) throws IOException - Specified by:
set
in classNoteBucket
- Throws:
IOException
-
writeTree
- Specified by:
writeTree
in classNoteBucket
- Throws:
IOException
-
getTreeId
ObjectId getTreeId()- Specified by:
getTreeId
in classNoteBucket
-
build
-
treeSize
private int treeSize(int nameLen) -
parseOneEntry
-
append
- Specified by:
append
in classInMemoryNoteBucket
-
growIfFull
private void growIfFull() -
shouldSplit
private boolean shouldSplit() -
split
FanoutBucket split()
-