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

public final Class PackReverseIndexFactory

extends Object
Class Inheritance
Static Imports
org.eclipse.jgit.internal.storage.file.PackReverseIndex.MAGIC, .PackReverseIndex.VERSION_1

Factory for creating instances of PackReverseIndex.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static PackReverseIndex

Returns:

the reverse index instance
computeFromIndex
(PackIndex
the forward index to compute from
packIndex
)

Compute an in-memory pack reverse index from the in-memory pack forward index.

pack-priv static PackReverseIndex

Returns:

the reverse index instance
openOrCompute
(File
the file to read the pack file from, if it exists
idxFile
,
long
the number of objects in the corresponding pack
objectCount
,
PackBitmapIndex.SupplierWithIOException<PackIndex>
a function to lazily get the corresponding forward index
packIndexSupplier
)

Create an in-memory pack reverse index by reading it from the given file if the file exists, or computing it from the given pack index if the file doesn't exist.

pack-priv static PackReverseIndex

Returns:

the reverse index instance
readFromFile
(InputStream
the input stream to read the contents from
src
,
long
the number of objects in the corresponding pack
objectCount
,
PackBitmapIndex.SupplierWithIOException<PackIndex>
a function to lazily get the corresponding forward index
packIndexSupplier
)

Read an in-memory pack reverse index from the given input stream.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PackReverseIndexFactoryback to summary
public PackReverseIndexFactory()

Method Detail

computeFromIndexback to summary
public static PackReverseIndex computeFromIndex(PackIndex packIndex)

Compute an in-memory pack reverse index from the in-memory pack forward index. This computation uses insertion sort, which has a quadratic runtime on average.

Parameters
packIndex:PackIndex

the forward index to compute from

Returns:PackReverseIndex

the reverse index instance

openOrComputeback to summary
pack-priv static PackReverseIndex openOrCompute(File idxFile, long objectCount, PackBitmapIndex.SupplierWithIOException<PackIndex> packIndexSupplier) throws IOException

Create an in-memory pack reverse index by reading it from the given file if the file exists, or computing it from the given pack index if the file doesn't exist.

Parameters
idxFile:File

the file to read the pack file from, if it exists

objectCount:long

the number of objects in the corresponding pack

packIndexSupplier:PackBitmapIndex.SupplierWithIOException<PackIndex>

a function to lazily get the corresponding forward index

Returns:PackReverseIndex

the reverse index instance

Exceptions
IOException:
if reading from the file fails
readFromFileback to summary
pack-priv static PackReverseIndex readFromFile(InputStream src, long objectCount, PackBitmapIndex.SupplierWithIOException<PackIndex> packIndexSupplier) throws IOException

Read an in-memory pack reverse index from the given input stream. This has a linear runtime.

Parameters
src:InputStream

the input stream to read the contents from

objectCount:long

the number of objects in the corresponding pack

packIndexSupplier:PackBitmapIndex.SupplierWithIOException<PackIndex>

a function to lazily get the corresponding forward index

Returns:PackReverseIndex

the reverse index instance

Exceptions
IOException:
if reading from the input stream fails