| Modifier and Type | Field and Description |
|---|---|
| private DfsBlockCache | blockCache
Cache the chunks were stored into or get read back from. |
| private int | blockSize
Block size to use when caching data for read back. |
| private final CRC32 | crc
CRC-32 computation for objects that are appended onto the pack. |
| private byte[] | currBuf
Data being written that has not yet been cached. |
| private int | |
| private long | |
| private Deflater | def
Compresses delta bases when completing a thin pack. |
| private boolean | isEmptyPack
True if the pack is an empty pack. |
| private final DfsObjDatabase | |
| private final DfsInserter | |
| private DfsOutputStream | out
Stream to the DFS storage, opened during |
| private final MessageDigest | packDigest
Running SHA-1 of the entire pack stream.
|
| private DfsPackDescription | packDsc
Name of the pack file, computed in |
| private long | packEnd
Current end of the pack file. |
| private byte[] | packHash
Checksum of the entire pack file. |
| private PackIndex | packIndex
If the index was small enough, the entire index after writing. |
| private DfsStreamKey | packKey
Key used during delta resolution reading delta chains. |
| private DfsBlock | |
| private long | readPos
Cached block that is being read. |
| Access | Constructor and Description |
|---|---|
| protected | DfsPackParser(DfsObjDatabase
database the objects will be imported into. db, DfsInserter inserter the parser will use to help it inject the objects. ins, InputStream the stream to parse. in)Initialize a new pack parser. |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| protected boolean | checkCRC(int
the prior CRC that was recorded during the first scan of the
object from the pack stream. oldCRC)Implements abstract org. Check the current CRC matches the expected value. |
| private DfsBlock | |
| public DfsPackDescription | Returns: description of the imported pack, if one was made.Get description of the imported pack, if one was made. |
| protected boolean | onAppendBase(final int
type of the base object. typeCode, final byte[] complete content of the base object. data, final PackedObjectInfo packed object information for this base. Implementors must
populate the CRC and offset members if returning true. info)Implements abstract org. Provide the implementation with a base that was outside of the pack. |
| protected void | onBeginOfsDelta(long
position of this object in the incoming stream. streamPosition, 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)Implements abstract org. Event notifying start of a delta referencing its base by offset. |
| protected void | onBeginRefDelta(long
position of this object in the incoming stream. streamPosition, 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)Implements abstract org. Event notifying start of a delta referencing its base by ObjectId. |
| protected 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)Implements abstract org. Event notifying the start of an object stored whole (not as a delta). |
| protected PackParser. | onEndDelta()
Overrides org. Event notifying the current object. |
| protected void | onEndThinPack()
Implements abstract org. Event indicating a thin pack has been completely processed. |
| protected void | onEndWholeObject(PackedObjectInfo
object information. info)Implements abstract org. Event notifying the current object. |
| protected void | onInflatedObjectData(PackedObjectInfo
the object info, populated. obj, int the type of the object. typeCode, byte[] inflated data for the object. data)Implements abstract org. Invoked for commits, trees, tags, and small blobs. |
| protected 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)Implements abstract org. Store (and/or checksum) a portion of an object's data. |
| protected 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)Implements abstract org. Store (and/or checksum) an object header. |
| protected void | onPackFooter(byte[]
the trailing 20 bytes of the pack, this is a SHA-1 checksum of
all of the pack data. hash)Implements abstract org. Provide the implementation with the original stream's pack footer. |
| protected void | onPackHeader(long
number of objects expected in the stream. objectCount)Implements abstract org. Provide the implementation with the original stream's pack header. |
| protected 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)Implements abstract org. Store bytes received from the raw stream. |
| public PackLock | parse(ProgressMonitor
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)Overrides org. Parse the pack stream. |
| private int | |
| protected int | readDatabase(byte[]
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)Implements abstract org. Read from the database's current position into the buffer. |
| protected PackParser. | seekDatabase(PackedObjectInfo
the object position to begin reading from. This is from
obj, PackParser.newInfo(AnyObjectId, UnresolvedDelta, ObjectId).object to populate with type and size. infoImplements abstract org. Reposition the database to re-read a previously stored object. |
| protected PackParser. | seekDatabase(PackParser.
the object position to begin reading from. This is an instance
previously returned by delta,onEndDelta().object to populate with type and size. infoImplements abstract org. Reposition the database to re-read a previously stored object. |
| private long | |
| private void |
| blockCache | back to summary |
|---|---|
| private DfsBlockCache blockCache Cache the chunks were stored into or get read back from. | |
| blockSize | back to summary |
|---|---|
| private int blockSize Block size to use when caching data for read back. | |
| crc | back to summary |
|---|---|
| private final CRC32 crc CRC-32 computation for objects that are appended onto the pack. | |
| currBuf | back to summary |
|---|---|
| private byte[] currBuf Data being written that has not yet been cached. | |
| currEnd | back to summary |
|---|---|
| private int currEnd | |
| currPos | back to summary |
|---|---|
| private long currPos | |
| def | back to summary |
|---|---|
| private Deflater def Compresses delta bases when completing a thin pack. | |
| isEmptyPack | back to summary |
|---|---|
| private boolean isEmptyPack True if the pack is an empty pack. | |
| objdb | back to summary |
|---|---|
| private final DfsObjDatabase objdb | |
| objins | back to summary |
|---|---|
| private final DfsInserter objins | |
| out | back to summary |
|---|---|
| private DfsOutputStream out Stream to the DFS storage, opened during | |
| packDigest | back to summary |
|---|---|
| private final MessageDigest packDigest Hides org. Running SHA-1 of the entire pack stream. | |
| packDsc | back to summary |
|---|---|
| private DfsPackDescription packDsc Name of the pack file, computed in | |
| packEnd | back to summary |
|---|---|
| private long packEnd Current end of the pack file. | |
| packHash | back to summary |
|---|---|
| private byte[] packHash Checksum of the entire pack file. | |
| packIndex | back to summary |
|---|---|
| private PackIndex packIndex If the index was small enough, the entire index after writing. | |
| packKey | back to summary |
|---|---|
| private DfsStreamKey packKey Key used during delta resolution reading delta chains. | |
| readBlock | back to summary |
|---|---|
| private DfsBlock readBlock | |
| readPos | back to summary |
|---|---|
| private long readPos Cached block that is being read. | |
| DfsPackParser | back to summary |
|---|---|
| protected DfsPackParser(DfsObjDatabase db, DfsInserter ins, InputStream in) Initialize a new pack parser.
| |
| buffer | back to summary |
|---|---|
| private void buffer(byte[] raw, int pos, int len) throws IOException | |
| checkCRC | back to summary |
|---|---|
| protected boolean checkCRC(int oldCRC) Implements abstract org. Doc from org. Check the current CRC matches the expected value. This method is invoked when an object is read back in from the database and its data is used during delta resolution. The CRC is validated after the object has been fully read, allowing the parser to verify there was no silent data corruption. Implementations are free to ignore this check by always returning true if they are performing other data integrity validations at a lower level.
| |
| flushBlock | back to summary |
|---|---|
| private DfsBlock flushBlock() throws IOException | |
| getPackDescription | back to summary |
|---|---|
| public DfsPackDescription getPackDescription() Get description of the imported pack, if one was made.
| |
| onAppendBase | back to summary |
|---|---|
| protected boolean onAppendBase(final int typeCode, final byte[] data, final PackedObjectInfo info) throws IOException Implements abstract org. Doc from org. Provide the implementation with a base that was outside of the pack. This event only occurs on a thin pack for base objects that were outside of the pack and came from the local repository. Usually an implementation uses this event to compress the base and append it onto the end of the pack, so the pack stays self-contained.
| |
| onBeginOfsDelta | back to summary |
|---|---|
| protected void onBeginOfsDelta(long streamPosition, long baseStreamPosition, long inflatedSize) throws IOException Implements abstract org. Doc from org. Event notifying start of a delta referencing its base by offset.
| |
| onBeginRefDelta | back to summary |
|---|---|
| protected void onBeginRefDelta(long streamPosition, AnyObjectId baseId, long inflatedSize) throws IOException Implements abstract org. Doc from org. Event notifying start of a delta referencing its base by ObjectId.
| |
| onBeginWholeObject | back to summary |
|---|---|
| protected void onBeginWholeObject(long streamPosition, int type, long inflatedSize) throws IOException Implements abstract org. Doc from org. Event notifying the start of an object stored whole (not as a delta).
| |
| onEndDelta | back to summary |
|---|---|
| protected PackParser. Overrides org. Doc from org. Event notifying the current object.
| |
| onEndThinPack | back to summary |
|---|---|
| protected void onEndThinPack() throws IOException Implements abstract org. Doc from org. Event indicating a thin pack has been completely processed. This event is invoked only if a thin pack has delta references to objects external from the pack. The event is called after all of those deltas have been resolved.
| |
| onEndWholeObject | back to summary |
|---|---|
| protected void onEndWholeObject(PackedObjectInfo info) throws IOException Implements abstract org. Doc from org. Event notifying the current object.
| |
| onInflatedObjectData | back to summary |
|---|---|
| protected void onInflatedObjectData(PackedObjectInfo obj, int typeCode, byte[] data) throws IOException Implements abstract org. Doc from org. Invoked for commits, trees, tags, and small blobs.
| |
| onObjectData | back to summary |
|---|---|
| protected void onObjectData(PackParser. Implements abstract org. Doc from org. Store (and/or checksum) a portion of an object's data. This method may be invoked multiple times per object, depending on the size of the object, the size of the parser's internal read buffer, and the alignment of the object relative to the read buffer.
Invoked after
| |
| onObjectHeader | back to summary |
|---|---|
| protected void onObjectHeader(PackParser. Implements abstract org. Doc from org. Store (and/or checksum) an object header.
Invoked after any of the
| |
| onPackFooter | back to summary |
|---|---|
| protected void onPackFooter(byte[] hash) throws IOException Implements abstract org. Doc from org. Provide the implementation with the original stream's pack footer.
| |
| onPackHeader | back to summary |
|---|---|
| protected void onPackHeader(long objectCount) throws IOException Implements abstract org. Doc from org. Provide the implementation with the original stream's pack header.
| |
| onStoreStream | back to summary |
|---|---|
| protected void onStoreStream(byte[] raw, int pos, int len) throws IOException Implements abstract org. Doc from org. Store bytes received from the raw stream.
This method is invoked during
The only component of the pack not supplied to this method is the last 20
bytes of the pack that comprise the trailing SHA-1 checksum. Those are
passed to
| |
| parse | back to summary |
|---|---|
| public PackLock parse(ProgressMonitor receiving, ProgressMonitor resolving) throws IOException Overrides org. Doc from org. Parse the pack stream.
| |
| read | back to summary |
|---|---|
| private int read(long pos, byte[] dst, int off, int len) throws IOException | |
| readDatabase | back to summary |
|---|---|
| protected int readDatabase(byte[] dst, int pos, int cnt) throws IOException Implements abstract org. Doc from org. Read from the database's current position into the buffer.
| |
| seekDatabase | back to summary |
|---|---|
| protected PackParser. Implements abstract org. Doc from org. Reposition the database to re-read a previously stored object. If the database is computing CRC-32 checksums for object data, it should reset its internal CRC instance during this method call.
| |
| seekDatabase | back to summary |
|---|---|
| protected PackParser. Implements abstract org. Doc from org. Reposition the database to re-read a previously stored object. If the database is computing CRC-32 checksums for object data, it should reset its internal CRC instance during this method call.
| |
| toBlockStart | back to summary |
|---|---|
| private long toBlockStart(long pos) | |
| writePackIndex | back to summary |
|---|---|
| private void writePackIndex() throws IOException | |