org.eclipse.jgit.lib.ObjectInserter .
Applications can acquire an instance of a parser from ObjectInserter's
org.
method.
Implementations of org. should
subclass this type and provide their own logic for the various on*()
event methods declared to be abstract.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class | |
| private class | |
| public static class | PackParser.
Type and size information about an object in the database buffer. |
| public static enum | PackParser.
Location data is being obtained from. |
| public static class | PackParser.
Information about an unresolved delta in this pack stream. |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private ObjectIdOwnerMap | |
| private LongMap | |
| private ObjectIdSubclassMap | baseObjectIds
Objects referenced by their name from deltas, that aren't in this pack. |
| pack-priv int | |
| private long | bBase
Position in the input stream of |
| private int | |
| pack-priv byte[] | |
| private static final int | BUFFER_SIZE
Size of the internal stream buffer. |
| private boolean | |
| private boolean | |
| private BlockList | collisionCheckObjs
Objects need to be double-checked for collision after indexing. |
| private int | |
| private PackedObjectInfo[] | |
| private int | |
| private boolean | |
| private long | |
| private byte[] | |
| private InputStream | |
| private PackParser. | |
| private String | lockMessage
Message to protect the pack data from garbage collection. |
| private long | maxObjectSizeLimit
Git object size limit |
| private boolean | |
| private ObjectIdSubclassMap | newObjectIds
Every object contained within the incoming pack. |
| private ObjectChecker | |
| private final ObjectDatabase | objectDatabase
Object database used for loading existing objects. |
| private final SHA1 | |
| private MessageDigest | |
| private ObjectReader | |
| private final ReceivedPackStatistics. | |
| private byte[] | |
| private final MutableObjectId |
| Access | Constructor and Description |
|---|---|
| protected | PackParser(ObjectDatabase
database the parser will write its objects into. odb, InputStream the stream the parser will read. src)Initialize a pack parser. |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| protected byte[] | Returns: a temporary byte array for use by the caller.Get a temporary byte array for use by the caller. |
| protected abstract boolean | Returns: true if the CRC matches; false if it does not.the prior CRC that was recorded during the first scan of the
object from the pack stream. oldCRC)Check the current CRC matches the expected value. |
| private final void | |
| private void | |
| private void | |
| private void | |
| private void | |
| pack-priv int | |
| private PackParser. | |
| public ObjectIdSubclassMap | Returns: set of objects the incoming pack assumed for delta purposesGet set of objects the incoming pack assumed for delta purposes |
| public String | Returns: the message to record with the pack lock.Get the message to record with the pack lock. |
| public ObjectIdSubclassMap | Returns: the new objects that were sent by the userGet the new objects that were sent by the user |
| public PackedObjectInfo | Returns: the object information.index of the object in the stream. Must be between 0 and
nth)getObjectCount()-1.Get the information about the requested object. |
| public int | Returns: number of objects parsed out of the stream.Get the number of objects in the stream. |
| public long | Returns: the pack size (including the index size) or -1 if the size cannot be determinedGet the size of the newly created pack. |
| public ReceivedPackStatistics | |
| public List | Returns: sorted list of objects in this pack stream.comparison function, if null objects are stored by ObjectId. cmp)Get all of the objects, sorted by their name. |
| private void | |
| private void | |
| private InputStream | |
| private byte[] | |
| private void | |
| public boolean | Returns: true if a thin pack (missing base objects) is permitted.Whether a thin pack (missing base objects) is permitted. |
| public boolean | Returns: true if the EOF should be read from the input after the footer.Whether the EOF should be read from the input after the footer. |
| protected boolean | Returns: if true received objects are verified to prevent collisions.Whether received objects are verified to prevent collisions. |
| public boolean | Returns: true if there is data expected after the pack footer.Whether there is data expected after the pack footer. |
| private boolean | |
| protected PackedObjectInfo | Returns: info object containing this object's data.identity of the object to be tracked. id, PackParser.if the object was previously an unresolved delta, this is the
delta object that was tracking it. Otherwise null. delta,if the object was previously an unresolved delta, this is the
ObjectId of the base of the delta. The base may be outside of
the pack stream if the stream was a thin-pack. deltaBase)Construct a PackedObjectInfo instance for this parser. |
| protected abstract boolean | Returns: true if theinfo should be included in the object list
returned by getSortedObjectList(Comparator), false if it
should not be included.type of the base object. typeCode, byte[] complete content of the base object. data, PackedObjectInfo packed object information for this base. Implementors must
populate the CRC and offset members if returning true. info)Provide the implementation with a base that was outside of the pack. |
| protected abstract void | onBeginOfsDelta(long
position of this object in the incoming stream. deltaStreamPosition, long position of the base object in the incoming stream. The base
must be before the delta, therefore baseStreamPosition, long baseStreamPosition
< deltaStreamPosition. This is not the position
returned by a prior end object event.size of the delta when fully inflated. The size stored within
the pack may be larger or smaller, and is not yet known. inflatedSize)Event notifying start of a delta referencing its base by offset. |
| protected abstract void | onBeginRefDelta(long
position of this object in the incoming stream. deltaStreamPosition, AnyObjectId name of the base object. This object may be later in the
stream, or might not appear at all in the stream (in the case
of a thin-pack). baseId, long size of the delta when fully inflated. The size stored within
the pack may be larger or smaller, and is not yet known. inflatedSize)Event notifying start of a delta referencing its base by ObjectId. |
| protected abstract void | onBeginWholeObject(long
position of this object in the incoming stream. streamPosition, int type, long size of the object when fully inflated. The size stored within
the pack may be larger or smaller, and is not yet known. inflatedSize)Event notifying the start of an object stored whole (not as a delta). |
| protected PackParser. | Returns: object information that must be populated with at least the offset.Event notifying the current object. |
| protected abstract void | |
| protected abstract void | |
| protected abstract void | onInflatedObjectData(PackedObjectInfo
the object info, populated. obj, int the type of the object. typeCode, byte[] inflated data for the object. data)Invoked for commits, trees, tags, and small blobs. |
| protected abstract void | onObjectData(PackParser.
where the data came from src,buffer to read data from. raw, int first offset within buffer that is valid. pos, int number of bytes in buffer that are valid. len)Store (and/or checksum) a portion of an object's data. |
| protected abstract void | onObjectHeader(PackParser.
where the data came from src,buffer to read data from. raw, int first offset within buffer that is valid. pos, int number of bytes in buffer that are valid. len)Store (and/or checksum) an object header. |
| protected abstract void | onPackFooter(byte[]
the trailing 20 bytes of the pack, this is a SHA-1 checksum of
all of the pack data. hash)Provide the implementation with the original stream's pack footer. |
| protected abstract void | onPackHeader(long
number of objects expected in the stream. objCnt)Provide the implementation with the original stream's pack header. |
| protected abstract void | onStoreStream(byte[]
buffer to copy data out of. raw, int first offset within the buffer that is valid. pos, int number of bytes in the buffer that are valid. len)Store bytes received from the raw stream. |
| private PackParser. | |
| private PackParser. | |
| public final PackLock | Returns: the pack lock, if one was requested by settingsetLockMessage(String).callback to provide progress feedback during parsing. If null,
progress)org. will be used.Parse the pack stream. |
| public PackLock | Returns: the pack lock, if one was requested by settingsetLockMessage(String).receives progress feedback during the initial receiving
objects phase. If null,
receiving, ProgressMonitor org. will be used.receives progress feedback during the resolving objects phase. resolving)Parse the pack stream. |
| private void | |
| protected abstract int | Returns: number of bytes stored.the buffer to copy read data into. dst, int position within pos, int dst to start copying data into.ideal target number of bytes to read. Actual read length may
be shorter. cnt)Read from the database's current position into the buffer. |
| private int | |
| protected PackParser. | Returns: info, after populating.the info object to populate. infoRead the header of the current object. |
| private void | |
| private void | |
| private PackParser. | |
| private void | |
| private void | |
| private void | resolveDeltas(PackParser.
|
| private void | |
| private static PackParser. | |
| protected abstract PackParser. | Returns: theinfo object.the object position to begin reading from. This is from
obj, PackParser.newInfo(AnyObjectId, UnresolvedDelta, ObjectId).object to populate with type and size. infoReposition the database to re-read a previously stored object. |
| protected abstract PackParser. | Returns: theinfo object.the object position to begin reading from. This is an instance
previously returned by delta,onEndDelta().object to populate with type and size. infoReposition the database to re-read a previously stored object. |
| public void | setAllowThin(boolean
true to enable a thin pack. allow)Configure this index pack instance to allow a thin pack. |
| public void | setCheckEofAfterPackFooter(boolean
true if the EOF should be read; false if it is not checked. b)Ensure EOF is read from the input stream after the footer. |
| protected void | setCheckObjectCollisions(boolean
true to enable collision checking (strongly encouraged). check)Enable checking for collisions with existing objects. |
| public void | setExpectDataAfterPackFooter(boolean
true if there is additional data in InputStream after pack.
This requires the InputStream to support the mark and reset
functions. e)Set if there is additional data in InputStream after pack. |
| protected void | setExpectedObjectCount(long
a long. expectedObjectCount)Set the expected number of objects in the pack stream. |
| public void | setLockMessage(String
if not null, the message to associate with the incoming data
while it is locked to prevent garbage collection. msg)Set the lock message for the incoming pack data. |
| public void | setMaxObjectSizeLimit(long
the Git object size limit. If zero then there is not limit. limit)Set the maximum allowed Git object size. |
| public void | setNeedBaseObjectIds(boolean
true to enable keeping track of delta bases.Configure this index pack instance to keep track of the objects assumed for delta bases. |
| public void | setNeedNewObjectIds(boolean
true to enable keeping track of new objects.Configure this index pack instance to keep track of new objects. |
| public void | setObjectChecker(ObjectChecker
the checker instance; null to disable object checking. oc)Configure the checker used to validate received objects. |
| public void | setObjectChecking(boolean
true to enable the default checker; false to disable it. on)Configure the checker used to validate received objects. |
| private long | |
| private void | |
| pack-priv void | |
| protected void | verifySafeObject(final AnyObjectId
identity of the object to be checked. id, final int the type of the object. type, final byte[] raw content of the object. data)Verify the integrity of the object. |
| private void |