public class DfsPackDescription extends java.lang.Object implements java.lang.Comparable<DfsPackDescription>
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.
| Modifier and Type | Field and Description |
|---|---|
private int[] |
blockSizeMap |
private long |
deltaCount |
private long |
estimatedPackSize |
private int |
extensions |
private int |
indexVersion |
private long |
lastModified |
private long |
maxUpdateIndex |
private long |
minUpdateIndex |
private long |
objectCount |
private java.lang.String |
packName |
private DfsObjDatabase.PackSource |
packSource |
private PackStatistics |
packStats |
private ReftableWriter.Stats |
refStats |
private DfsRepositoryDescription |
repoDesc |
private long[] |
sizeMap |
| Constructor and Description |
|---|
DfsPackDescription(DfsRepositoryDescription repoDesc,
java.lang.String name)
Initialize a description by pack name and repository.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFileExt(PackExt ext)
Adds the pack file extension to the known list.
|
DfsPackDescription |
clearPackStats()
Discard the pack statistics, if it was populated.
|
int |
compareTo(DfsPackDescription b) |
boolean |
equals(java.lang.Object b) |
int |
getBlockSize(PackExt ext)
Get blockSize of the file, in bytes.
|
long |
getDeltaCount()
Get number of delta compressed objects in the pack.
|
long |
getEstimatedPackSize()
Get estimated size of the .pack file in bytes.
|
java.lang.String |
getFileName(PackExt ext)
Get file name
|
long |
getFileSize(PackExt ext)
Get size of the file, in bytes.
|
int |
getIndexVersion()
Get the version of the index file written.
|
long |
getLastModified()
Get time the pack was created, in milliseconds.
|
long |
getMaxUpdateIndex()
Get maxUpdateIndex for the reftable, if present.
|
long |
getMinUpdateIndex()
Get minUpdateIndex for the reftable, if present.
|
long |
getObjectCount()
Get number of objects in the pack.
|
DfsObjDatabase.PackSource |
getPackSource()
Get the source of the pack.
|
PackStatistics |
getPackStats()
Get statistics from PackWriter, if the pack was built with it.
|
ReftableWriter.Stats |
getReftableStats()
Get stats from the sibling reftable, if created.
|
DfsRepositoryDescription |
getRepositoryDescription()
Get description of the repository.
|
DfsStreamKey |
getStreamKey(PackExt ext)
Get cache key for use by the block cache.
|
boolean |
hasFileExt(PackExt ext)
Whether the pack file extension is known to exist.
|
int |
hashCode() |
(package private) static boolean |
isGC(DfsObjDatabase.PackSource s) |
DfsPackDescription |
setBlockSize(PackExt ext,
int blockSize)
Set blockSize of the file, in bytes.
|
DfsPackDescription |
setDeltaCount(long cnt)
Set number of delta compressed objects in the pack.
|
DfsPackDescription |
setEstimatedPackSize(long estimatedPackSize)
Set estimated size of the .pack file in bytes.
|
DfsPackDescription |
setFileSize(PackExt ext,
long bytes)
Set size of the file in bytes.
|
DfsPackDescription |
setIndexVersion(int version)
Set the version of the index file written.
|
DfsPackDescription |
setLastModified(long timeMillis)
Set time the pack was created, in milliseconds.
|
DfsPackDescription |
setMaxUpdateIndex(long max)
Set maxUpdateIndex for the reftable.
|
DfsPackDescription |
setMinUpdateIndex(long min)
Set minUpdateIndex for the reftable.
|
DfsPackDescription |
setObjectCount(long cnt)
Set number of objects in the pack.
|
DfsPackDescription |
setPackSource(DfsObjDatabase.PackSource source)
Set the source of the pack.
|
(package private) DfsPackDescription |
setPackStats(PackStatistics stats) |
(package private) void |
setReftableStats(ReftableWriter.Stats stats) |
java.lang.String |
toString() |
private final DfsRepositoryDescription repoDesc
private final java.lang.String packName
private DfsObjDatabase.PackSource packSource
private long lastModified
private long[] sizeMap
private int[] blockSizeMap
private long objectCount
private long deltaCount
private long minUpdateIndex
private long maxUpdateIndex
private PackStatistics packStats
private ReftableWriter.Stats refStats
private int extensions
private int indexVersion
private long estimatedPackSize
public DfsPackDescription(DfsRepositoryDescription repoDesc, java.lang.String name)
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.
name - name of the pack file. Must end with ".pack".repoDesc - description of the repo containing the pack file.public DfsRepositoryDescription getRepositoryDescription()
public void addFileExt(PackExt ext)
ext - the file extensionpublic boolean hasFileExt(PackExt ext)
ext - the file extensionpublic java.lang.String getFileName(PackExt ext)
ext - the file extensionpublic DfsStreamKey getStreamKey(PackExt ext)
ext - the file extension.public DfsObjDatabase.PackSource getPackSource()
public DfsPackDescription setPackSource(DfsObjDatabase.PackSource source)
source - the source of the pack.thispublic long getLastModified()
public DfsPackDescription setLastModified(long timeMillis)
timeMillis - time the pack was created, in milliseconds. 0 if not known.thispublic long getMinUpdateIndex()
public DfsPackDescription setMinUpdateIndex(long min)
min - minUpdateIndex for the reftable.thispublic long getMaxUpdateIndex()
public DfsPackDescription setMaxUpdateIndex(long max)
max - maxUpdateIndex for the reftable.thispublic DfsPackDescription setFileSize(PackExt ext, long bytes)
ext - the file extension.bytes - size of the file in bytes. If 0 the file is not known and will
be determined on first read.thispublic long getFileSize(PackExt ext)
ext - the file extension.public int getBlockSize(PackExt ext)
ext - the file extension.public DfsPackDescription setBlockSize(PackExt ext, int blockSize)
ext - the file extension.blockSize - blockSize of the file, in bytes. If 0 the blockSize is not
known and will be determined on first read.thispublic DfsPackDescription setEstimatedPackSize(long estimatedPackSize)
estimatedPackSize - estimated size of the .pack file in bytes. If 0 the pack file
size is unknown.thispublic long getEstimatedPackSize()
public long getObjectCount()
public DfsPackDescription setObjectCount(long cnt)
cnt - number of objects in the pack.thispublic long getDeltaCount()
public DfsPackDescription setDeltaCount(long cnt)
cnt - number of delta compressed objects in the pack.thispublic PackStatistics getPackStats()
DfsPackDescription setPackStats(PackStatistics stats)
public ReftableWriter.Stats getReftableStats()
void setReftableStats(ReftableWriter.Stats stats)
public DfsPackDescription clearPackStats()
thispublic int getIndexVersion()
public DfsPackDescription setIndexVersion(int version)
version - the version of the index file written.thispublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object b)
equals in class java.lang.Objectpublic int compareTo(DfsPackDescription b)
Sort packs according to the optimal lookup ordering.
This method 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.
compareTo in interface java.lang.Comparable<DfsPackDescription>static boolean isGC(DfsObjDatabase.PackSource s)
public java.lang.String toString()
toString in class java.lang.Object