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

pack-priv Class CachedObjectDirectory

extends FileObjectDatabase
Class Inheritance
Imports
java.io.File, .IOException, java.util.Collection, .HashSet, .Optional, .Set, org.eclipse.jgit.internal.storage.file.ObjectDirectory.AlternateHandle, org.eclipse.jgit.internal.storage.pack.ObjectToPack, .PackWriter, org.eclipse.jgit.lib.AbbreviatedObjectId, .AnyObjectId, .Config, .Constants, .ObjectDatabase, .ObjectId, .ObjectIdOwnerMap, .ObjectLoader, org.eclipse.jgit.internal.storage.commitgraph.CommitGraph, org.eclipse.jgit.util.FS

The cached instance of an ObjectDirectory.

This class caches the list of loose objects in memory, so the file system is not queried with stat calls.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private CachedObjectDirectory[]
private ObjectIdOwnerMap<CachedObjectDirectory.UnpackedObjectId>
unpackedObjects

The set that contains unpacked objects identifiers, it is created when the cached instance is created.

private final ObjectDirectory

Constructor Summary

AccessConstructor and Description
pack-priv
CachedObjectDirectory(ObjectDirectory
the wrapped database
wrapped
)

The constructor

Method Summary

Modifier and TypeMethod and Description
public void
close()

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

Implements java.lang.AutoCloseable.close.

Close any resources held by this database.

pack-priv File
private ObjectDirectory.AlternateHandle.Id
public long
getApproximateObjectCount()

Implements abstract org.eclipse.jgit.lib.ObjectDatabase.getApproximateObjectCount.

Get a quick, rough count of objects in this repository.

public Optional<CommitGraph>
pack-priv Config
pack-priv File
pack-priv FS
pack-priv long
pack-priv Collection<Pack>
public Set<ObjectId>
getShallowCommits()

Overrides org.eclipse.jgit.lib.ObjectDatabase.getShallowCommits.

Get the shallow commits of the current repository

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

Overrides org.eclipse.jgit.lib.ObjectDatabase.has.

Does the requested object exist in this database?

private boolean
pack-priv FileObjectDatabase.InsertLooseObjectResult
private CachedObjectDirectory[]
public ObjectDatabase
newCachedDatabase()

Overrides org.eclipse.jgit.lib.ObjectDatabase.newCachedDatabase.

Create a new cached database instance over this database.

pack-priv ObjectLoader
pack-priv ObjectLoader
private ObjectLoader
pack-priv Pack
pack-priv void
private ObjectIdOwnerMap<CachedObjectDirectory.UnpackedObjectId>
pack-priv void
public void
setShallowCommits(Set<ObjectId>
the new shallow commits
shallowCommits
)

Overrides org.eclipse.jgit.lib.ObjectDatabase.setShallowCommits.

Update the shallow commits of the current repository

private Set<ObjectDirectory.AlternateHandle.Id>
Inherited from org.eclipse.jgit.internal.storage.file.FileObjectDatabase:
newInserternewReader

Field Detail

altsback to summary
private CachedObjectDirectory[] alts
unpackedObjectsback to summary
private ObjectIdOwnerMap<CachedObjectDirectory.UnpackedObjectId> unpackedObjects

The set that contains unpacked objects identifiers, it is created when the cached instance is created.

wrappedback to summary
private final ObjectDirectory wrapped

Constructor Detail

CachedObjectDirectoryback to summary
pack-priv CachedObjectDirectory(ObjectDirectory wrapped)

The constructor

Parameters
wrapped:ObjectDirectory

the wrapped database

Method Detail

closeback to summary
public void close()

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

Implements java.lang.AutoCloseable.close.

Doc from org.eclipse.jgit.lib.ObjectDatabase.close.

Close any resources held by this database.

Annotations
@Override
fileForback to summary
pack-priv File fileFor(AnyObjectId id)

Implements abstract org.eclipse.jgit.internal.storage.file.FileObjectDatabase.fileFor.

Annotations
@Override
getAlternateIdback to summary
private ObjectDirectory.AlternateHandle.Id getAlternateId()
getApproximateObjectCountback to summary
public long getApproximateObjectCount()

Implements abstract org.eclipse.jgit.lib.ObjectDatabase.getApproximateObjectCount.

Doc from org.eclipse.jgit.lib.ObjectDatabase.getApproximateObjectCount.

Get a quick, rough count of objects in this repository. Ignores loose objects. Returns -1 if an exception occurs.

Returns:long

quick, rough count of objects in this repository, -1 if an exception occurs

Annotations
@Override
getCommitGraphback to summary
public Optional<CommitGraph> getCommitGraph()

Implements abstract org.eclipse.jgit.internal.storage.file.FileObjectDatabase.getCommitGraph.

Annotations
@Override
getConfigback to summary
pack-priv Config getConfig()

Implements abstract org.eclipse.jgit.internal.storage.file.FileObjectDatabase.getConfig.

Annotations
@Override
getDirectoryback to summary
pack-priv File getDirectory()

Implements abstract org.eclipse.jgit.internal.storage.file.FileObjectDatabase.getDirectory.

Annotations
@Override
getFSback to summary
pack-priv FS getFS()

Implements abstract org.eclipse.jgit.internal.storage.file.FileObjectDatabase.getFS.

Annotations
@Override
getObjectSizeback to summary
pack-priv long getObjectSize(WindowCursor curs, AnyObjectId objectId) throws IOException

Implements abstract org.eclipse.jgit.internal.storage.file.FileObjectDatabase.getObjectSize.

Annotations
@Override
getPacksback to summary
pack-priv Collection<Pack> getPacks()

Implements abstract org.eclipse.jgit.internal.storage.file.FileObjectDatabase.getPacks.

Annotations
@Override
getShallowCommitsback to summary
public Set<ObjectId> getShallowCommits() throws IOException

Overrides org.eclipse.jgit.lib.ObjectDatabase.getShallowCommits.

Doc from org.eclipse.jgit.lib.ObjectDatabase.getShallowCommits.

Get the shallow commits of the current repository

Returns:Set<ObjectId>

the shallow commits of the current repository

Annotations
@Override
Exceptions
IOException:
the database could not be read
hasback to summary
public boolean has(AnyObjectId objectId) throws IOException

Overrides org.eclipse.jgit.lib.ObjectDatabase.has.

Doc from org.eclipse.jgit.lib.ObjectDatabase.has.

Does the requested object exist in this database?

This is a one-shot call interface which may be faster than allocating a newReader() to perform the lookup.

Parameters
objectId:AnyObjectId

identity of the object to test for existence of.

Returns:boolean

true if the specified object is stored in this database.

Annotations
@Override
Exceptions
IOException:
the object store cannot be accessed.
hasback to summary
private boolean has(AnyObjectId objectId, Set<ObjectDirectory.AlternateHandle.Id> skips) throws IOException
insertUnpackedObjectback to summary
pack-priv FileObjectDatabase.InsertLooseObjectResult insertUnpackedObject(File tmp, ObjectId objectId, boolean createDuplicate) throws IOException

Implements abstract org.eclipse.jgit.internal.storage.file.FileObjectDatabase.insertUnpackedObject.

Annotations
@Override
myAlternatesback to summary
private CachedObjectDirectory[] myAlternates()
newCachedDatabaseback to summary
public ObjectDatabase newCachedDatabase()

Overrides org.eclipse.jgit.lib.ObjectDatabase.newCachedDatabase.

Doc from org.eclipse.jgit.lib.ObjectDatabase.newCachedDatabase.

Create a new cached database instance over this database. This instance might optimize queries by caching some information about database. So some modifications done after instance creation might fail to be noticed.

Returns:ObjectDatabase

new cached database instance

Annotations
@Override
openLooseObjectback to summary
pack-priv ObjectLoader openLooseObject(WindowCursor curs, AnyObjectId id) throws IOException

Implements abstract org.eclipse.jgit.internal.storage.file.FileObjectDatabase.openLooseObject.

Annotations
@Override
openObjectback to summary
pack-priv ObjectLoader openObject(WindowCursor curs, AnyObjectId objectId) throws IOException

Implements abstract org.eclipse.jgit.internal.storage.file.FileObjectDatabase.openObject.

Annotations
@Override
openObjectback to summary
private ObjectLoader openObject(final WindowCursor curs, final AnyObjectId objectId, Set<ObjectDirectory.AlternateHandle.Id> skips) throws IOException
openPackback to summary
pack-priv Pack openPack(File pack) throws IOException

Implements abstract org.eclipse.jgit.internal.storage.file.FileObjectDatabase.openPack.

Annotations
@Override
resolveback to summary
pack-priv void resolve(Set<ObjectId> matches, AbbreviatedObjectId id) throws IOException

Implements abstract org.eclipse.jgit.internal.storage.file.FileObjectDatabase.resolve.

Annotations
@Override
scanLooseback to summary
private ObjectIdOwnerMap<CachedObjectDirectory.UnpackedObjectId> scanLoose()
selectObjectRepresentationback to summary
pack-priv void selectObjectRepresentation(PackWriter packer, ObjectToPack otp, WindowCursor curs) throws IOException

Implements abstract org.eclipse.jgit.internal.storage.file.FileObjectDatabase.selectObjectRepresentation.

Annotations
@Override
setShallowCommitsback to summary
public void setShallowCommits(Set<ObjectId> shallowCommits) throws IOException

Overrides org.eclipse.jgit.lib.ObjectDatabase.setShallowCommits.

Doc from org.eclipse.jgit.lib.ObjectDatabase.setShallowCommits.

Update the shallow commits of the current repository

Parameters
shallowCommits:Set<ObjectId>

the new shallow commits

Annotations
@Override
Exceptions
IOException:
the database could not be updated
skipMeback to summary
private Set<ObjectDirectory.AlternateHandle.Id> skipMe(Set<ObjectDirectory.AlternateHandle.Id> skips)
org.eclipse.jgit.internal.storage.file back to summary

private Class CachedObjectDirectory.UnpackedObjectId

extends Entry
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv

Constructor Detail

UnpackedObjectIdback to summary
pack-priv UnpackedObjectId(AnyObjectId id)