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

public Class DfsPackDescription

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.internal.storage.dfs.InMemoryRepository.MemPack
Static Imports
org.eclipse.jgit.internal.storage.pack.PackExt.PACK, .PackExt.REFTABLE

Description of a DFS stored pack/index file.

Implementors may extend this class and add additional data members.

Instances of this class are cached with the DfsPackFile, and should not be modified once initialized and presented to the JGit DFS library.

Field Summary

Modifier and TypeField and Description
private int[]
private CommitGraphWriter.Stats
private long
private long
private int
private int
private long
private long
private long
private long
private final String
private DfsObjDatabase.PackSource
private PackStatistics
private ReftableWriter.Stats
private final DfsRepositoryDescription
private long[]

Constructor Summary

AccessConstructor and Description
public
DfsPackDescription(DfsRepositoryDescription
description of the repo containing the pack file.
repoDesc
,
String
name of the pack file. Must end with ".pack".
name
,
DfsObjDatabase.PackSource
the source of the pack.
packSource
)

Initialize a description by pack name and repository.

Method Summary

Modifier and TypeMethod and Description
public void
addFileExt(PackExt
the file extension
ext
)

Adds the pack file extension to the known list.

public DfsPackDescription

Returns:

this
clearPackStats
()

Discard the pack statistics, if it was populated.

public boolean
equals(Object
the reference object with which to compare.
b
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public int

Returns:

blockSize of the file, in bytes. If 0 the blockSize size is not yet known and may be discovered when opening the file.
getBlockSize
(PackExt
the file extension.
ext
)

Get blockSize of the file, in bytes.

public CommitGraphWriter.Stats

Returns:

stats from the sibling commit graph, if created.
getCommitGraphStats
()

Get stats from the sibling commit graph, if created.

public long

Returns:

number of delta compressed objects in the pack.
getDeltaCount
()

Get number of delta compressed objects in the pack.

public long

Returns:

estimated size of the .pack file in bytes. If 0 the pack file size is unknown.
getEstimatedPackSize
()

Get estimated size of the .pack file in bytes.

public String

Returns:

name of the file.
getFileName
(PackExt
the file extension
ext
)

Get file name

public long

Returns:

size of the file, in bytes. If 0 the file size is not yet known.
getFileSize
(PackExt
the file extension.
ext
)

Get size of the file, in bytes.

public int

Returns:

the version of the index file written.
getIndexVersion
()

Get the version of the index file written.

public long

Returns:

time the pack was created, in milliseconds.
getLastModified
()

Get time the pack was created, in milliseconds.

public long

Returns:

maxUpdateIndex for the reftable, if present.
getMaxUpdateIndex
()

Get maxUpdateIndex for the reftable, if present.

public long

Returns:

minUpdateIndex for the reftable, if present.
getMinUpdateIndex
()

Get minUpdateIndex for the reftable, if present.

public long

Returns:

number of objects in the pack.
getObjectCount
()

Get number of objects in the pack.

public DfsObjDatabase.PackSource

Returns:

the source of the pack.
getPackSource
()

Get the source of the pack.

public PackStatistics

Returns:

statistics from PackWriter, if the pack was built with it. Generally this is only available for packs created by DfsGarbageCollector or DfsPackCompactor, and only when the pack is being committed to the repository.
getPackStats
()

Get statistics from PackWriter, if the pack was built with it.

public ReftableWriter.Stats

Returns:

stats from the sibling reftable, if created.
getReftableStats
()

Get stats from the sibling reftable, if created.

public DfsRepositoryDescription

Returns:

description of the repository.
getRepositoryDescription
()

Get description of the repository.

public DfsStreamKey

Returns:

cache key for use by the block cache.
getStreamKey
(PackExt
the file extension.
ext
)

Get cache key for use by the block cache.

public boolean

Returns:

whether the pack file extension is known to exist.
hasFileExt
(PackExt
the file extension
ext
)

Whether the pack file extension is known to exist.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

pack-priv static boolean
public static Comparator<DfsPackDescription>

Returns:

comparator.
objectLookupComparator
()

Comparator for packs when looking up objects in indexes.

public static Comparator<DfsPackDescription>

Returns:

comparator.
objectLookupComparator
(Comparator<DfsObjDatabase.PackSource>
comparator for the PackSource, used as the first step in comparison.
packSourceComparator
)

Comparator for packs when looking up objects in indexes.

pack-priv static Comparator<DfsPackDescription>
pack-priv static Comparator<DfsPackDescription>
public DfsPackDescription

Returns:

this
setBlockSize
(PackExt
the file extension.
ext
,
int
blockSize of the file, in bytes. If 0 the blockSize is not known and will be determined on first read.
blockSize
)

Set blockSize of the file, in bytes.

pack-priv void
public DfsPackDescription

Returns:

this
setDeltaCount
(long
number of delta compressed objects in the pack.
cnt
)

Set number of delta compressed objects in the pack.

public DfsPackDescription

Returns:

this
setEstimatedPackSize
(long
estimated size of the .pack file in bytes. If 0 the pack file size is unknown.
estimatedPackSize
)

Set estimated size of the .pack file in bytes.

public DfsPackDescription

Returns:

this
setFileSize
(PackExt
the file extension.
ext
,
long
size of the file in bytes. If 0 the file is not known and will be determined on first read.
bytes
)

Set size of the file in bytes.

public DfsPackDescription

Returns:

this
setIndexVersion
(int
the version of the index file written.
version
)

Set the version of the index file written.

public DfsPackDescription

Returns:

this
setLastModified
(long
time the pack was created, in milliseconds. 0 if not known.
timeMillis
)

Set time the pack was created, in milliseconds.

public DfsPackDescription

Returns:

this
setMaxUpdateIndex
(long
maxUpdateIndex for the reftable.
max
)

Set maxUpdateIndex for the reftable.

public DfsPackDescription

Returns:

this
setMinUpdateIndex
(long
minUpdateIndex for the reftable.
min
)

Set minUpdateIndex for the reftable.

public DfsPackDescription

Returns:

this
setObjectCount
(long
number of objects in the pack.
cnt
)

Set number of objects in the pack.

public DfsPackDescription

Returns:

this
setPackSource
(DfsObjDatabase.PackSource
the source of the pack.
source
)

Set the source of the pack.

pack-priv DfsPackDescription
pack-priv void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

blockSizeMapback to summary
private int[] blockSizeMap
commitGraphStatsback to summary
private CommitGraphWriter.Stats commitGraphStats
deltaCountback to summary
private long deltaCount
estimatedPackSizeback to summary
private long estimatedPackSize
extensionsback to summary
private int extensions
indexVersionback to summary
private int indexVersion
lastModifiedback to summary
private long lastModified
maxUpdateIndexback to summary
private long maxUpdateIndex
minUpdateIndexback to summary
private long minUpdateIndex
objectCountback to summary
private long objectCount
packNameback to summary
private final String packName
packSourceback to summary
private DfsObjDatabase.PackSource packSource
packStatsback to summary
private PackStatistics packStats
refStatsback to summary
private ReftableWriter.Stats refStats
repoDescback to summary
private final DfsRepositoryDescription repoDesc
sizeMapback to summary
private long[] sizeMap

Constructor Detail

DfsPackDescriptionback to summary
public DfsPackDescription(DfsRepositoryDescription repoDesc, String name, DfsObjDatabase.PackSource packSource)

Initialize a description by pack name and repository.

The corresponding index file is assumed to exist. If this is not true implementors must extend the class and override getFileName(PackExt).

Callers should also try to fill in other fields if they are reasonably free to access at the time this instance is being initialized.

Parameters
repoDesc:DfsRepositoryDescription

description of the repo containing the pack file.

name:String

name of the pack file. Must end with ".pack".

packSource:DfsObjDatabase.PackSource

the source of the pack.

Method Detail

addFileExtback to summary
public void addFileExt(PackExt ext)

Adds the pack file extension to the known list.

Parameters
ext:PackExt

the file extension

clearPackStatsback to summary
public DfsPackDescription clearPackStats()

Discard the pack statistics, if it was populated.

Returns:DfsPackDescription

this

equalsback to summary
public boolean equals(Object b)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
b:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getBlockSizeback to summary
public int getBlockSize(PackExt ext)

Get blockSize of the file, in bytes.

Parameters
ext:PackExt

the file extension.

Returns:int

blockSize of the file, in bytes. If 0 the blockSize size is not yet known and may be discovered when opening the file.

getCommitGraphStatsback to summary
public CommitGraphWriter.Stats getCommitGraphStats()

Get stats from the sibling commit graph, if created.

Returns:CommitGraphWriter.Stats

stats from the sibling commit graph, if created.

getDeltaCountback to summary
public long getDeltaCount()

Get number of delta compressed objects in the pack.

Returns:long

number of delta compressed objects in the pack.

getEstimatedPackSizeback to summary
public long getEstimatedPackSize()

Get estimated size of the .pack file in bytes.

Returns:long

estimated size of the .pack file in bytes. If 0 the pack file size is unknown.

getFileNameback to summary
public String getFileName(PackExt ext)

Get file name

Parameters
ext:PackExt

the file extension

Returns:String

name of the file.

getFileSizeback to summary
public long getFileSize(PackExt ext)

Get size of the file, in bytes.

Parameters
ext:PackExt

the file extension.

Returns:long

size of the file, in bytes. If 0 the file size is not yet known.

getIndexVersionback to summary
public int getIndexVersion()

Get the version of the index file written.

Returns:int

the version of the index file written.

getLastModifiedback to summary
public long getLastModified()

Get time the pack was created, in milliseconds.

Returns:long

time the pack was created, in milliseconds.

getMaxUpdateIndexback to summary
public long getMaxUpdateIndex()

Get maxUpdateIndex for the reftable, if present.

Returns:long

maxUpdateIndex for the reftable, if present.

getMinUpdateIndexback to summary
public long getMinUpdateIndex()

Get minUpdateIndex for the reftable, if present.

Returns:long

minUpdateIndex for the reftable, if present.

getObjectCountback to summary
public long getObjectCount()

Get number of objects in the pack.

Returns:long

number of objects in the pack.

getPackSourceback to summary
public DfsObjDatabase.PackSource getPackSource()

Get the source of the pack.

Returns:DfsObjDatabase.PackSource

the source of the pack.

Annotations
@NonNull
getPackStatsback to summary
public PackStatistics getPackStats()

Get statistics from PackWriter, if the pack was built with it.

Returns:PackStatistics

statistics from PackWriter, if the pack was built with it. Generally this is only available for packs created by DfsGarbageCollector or DfsPackCompactor, and only when the pack is being committed to the repository.

getReftableStatsback to summary
public ReftableWriter.Stats getReftableStats()

Get stats from the sibling reftable, if created.

Returns:ReftableWriter.Stats

stats from the sibling reftable, if created.

getRepositoryDescriptionback to summary
public DfsRepositoryDescription getRepositoryDescription()

Get description of the repository.

Returns:DfsRepositoryDescription

description of the repository.

getStreamKeyback to summary
public DfsStreamKey getStreamKey(PackExt ext)

Get cache key for use by the block cache.

Parameters
ext:PackExt

the file extension.

Returns:DfsStreamKey

cache key for use by the block cache.

hasFileExtback to summary
public boolean hasFileExt(PackExt ext)

Whether the pack file extension is known to exist.

Parameters
ext:PackExt

the file extension

Returns:boolean

whether the pack file extension is known to exist.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isGCback to summary
pack-priv static boolean isGC(DfsObjDatabase.PackSource s)
objectLookupComparatorback to summary
public static Comparator<DfsPackDescription> objectLookupComparator()

Comparator for packs when looking up objects in indexes.

This comparator tries to position packs in the order readers should examine them when looking for objects by SHA-1. The default tries to sort packs with more recent modification dates before older packs, and packs with fewer objects before packs with more objects.

Uses PackSource#DEFAULT_COMPARATOR for the portion of comparison where packs are sorted by source.

Returns:Comparator<DfsPackDescription>

comparator.

objectLookupComparatorback to summary
public static Comparator<DfsPackDescription> objectLookupComparator(Comparator<DfsObjDatabase.PackSource> packSourceComparator)

Comparator for packs when looking up objects in indexes.

This comparator tries to position packs in the order readers should examine them when looking for objects by SHA-1. The default tries to sort packs with more recent modification dates before older packs, and packs with fewer objects before packs with more objects.

Parameters
packSourceComparator:Comparator<DfsObjDatabase.PackSource>

comparator for the PackSource, used as the first step in comparison.

Returns:Comparator<DfsPackDescription>

comparator.

reftableComparatorback to summary
pack-priv static Comparator<DfsPackDescription> reftableComparator()
reuseComparatorback to summary
pack-priv static Comparator<DfsPackDescription> reuseComparator()
setBlockSizeback to summary
public DfsPackDescription setBlockSize(PackExt ext, int blockSize)

Set blockSize of the file, in bytes.

Parameters
ext:PackExt

the file extension.

blockSize:int

blockSize of the file, in bytes. If 0 the blockSize is not known and will be determined on first read.

Returns:DfsPackDescription

this

setCommitGraphStatsback to summary
pack-priv void setCommitGraphStats(CommitGraphWriter.Stats stats)
setDeltaCountback to summary
public DfsPackDescription setDeltaCount(long cnt)

Set number of delta compressed objects in the pack.

Parameters
cnt:long

number of delta compressed objects in the pack.

Returns:DfsPackDescription

this

setEstimatedPackSizeback to summary
public DfsPackDescription setEstimatedPackSize(long estimatedPackSize)

Set estimated size of the .pack file in bytes.

Parameters
estimatedPackSize:long

estimated size of the .pack file in bytes. If 0 the pack file size is unknown.

Returns:DfsPackDescription

this

setFileSizeback to summary
public DfsPackDescription setFileSize(PackExt ext, long bytes)

Set size of the file in bytes.

Parameters
ext:PackExt

the file extension.

bytes:long

size of the file in bytes. If 0 the file is not known and will be determined on first read.

Returns:DfsPackDescription

this

setIndexVersionback to summary
public DfsPackDescription setIndexVersion(int version)

Set the version of the index file written.

Parameters
version:int

the version of the index file written.

Returns:DfsPackDescription

this

setLastModifiedback to summary
public DfsPackDescription setLastModified(long timeMillis)

Set time the pack was created, in milliseconds.

Parameters
timeMillis:long

time the pack was created, in milliseconds. 0 if not known.

Returns:DfsPackDescription

this

setMaxUpdateIndexback to summary
public DfsPackDescription setMaxUpdateIndex(long max)

Set maxUpdateIndex for the reftable.

Parameters
max:long

maxUpdateIndex for the reftable.

Returns:DfsPackDescription

this

setMinUpdateIndexback to summary
public DfsPackDescription setMinUpdateIndex(long min)

Set minUpdateIndex for the reftable.

Parameters
min:long

minUpdateIndex for the reftable.

Returns:DfsPackDescription

this

setObjectCountback to summary
public DfsPackDescription setObjectCount(long cnt)

Set number of objects in the pack.

Parameters
cnt:long

number of objects in the pack.

Returns:DfsPackDescription

this

setPackSourceback to summary
public DfsPackDescription setPackSource(DfsObjDatabase.PackSource source)

Set the source of the pack.

Parameters
source:DfsObjDatabase.PackSource

the source of the pack.

Returns:DfsPackDescription

this

setPackStatsback to summary
pack-priv DfsPackDescription setPackStats(PackStatistics stats)
setReftableStatsback to summary
pack-priv void setReftableStats(ReftableWriter.Stats stats)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override