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

public Class DfsReader

extends ObjectReader
implements ObjectReuseAsIs
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.internal.storage.pack.ObjectReuseAsIs
Static Imports
org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource.UNREACHABLE_GARBAGE, org.eclipse.jgit.lib.Constants.OBJECT_ID_LENGTH

Reader to access repository content through.

See the base org.eclipse.jgit.lib.ObjectReader documentation for details. Notably, a reader is not thread safe.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
protected static interface
DfsReader.PackLoadListener

Announces when data is loaded by reader

Field Summary

Modifier and TypeField and Description
private boolean
private DeltaBaseCache
private DfsBlock
pack-priv final DfsObjDatabase
db

Database this reader loads objects from.

private static final Comparator<DfsReader.FoundObject<?>>
private Inflater
private DfsPackFile
private static final int
private static final Comparator<DfsObjectToPack>
private static final Comparator<DfsPackFile>
private List<DfsReader.PackLoadListener>
pack-priv final DfsReaderIoStats.Accumulator
pack-priv final byte[]
tempId

Temporary buffer large enough for at least one raw object id.

Inherited from org.eclipse.jgit.lib.ObjectReader:
OBJ_ANYstreamFileThreshold

Constructor Summary

AccessConstructor and Description
protected
DfsReader(DfsObjDatabase
parent DfsObjDatabase.
db
)

Initialize a new DfsReader

Method Summary

Modifier and TypeMethod and Description
protected void
addPackLoadListener(DfsReader.PackLoadListener
a listener
listener
)

Add listener to record loads by this reader

private static boolean
private static ObjectLoader
checkType(ObjectLoader ldr, AnyObjectId id, int typeHint)

public void
close()

Implements abstract org.eclipse.jgit.lib.ObjectReader.close.

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

pack-priv int

Returns:

number of bytes actually copied; this may be less than cnt if cnt exceeded the number of bytes available.
copy
(BlockBasedFile
the file the desired window is stored within.
file
,
long
position within the file to read from.
position
,
byte[]
destination buffer to copy into.
dstbuf
,
int
offset within dstbuf to start copying into.
dstoff
,
int
number of bytes to copy. This value may exceed the number of bytes remaining in the window starting at offset pos.
cnt
)

Copy bytes from the window to a caller supplied buffer.

public void
copyObjectAsIs(PackOutputStream
stream the object should be written to.
out
,
ObjectToPack
the object's saved representation information.
otp
,
boolean
if true the representation must be validated and not be corrupt before being reused. If false, validation may be skipped as it will be performed elsewhere in the processing pipeline.
validate
)

Implements org.eclipse.jgit.internal.storage.pack.ObjectReuseAsIs.copyObjectAsIs.

Output a previously selected representation.

public void
copyPackAsIs(PackOutputStream
stream to append the pack onto.
out
,
CachedPack
the cached pack to send.
pack
)

Implements org.eclipse.jgit.internal.storage.pack.ObjectReuseAsIs.copyPackAsIs.

Append an entire pack's contents onto the output stream.

protected BitmapIndex

Returns:

an instance of BitmapIndex
createBitmapIndex
(PackBitmapIndex
packBitmapIndex found in a pack (never null)
packBitmapIndex
)

Give subclasses a chance to record pack index stats

pack-priv void
emitBlockLoad(BlockBasedFile file, long position, DfsBlock dfsBlock)

pack-priv void
emitIndexLoad(DfsPackDescription packDescription, PackExt ext, Object loadedIdx)

private <T extends ObjectId> Iterable<DfsReader.FoundObject<T>>
findAll(Iterable<T> objectIds)

private List<DfsObjectToPack>
findAllFromPack(DfsPackFile pack, Iterable<ObjectToPack> objects, boolean skipFound)

private <T extends ObjectId> void
private DfsPackFile
private List<DfsPackFile>
public BitmapIndex
getBitmapIndex()

Overrides org.eclipse.jgit.lib.ObjectReader.getBitmapIndex.

An index that can be used to speed up ObjectWalks.

public Collection<CachedPack>
getCachedPacksAndUpdate(BitmapIndex.BitmapBuilder
the bitmap that contains all of the objects the client wants.
needBitmap
)

Implements org.eclipse.jgit.internal.storage.pack.ObjectReuseAsIs.getCachedPacksAndUpdate.

Obtain the available cached packs that match the bitmap and update the bitmap by removing the items that are in the CachedPack.

public Optional<CommitGraph>
getCommitGraph()

Overrides org.eclipse.jgit.lib.ObjectReader.getCommitGraph.

Get the commit-graph for this repository if available.

pack-priv DeltaBaseCache
public DfsReaderIoStats

Returns:

IO statistics accumulated by this reader.
getIoStats
()

Get IO statistics accumulated by this reader.

public <T extends ObjectId> AsyncObjectSizeQueue<T>
getObjectSize(Iterable<T>
objects to get the size of from the object store. The supplied collection must not be modified until the queue has finished.
objectIds
,
final boolean
if true missing objects are reported by calling failure with a MissingObjectException. This may be more expensive for the implementation to guarantee. If false the implementation may choose to report MissingObjectException, or silently skip over the object with no warning.
reportMissing
)

Overrides org.eclipse.jgit.lib.ObjectReader.getObjectSize.

Asynchronous object size lookup.

public long
getObjectSize(AnyObjectId
identity of the object to open.
objectId
,
int
hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.
typeHint
)

Overrides org.eclipse.jgit.lib.ObjectReader.getObjectSize.

Get only the size of an object.

pack-priv DfsReaderOptions
public Set<ObjectId>
getShallowCommits()

Implements abstract org.eclipse.jgit.lib.ObjectReader.getShallowCommits.

Returns IDs for those commits which should be considered as shallow.

public boolean
has(AnyObjectId
identity of the object to test for existence of.
objectId
)

Overrides org.eclipse.jgit.lib.ObjectReader.has.

Does the requested object exist in this database?

private boolean
pack-priv int

Returns:

number of bytes inflated into dstbuf.
inflate
(DfsPackFile
the file the desired window is stored within.
pack
,
long
position within the file to read from.
position
,
byte[]
destination buffer the inflater should output decompressed data to. Must be large enough to store the entire stream, unless headerOnly is true.
dstbuf
,
boolean
if true the caller wants only dstbuf.length bytes.
headerOnly
)

Inflate a region of the pack starting at position.

pack-priv Inflater
private boolean
public boolean
isNotLargerThan(AnyObjectId
identity of the object to open.
objectId
,
int
hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.
typeHint
,
long
threshold value for the size of the object in bytes.
limit
)

Overrides org.eclipse.jgit.lib.ObjectReader.isNotLargerThan.

Check if the object size is less or equal than certain value By default, it reads the object from storage to get the size.

public DfsObjectToPack
newObjectToPack(AnyObjectId
the id of the object that will be packed.
objectId
,
int
the Git type of the object that will be packed.
type
)

Implements org.eclipse.jgit.internal.storage.pack.ObjectReuseAsIs.newObjectToPack.

Allocate a new PackWriter state structure for an object.

public ObjectReader
newReader()

Implements abstract org.eclipse.jgit.lib.ObjectReader.newReader.

Construct a new reader from the same data.

public ObjectLoader
open(AnyObjectId
identity of the object to open.
objectId
,
int
hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.
typeHint
)

Implements abstract org.eclipse.jgit.lib.ObjectReader.open.

Open an object from this database.

public <T extends ObjectId> AsyncObjectLoaderQueue<T>
open(Iterable<T>
objects to open from the object store. The supplied collection must not be modified until the queue has finished.
objectIds
,
final boolean
if true missing objects are reported by calling failure with a MissingObjectException. This may be more expensive for the implementation to guarantee. If false the implementation may choose to report MissingObjectException, or silently skip over the object with no warning.
reportMissing
)

Overrides org.eclipse.jgit.lib.ObjectReader.open.

Asynchronous object opening.

private ObjectLoader
pack-priv void
pin(BlockBasedFile file, long position)

private void
pack-priv DfsBlock
quickCopy(DfsPackFile p, long pos, long cnt)

public Collection<ObjectId>
resolve(AbbreviatedObjectId
abbreviated id to resolve to a complete identity. The abbreviation must have a length of at least 2.
id
)

Implements abstract org.eclipse.jgit.lib.ObjectReader.resolve.

Resolve an abbreviated ObjectId to its full form.

private void
private Optional<Long>
private boolean
public void
selectObjectRepresentation(PackWriter
the packer that will write the object in the near future.
packer
,
ProgressMonitor
progress monitor, implementation should update the monitor once for each item in the iteration when selection is done.
monitor
,
Iterable<ObjectToPack>
the objects that are being packed.
objects
)

Implements org.eclipse.jgit.internal.storage.pack.ObjectReuseAsIs.selectObjectRepresentation.

Select the best object representation for a packer.

public void
setAvoidUnreachableObjects(boolean
true to avoid unreachable objects.
avoid
)

Overrides org.eclipse.jgit.lib.ObjectReader.setAvoidUnreachableObjects.

Advise the reader to avoid unreachable objects.

private boolean
private List<DfsPackFile>
private void
trySelectRepresentation(PackWriter packer, ProgressMonitor monitor, Iterable<ObjectToPack> objects, List<DfsPackFile> packs, boolean skipFound)

pack-priv void
public void
writeObjects(PackOutputStream
the stream to write each object to.
out
,
List<ObjectToPack>
the list of objects to write. Objects should be written in approximately this order. Implementors may resort the list elements in-place during writing if desired.
list
)

Implements org.eclipse.jgit.internal.storage.pack.ObjectReuseAsIs.writeObjects.

Write objects to the pack stream in roughly the order given.

Inherited from org.eclipse.jgit.lib.ObjectReader:
abbreviateabbreviatecreateObjectReachabilityCheckercreateReachabilityCheckergetCreatedFromInsertergetStreamFileThresholdhasopensetStreamFileThreshold