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.
-
Constructor Summary
ConstructorsConstructorDescriptionDfsPackDescription(DfsRepositoryDescription repoDesc, String name, DfsObjDatabase.PackSource packSource) Initialize a description by pack name and repository. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFileExt(PackExt ext) Adds the pack file extension to the known list.Discard the pack statistics, if it was populated.booleanintgetBlockSize(PackExt ext) Get blockSize of the file, in bytes.Get stats from the sibling commit graph, if created.Packs "included" in this pack (e.g because this is a multi-pack index)longGet number of delta compressed objects in the pack.longGet estimated size of the .pack file in bytes.getFileName(PackExt ext) Get file namelonggetFileSize(PackExt ext) Get size of the file, in bytes.intGet the version of the index file written.longGet time the pack was created, in milliseconds.longGet maxUpdateIndex for the reftable, if present.longGet minUpdateIndex for the reftable, if present.The base if this multipack indexlongGet number of objects in the pack.The basic pack name (no extension) for this packGet the source of the pack.Get statistics from PackWriter, if the pack was built with it.Get stats from the sibling reftable, if created.Get description of the repository.getStreamKey(PackExt ext) Get cache key for use by the block cache.longGet total size of the pack, including indexesbooleanhasFileExt(PackExt ext) Whether the pack file extension is known to exist.inthashCode()static Comparator<DfsPackDescription>Comparator for packs when looking up objects in indexes.static Comparator<DfsPackDescription>objectLookupComparator(Comparator<DfsObjDatabase.PackSource> packSourceComparator) Comparator for packs when looking up objects in indexes.setBlockSize(PackExt ext, int blockSize) Set blockSize of the file, in bytes.voidsetCoveredPacks(List<? extends DfsPackDescription> coveredPacks) Set the list of packs required by this one (usually for multi-pack index)setDeltaCount(long cnt) Set number of delta compressed objects in the pack.setEstimatedPackSize(long estimatedPackSize) Set estimated size of the .pack file in bytes.setFileSize(PackExt ext, long bytes) Set size of the file in bytes.setIndexVersion(int version) Set the version of the index file written.setLastModified(long timeMillis) Set time the pack was created, in milliseconds.setMaxUpdateIndex(long max) Set maxUpdateIndex for the reftable.setMinUpdateIndex(long min) Set minUpdateIndex for the reftable.voidSet the base of this multipack indexsetObjectCount(long cnt) Set number of objects in the pack.Set the source of the pack.toString()
-
Constructor Details
-
DfsPackDescription
public DfsPackDescription(DfsRepositoryDescription repoDesc, String name, @NonNull 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:
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.
-
-
Method Details
-
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
DfsObjDatabase.PackSource.DEFAULT_COMPARATORfor the portion of comparison where packs are sorted by source.- Returns:
- comparator.
-
objectLookupComparator
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 for theDfsObjDatabase.PackSource, used as the first step in comparison.- Returns:
- comparator.
-
getRepositoryDescription
Get description of the repository.- Returns:
- description of the repository.
-
addFileExt
Adds the pack file extension to the known list.- Parameters:
ext- the file extension
-
hasFileExt
Whether the pack file extension is known to exist.- Parameters:
ext- the file extension- Returns:
- whether the pack file extension is known to exist.
-
getPackName
The basic pack name (no extension) for this pack- Returns:
- pack name
-
getFileName
Get file name- Parameters:
ext- the file extension- Returns:
- name of the file.
-
getStreamKey
Get cache key for use by the block cache.- Parameters:
ext- the file extension.- Returns:
- cache key for use by the block cache.
-
getPackSource
Get the source of the pack.- Returns:
- the source of the pack.
-
setPackSource
Set the source of the pack.- Parameters:
source- the source of the pack.- Returns:
this
-
getLastModified
public long getLastModified()Get time the pack was created, in milliseconds.- Returns:
- time the pack was created, in milliseconds.
-
setLastModified
Set time the pack was created, in milliseconds.- Parameters:
timeMillis- time the pack was created, in milliseconds. 0 if not known.- Returns:
this
-
getMinUpdateIndex
public long getMinUpdateIndex()Get minUpdateIndex for the reftable, if present.- Returns:
- minUpdateIndex for the reftable, if present.
-
setMinUpdateIndex
Set minUpdateIndex for the reftable.- Parameters:
min- minUpdateIndex for the reftable.- Returns:
this
-
getMaxUpdateIndex
public long getMaxUpdateIndex()Get maxUpdateIndex for the reftable, if present.- Returns:
- maxUpdateIndex for the reftable, if present.
-
setMaxUpdateIndex
Set maxUpdateIndex for the reftable.- Parameters:
max- maxUpdateIndex for the reftable.- Returns:
this
-
setFileSize
Set size of the file in bytes.- Parameters:
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.- Returns:
this
-
getFileSize
Get size of the file, in bytes.- Parameters:
ext- the file extension.- Returns:
- size of the file, in bytes. If 0 the file size is not yet known.
-
getTotalFileSize
public long getTotalFileSize()Get total size of the pack, including indexes- Returns:
- the size of the pack and all its extensions
-
getBlockSize
Get blockSize of the file, in bytes.- Parameters:
ext- the file extension.- Returns:
- blockSize of the file, in bytes. If 0 the blockSize size is not yet known and may be discovered when opening the file.
-
setBlockSize
Set blockSize of the file, in bytes.- Parameters:
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.- Returns:
this
-
setEstimatedPackSize
Set estimated size of the .pack file in bytes.- Parameters:
estimatedPackSize- estimated size of the .pack file in bytes. If 0 the pack file size is unknown.- Returns:
this
-
getEstimatedPackSize
public long getEstimatedPackSize()Get estimated size of the .pack file in bytes.- Returns:
- estimated size of the .pack file in bytes. If 0 the pack file size is unknown.
-
getObjectCount
public long getObjectCount()Get number of objects in the pack.- Returns:
- number of objects in the pack.
-
setObjectCount
Set number of objects in the pack.- Parameters:
cnt- number of objects in the pack.- Returns:
this
-
getDeltaCount
public long getDeltaCount()Get number of delta compressed objects in the pack.- Returns:
- number of delta compressed objects in the pack.
-
setDeltaCount
Set number of delta compressed objects in the pack.- Parameters:
cnt- number of delta compressed objects in the pack.- Returns:
this
-
getPackStats
Get statistics from PackWriter, if the pack was built with it.- 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.
-
getReftableStats
Get stats from the sibling reftable, if created.- Returns:
- stats from the sibling reftable, if created.
-
getCommitGraphStats
Get stats from the sibling commit graph, if created.- Returns:
- stats from the sibling commit graph, if created.
-
clearPackStats
Discard the pack statistics, if it was populated.- Returns:
this
-
getIndexVersion
public int getIndexVersion()Get the version of the index file written.- Returns:
- the version of the index file written.
-
setIndexVersion
Set the version of the index file written.- Parameters:
version- the version of the index file written.- Returns:
this
-
getCoveredPacks
Packs "included" in this pack (e.g because this is a multi-pack index)- Returns:
- descriptions of the packs which are included in this one. Empty list if none. Never null.
-
setCoveredPacks
Set the list of packs required by this one (usually for multi-pack index)- Parameters:
coveredPacks- list of pack names without extension
-
getMultiPackIndexBase
The base if this multipack index- Returns:
- the base of this multipack index
-
setMultiPackIndexBase
Set the base of this multipack index- Parameters:
desc- pack with the multipack index preceding this one
-
hashCode
public int hashCode() -
equals
-
toString
-