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

public abstract Class DfsObjDatabase

extends ObjectDatabase
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.internal.storage.dfs.InMemoryRepository.MemObjDatabase
Static Imports
java.util.stream.Collectors.joining, org.eclipse.jgit.internal.storage.pack.PackExt.BITMAP_INDEX, .PackExt.INDEX

Manages objects stored in org.eclipse.jgit.internal.storage.dfs.DfsPackFile on a storage system.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
DfsObjDatabase.PackList

Snapshot of packs scanned in a single pass.

private static class
public static enum
DfsObjDatabase.PackSource

Sources for a pack file.

Field Summary

Modifier and TypeField and Description
private static final DfsObjDatabase.PackList
private Comparator<DfsPackDescription>
private final AtomicReference<DfsObjDatabase.PackList>
private DfsReaderOptions
private final DfsRepository

Constructor Summary

AccessConstructor and Description
protected
DfsObjDatabase(DfsRepository
repository owning this object database.
repository
,
DfsReaderOptions
how readers should access the object database.
options
)

Initialize an object database for our repository.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv void
protected void
clearCache()

Clears the cached list of packs, forcing them to be scanned again.

public void
close()

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

Implements java.lang.AutoCloseable.close.

Close any resources held by this database.

protected void
commitPack(Collection<DfsPackDescription>
description of the new packs.
desc
,
Collection<DfsPackDescription>
if not null, list of packs to remove.
replaces
)

Commit a pack and index pair that was written to the DFS.

protected abstract void
commitPackImpl(Collection<DfsPackDescription>
description of the new packs.
desc
,
Collection<DfsPackDescription>
if not null, list of packs to remove.
replaces
)

Implementation of pack commit.

protected DfsPackFile

Returns:

the dfs packfile
createDfsPackFile
(DfsBlockCache
block cache
cache
,
DfsPackDescription
pack description
dsc
)

Create instances of DfsPackFile Implementors can decide to construct or wrap DfsPackFile in different ways.

public DfsObjDatabase.PackList

Returns:

list of available packs, with some additional metadata. The returned array is shared with the implementation and must not be modified by the caller.
getCurrentPackList
()

List currently known pack files in the repository, without scanning.

public DfsPackFile[]

Returns:

list of available packs. The returned array is shared with the implementation and must not be modified by the caller.
getCurrentPacks
()

List currently known pack files in the repository, without scanning.

public DfsReftable[]

Returns:

list of available reftables. The returned array is shared with the implementation and must not be modified by the caller.
getCurrentReftables
()

List currently known reftable files in the repository, without scanning.

public PackBitmapIndexWriter

Returns:

a writer to store bitmaps associated with the pack
getPackBitmapIndexWriter
(DfsPackDescription
Pack file to which the bitmaps are associated.
pack
)

Returns a writer to store the bitmap index in this object database.

public PackIndexWriter

Returns:

a writer to store the index associated with the pack
getPackIndexWriter
(DfsPackDescription
Pack file to which the index is associated.
pack
,
int
which version of the index to write
indexVersion
)

Returns a writer to store the pack index in this object database.

public DfsObjDatabase.PackList

Returns:

list of available packs, with some additional metadata. The returned array is shared with the implementation and must not be modified by the caller.
getPackList
()

Scan and list all available pack files in the repository.

public DfsPackFile[]

Returns:

list of available packs. The returned array is shared with the implementation and must not be modified by the caller.
getPacks
()

Scan and list all available pack files in the repository.

public DfsReaderOptions

Returns:

configured reader options, such as read-ahead.
getReaderOptions
()

Get configured reader options, such as read-ahead.

public DfsReftable[]

Returns:

list of available reftables. The returned array is shared with the implementation and must not be modified by the caller.
getReftables
()

Scan and list all available reftable files in the repository.

protected DfsRepository

Returns:

repository owning this object database.
getRepository
()

Get repository owning this object database.

public boolean

Returns:

true if the specified object is stored in this database.
has
(AnyObjectId
identity of the object to test for existence of.
objectId
,
boolean
if true, ignore objects that are unreachable.
avoidUnreachableObjects
)

Does the requested object exist in this database?

protected abstract List<DfsPackDescription>

Returns:

available packs. May be empty if there are no packs.
listPacks
()

List the available pack files.

public ObjectInserter
newInserter()

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

Create a new ObjectInserter to insert new objects.

protected abstract DfsPackDescription

Returns:

a unique name for the pack file. Must not collide with any other pack file name in the same DFS.
newPack
(DfsObjDatabase.PackSource
where the pack stream is created.
source
)

Generate a new unique name for a pack file.

protected DfsPackDescription

Returns:

a unique name for the pack file. Must not collide with any other pack file name in the same DFS.
newPack
(DfsObjDatabase.PackSource
where the pack stream is created.
source
,
long
the estimated size of the pack.
estimatedPackSize
)

Generate a new unique name for a pack file.

public DfsReader
newReader()

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

Create a new ObjectReader to read existing objects.

protected abstract ReadableChannel

Returns:

channel to read the file.
openFile
(DfsPackDescription
description of pack related to the data that will be read. This is an instance previously obtained from listPacks(), but not necessarily from the same DfsObjDatabase instance.
desc
,
PackExt
file extension that will be read i.e "pack" or "idx".
ext
)

Open a pack, pack index, or other related file for reading.

private static Map<DfsPackDescription, DfsPackFile>
protected Comparator<DfsReftable>

Returns:

comparator to sort DfsReftable by priority.
reftableComparator
()

Get comparator to sort DfsReftable by priority.

private static Map<DfsPackDescription, DfsReftable>
protected abstract void
rollbackPack(Collection<DfsPackDescription>
pack to delete.
desc
)

Try to rollback a pack creation.

pack-priv DfsObjDatabase.PackList
private DfsObjDatabase.PackList
public void
setPackComparator(Comparator<DfsPackDescription>
comparator.
packComparator
)

Set the comparator used when searching for objects across packs.

protected abstract DfsOutputStream

Returns:

channel to write the file.
writeFile
(DfsPackDescription
description of pack related to the data that will be written. This is an instance previously obtained from newPack(PackSource).
desc
,
PackExt
file extension that will be written i.e "pack" or "idx".
ext
)

Open a pack, pack index, or other related file for writing.

Inherited from org.eclipse.jgit.lib.ObjectDatabase:
createexistsgetApproximateObjectCountgetShallowCommitshasnewCachedDatabaseopenopensetShallowCommits