Top Description Inners Fields Constructors Methods
org.eclipse.jgit.internal.storage.dfs

public final Class DfsPackFile

extends BlockBasedFile
Class Inheritance
Static Imports
org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource.UNREACHABLE_GARBAGE, org.eclipse.jgit.internal.storage.pack.PackExt.BITMAP_INDEX, .PackExt.COMMIT_GRAPH, .PackExt.INDEX, .PackExt.OBJECT_SIZE_INDEX, .PackExt.PACK, .PackExt.REVERSE_INDEX

A Git version 2 pack file representation. A pack file contains Git objects in delta packed format yielding high compression of lots of object where some objects are similar.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
DfsPackFile.CachedStreamIndexFactory

An index factory backed by Dfs streams and references cached in DfsBlockCache

public static class
DfsPackFile.CachedStreamPackIndexes

Load primary and reverse index from Dfs streams and cache the references in DfsBlockCache.

private static class
public static interface
DfsPackFile.IndexFactory

Returns the indexes for this pack.

public static interface
DfsPackFile.PackBitmapIndexLoader

Loads the PackBitmapIndex associated with this packfile

private static class
private static class
DfsPackFile.StreamPackBitmapIndexLoader

Load the packbitmapindex from the BITMAP_INDEX pack extension

Field Summary

Modifier and TypeField and Description
private volatile PackBitmapIndex
bitmapIndex

Index of compressed bitmap mapping entire object graph.

private final DfsPackFile.PackBitmapIndexLoader
private volatile CommitGraph
commitGraph

Index of compressed commit graph mapping entire object graph.

private volatile LongList
corruptObjects

Objects we have tried to read, and discovered to be corrupt.

private final Object
public static final DfsPackFile.PackBitmapIndexLoader
DEFAULT_BITMAP_LOADER

Loader for the default file-based PackBitmapIndex implementation.

private volatile PackIndex
index

Index mapping ObjectId to position within the pack stream.

private final DfsPackFile.IndexFactory
private volatile PackObjectSizeIndex
private boolean
private static final int
private static final long
private volatile PackReverseIndex
reverseIndex

Reverse version of index mapping position to ObjectId.

Inherited from org.eclipse.jgit.internal.storage.dfs.BlockBasedFile:
blockSizecachedescextinvalidinvalidatingCausekeylength

Constructor Summary

AccessConstructor and Description
pack-priv
DfsPackFile(DfsBlockCache
cache that owns the pack data.
cache
,
DfsPackDescription
description of the pack within the DFS.
desc
)

Construct a reader for an existing, packfile.

public
DfsPackFile(DfsBlockCache
cache that owns the pack data
cache
,
DfsPackDescription
description of the pack within the DFS
desc
,
DfsPackFile.PackBitmapIndexLoader
loader to get the bitmaps of this pack (if any)
bitmapLoader
,
DfsPackFile.IndexFactory
an IndexFactory to get references to the indexes of this pack
indexFactory
)

Create an instance of DfsPackFile with a custom bitmap loader

Method Summary

Modifier and TypeMethod and Description
private static InputStream
pack-priv void
copyAsIs(PackOutputStream out, DfsObjectToPack src, boolean validate, DfsReader ctx)

pack-priv void
private long
private void
private byte[]
decompress(long position, int sz, DfsReader ctx)

private long
pack-priv long
pack-priv ObjectLoader

Returns:

the object loader for the requested object if it is contained in this pack; null if the object was not found.
get
(DfsReader
temporary working space associated with the calling thread.
ctx
,
AnyObjectId
the object to obtain from the pack. Must not be null.
id
)

Get an object from this pack.

public PackBitmapIndex

Returns:

the BitmapIndex.
getBitmapIndex
(DfsReader
reader context to support reading from the backing store if the index is not already loaded in memory.
ctx
)

Get the BitmapIndex for this PackFile.

public CommitGraph

Returns:

org.eclipse.jgit.internal.storage.commitgraph.CommitGraph, null if pack doesn't have it.
getCommitGraph
(DfsReader
reader context to support reading from the backing store if the index is not already loaded in memory.
ctx
)

Get the Commit Graph for this PackFile.

pack-priv byte[]
getDeltaHeader(DfsReader wc, long pos)

pack-priv long

Returns:

size of the object from the index. Negative if object is not in the index (below threshold or not a blob)
getIndexedObjectSize
(DfsReader
reader context to support reading from the backing store if the object size index is not already loaded in memory.
ctx
,
AnyObjectId
object id of an object in the pack
id
)

Return the size of the object from the object-size index.

pack-priv long

Returns:

number of objects in index of this pack, likewise in this pack
getObjectCount
(DfsReader
current reader for the calling thread.
ctx
)

Obtain the total number of objects available in this pack.

pack-priv long
pack-priv long
getObjectSize(DfsReader ctx, long pos)

private PackObjectSizeIndex
pack-priv int

Returns:

minimum size for indexing in bytes
getObjectSizeIndexThreshold
(DfsReader
reader context to support reading from the backing store if the object size index is not already loaded in memory.
ctx
)

Return minimum size for an object to be included in the object size index.

pack-priv int
getObjectType(DfsReader ctx, long pos)

public DfsPackDescription

Returns:

description that was originally used to configure this pack file.
getPackDescription
()

Get description that was originally used to configure this pack file.

public PackIndex

Returns:

the PackIndex.
getPackIndex
(DfsReader
reader context to support reading from the backing store if the index is not already loaded in memory.
ctx
)

Get the PackIndex for this PackFile.

public PackReverseIndex

Returns:

the PackReverseIndex
getReverseIdx
(DfsReader
reader context to support reading from the backing store if the index is not already loaded in memory
ctx
)

Get the PackReverseIndex for this PackFile.

public boolean

Returns:

true if the object exists in this pack; false if it does not.
hasObject
(DfsReader
reader context to support reading from the backing store if the index is not already loaded in memory.
ctx
,
AnyObjectId
object to be located.
id
)

Check if an object is stored within this pack.

pack-priv boolean

Returns:

true if the packfile has an object size index.
hasObjectSizeIndex
(DfsReader
reader context to support reading from the backing store if the object size index is not already loaded in memory.
ctx
)

Return if this packfile has an object size index attached.

private PackIndex
pack-priv boolean
isCorrupt(long offset)

pack-priv final boolean
public boolean

Returns:

whether the pack index file is loaded and cached in memory.
isIndexLoaded
()

Whether the pack index file is loaded and cached in memory.

pack-priv ObjectLoader
load(DfsReader ctx, long pos)

private DfsBlockCache.Ref<PackBitmapIndex>
private DfsBlockCache.Ref<CommitGraph>
private DfsBlockCache.Ref<PackObjectSizeIndex>
loadObjectSizeIndex(DfsReader ctx, DfsStreamKey objectSizeIndexKey)

private ByteBuffer
private IOException
private void
readFully(long position, byte[] dstbuf, int dstoff, int cnt, DfsReader ctx)

pack-priv void
pack-priv void
resolve(DfsReader ctx, Set<ObjectId> matches, AbbreviatedObjectId id, int matchLimit)

private void
setCorrupt(long offset)

pack-priv void
Inherited from org.eclipse.jgit.internal.storage.dfs.BlockBasedFile:
alignToBlockblockSizeelapsedMicrosgetFileNamegetOrLoadBlockinvalidreadreadOneBlocksetBlockSizesetInvalid