public abstract static class ObjectReader.Filter extends ObjectReader
ObjectReader.Filter
OBJ_ANY, streamFileThreshold
Constructor and Description |
---|
Filter() |
Modifier and Type | Method and Description |
---|---|
AbbreviatedObjectId |
abbreviate(AnyObjectId objectId)
Obtain a unique abbreviation (prefix) of an object SHA-1.
|
AbbreviatedObjectId |
abbreviate(AnyObjectId objectId,
int len)
Obtain a unique abbreviation (prefix) of an object SHA-1.
|
void |
close() |
protected abstract ObjectReader |
delegate() |
BitmapIndex |
getBitmapIndex()
An index that can be used to speed up ObjectWalks.
|
ObjectInserter |
getCreatedFromInserter()
Get the
ObjectInserter from which this
reader was created using inserter.newReader() |
long |
getObjectSize(AnyObjectId objectId,
int typeHint)
Get only the size of an object.
|
<T extends ObjectId> |
getObjectSize(Iterable<T> objectIds,
boolean reportMissing)
Asynchronous object size lookup.
|
Set<ObjectId> |
getShallowCommits()
Returns IDs for those commits which should be considered as shallow.
|
boolean |
has(AnyObjectId objectId)
Does the requested object exist in this database?
|
boolean |
has(AnyObjectId objectId,
int typeHint)
Does the requested object exist in this database?
|
ObjectReader |
newReader()
Construct a new reader from the same data.
|
ObjectLoader |
open(AnyObjectId objectId)
Open an object from this database.
|
ObjectLoader |
open(AnyObjectId objectId,
int typeHint)
Open an object from this database.
|
<T extends ObjectId> |
open(Iterable<T> objectIds,
boolean reportMissing)
Asynchronous object opening.
|
Collection<ObjectId> |
resolve(AbbreviatedObjectId id)
Resolve an abbreviated ObjectId to its full form.
|
void |
setAvoidUnreachableObjects(boolean avoid)
Advise the reader to avoid unreachable objects.
|
getStreamFileThreshold, setStreamFileThreshold
protected abstract ObjectReader delegate()
public ObjectReader newReader()
ObjectReader
Applications can use this method to build a new reader from the same data source, but for an different thread.
newReader
in class ObjectReader
public AbbreviatedObjectId abbreviate(AnyObjectId objectId) throws IOException
ObjectReader
ObjectReader.resolve(AbbreviatedObjectId)
, assuming no new objects
are added to this repository between calls.abbreviate
in class ObjectReader
objectId
- object identity that needs to be abbreviated.IOException
- the object store cannot be read.public AbbreviatedObjectId abbreviate(AnyObjectId objectId, int len) throws IOException
ObjectReader
ObjectReader.resolve(AbbreviatedObjectId)
, assuming no new objects
are added to this repository between calls.
The default implementation of this method abbreviates the id to the
minimum length, then resolves it to see if there are multiple results.
When multiple results are found, the length is extended by 1 and resolve
is tried again.abbreviate
in class ObjectReader
objectId
- object identity that needs to be abbreviated.len
- minimum length of the abbreviated string. Must be in the range
[2, ].IOException
- the object store cannot be read.public Collection<ObjectId> resolve(AbbreviatedObjectId id) throws IOException
ObjectReader
resolve
in class ObjectReader
id
- abbreviated id to resolve to a complete identity. The
abbreviation must have a length of at least 2.IOException
- the object store cannot be read.public boolean has(AnyObjectId objectId) throws IOException
ObjectReader
has
in class ObjectReader
objectId
- identity of the object to test for existence of.IOException
- the object store cannot be accessed.public boolean has(AnyObjectId objectId, int typeHint) throws IOException
ObjectReader
has
in class ObjectReader
objectId
- identity of the object to test for existence of.typeHint
- hint about the type of object being requested, e.g.
Constants.OBJ_BLOB
;
ObjectReader.OBJ_ANY
if the object type is not known, or does not
matter to the caller.IncorrectObjectTypeException
- typeHint was not OBJ_ANY, and the object's actual type does
not match typeHint.IOException
- the object store cannot be accessed.public ObjectLoader open(AnyObjectId objectId) throws MissingObjectException, IOException
ObjectReader
open
in class ObjectReader
objectId
- identity of the object to open.ObjectLoader
for accessing the
object.MissingObjectException
- the object does not exist.IOException
- the object store cannot be accessed.public ObjectLoader open(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException
ObjectReader
open
in class ObjectReader
objectId
- identity of the object to open.typeHint
- hint about the type of object being requested, e.g.
Constants.OBJ_BLOB
;
ObjectReader.OBJ_ANY
if the object type is not known, or does not
matter to the caller.ObjectLoader
for accessing the
object.MissingObjectException
- the object does not exist.IncorrectObjectTypeException
- typeHint was not OBJ_ANY, and the object's actual type does
not match typeHint.IOException
- the object store cannot be accessed.public Set<ObjectId> getShallowCommits() throws IOException
ObjectReader
getShallowCommits
in class ObjectReader
IOException
public <T extends ObjectId> AsyncObjectLoaderQueue<T> open(Iterable<T> objectIds, boolean reportMissing)
ObjectReader
open
in class ObjectReader
objectIds
- objects to open from the object store. The supplied collection
must not be modified until the queue has finished.reportMissing
- 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.public long getObjectSize(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException
ObjectReader
The default implementation of this method opens an ObjectLoader. Databases are encouraged to override this if a faster access method is available to them.
getObjectSize
in class ObjectReader
objectId
- identity of the object to open.typeHint
- hint about the type of object being requested, e.g.
Constants.OBJ_BLOB
;
ObjectReader.OBJ_ANY
if the object type is not known, or does not
matter to the caller.MissingObjectException
- the object does not exist.IncorrectObjectTypeException
- typeHint was not OBJ_ANY, and the object's actual type does
not match typeHint.IOException
- the object store cannot be accessed.public <T extends ObjectId> AsyncObjectSizeQueue<T> getObjectSize(Iterable<T> objectIds, boolean reportMissing)
ObjectReader
getObjectSize
in class ObjectReader
objectIds
- objects to get the size of from the object store. The supplied
collection must not be modified until the queue has finished.reportMissing
- 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.public void setAvoidUnreachableObjects(boolean avoid)
ObjectReader
While enabled the reader will skip over anything previously proven to be unreachable. This may be dangerous in the face of concurrent writes.
setAvoidUnreachableObjects
in class ObjectReader
avoid
- true to avoid unreachable objects.public BitmapIndex getBitmapIndex() throws IOException
ObjectReader
getBitmapIndex
in class ObjectReader
IOException
- when the index fails to load@Nullable public ObjectInserter getCreatedFromInserter()
ObjectReader
ObjectInserter
from which this
reader was created using inserter.newReader()
getCreatedFromInserter
in class ObjectReader
ObjectInserter
from which this
reader was created using inserter.newReader()
, or null if
this reader was not created from an inserter.public void close()
ObjectReader
Release any resources used by this reader.
A reader that has been released can be used again, but may need to be released after the subsequent usage.
close
in interface AutoCloseable
close
in class ObjectReader
Copyright © 2018 Eclipse JGit Project. All rights reserved.