public class DfsPackDescription
extends java.lang.Object
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,
DfsObjDatabase.PackSource packSource)
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.
|
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) |
static java.util.Comparator<DfsPackDescription> |
objectLookupComparator()
Comparator for packs when looking up objects in indexes.
|
static java.util.Comparator<DfsPackDescription> |
objectLookupComparator(java.util.Comparator<DfsObjDatabase.PackSource> packSourceComparator)
Comparator for packs when looking up objects in indexes.
|
(package private) static java.util.Comparator<DfsPackDescription> |
reftableComparator() |
(package private) static java.util.Comparator<DfsPackDescription> |
reuseComparator() |
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, @NonNull DfsObjDatabase.PackSource packSource)
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.packSource
- the source of the pack.public static java.util.Comparator<DfsPackDescription> objectLookupComparator()
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 DfsObjDatabase.PackSource.DEFAULT_COMPARATOR
for the portion of comparison
where packs are sorted by source.
public static java.util.Comparator<DfsPackDescription> objectLookupComparator(java.util.Comparator<DfsObjDatabase.PackSource> packSourceComparator)
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.
packSourceComparator
- comparator for the DfsObjDatabase.PackSource
, used as the first step in
comparison.static java.util.Comparator<DfsPackDescription> reftableComparator()
static java.util.Comparator<DfsPackDescription> reuseComparator()
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.@NonNull public DfsObjDatabase.PackSource getPackSource()
public DfsPackDescription setPackSource(@NonNull DfsObjDatabase.PackSource source)
source
- the source of the pack.this
public long getLastModified()
public DfsPackDescription setLastModified(long timeMillis)
timeMillis
- time the pack was created, in milliseconds. 0 if not known.this
public long getMinUpdateIndex()
public DfsPackDescription setMinUpdateIndex(long min)
min
- minUpdateIndex for the reftable.this
public long getMaxUpdateIndex()
public DfsPackDescription setMaxUpdateIndex(long max)
max
- maxUpdateIndex for the reftable.this
public 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.this
public 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.this
public DfsPackDescription setEstimatedPackSize(long estimatedPackSize)
estimatedPackSize
- estimated size of the .pack file in bytes. If 0 the pack file
size is unknown.this
public long getEstimatedPackSize()
public long getObjectCount()
public DfsPackDescription setObjectCount(long cnt)
cnt
- number of objects in the pack.this
public long getDeltaCount()
public DfsPackDescription setDeltaCount(long cnt)
cnt
- number of delta compressed objects in the pack.this
public PackStatistics getPackStats()
DfsPackDescription setPackStats(PackStatistics stats)
public ReftableWriter.Stats getReftableStats()
void setReftableStats(ReftableWriter.Stats stats)
public DfsPackDescription clearPackStats()
this
public int getIndexVersion()
public DfsPackDescription setIndexVersion(int version)
version
- the version of the index file written.this
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object b)
equals
in class java.lang.Object
static boolean isGC(DfsObjDatabase.PackSource s)
public java.lang.String toString()
toString
in class java.lang.Object