Class DfsPackDescription
- Direct Known Subclasses:
InMemoryRepository.MemPack
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
FieldsModifier and TypeFieldDescriptionprivate int[]
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
ConstructorsConstructorDescriptionDfsPackDescription
(DfsRepositoryDescription repoDesc, String name, DfsObjDatabase.PackSource packSource) Initialize a description by pack name and repository. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFileExt
(PackExt ext) Adds the pack file extension to the known list.Discard the pack statistics, if it was populated.boolean
int
getBlockSize
(PackExt ext) Get blockSize of the file, in bytes.long
Get number of delta compressed objects in the pack.long
Get estimated size of the .pack file in bytes.getFileName
(PackExt ext) Get file namelong
getFileSize
(PackExt ext) Get size of the file, in bytes.int
Get the version of the index file written.long
Get time the pack was created, in milliseconds.long
Get maxUpdateIndex for the reftable, if present.long
Get minUpdateIndex for the reftable, if present.long
Get number of objects in the pack.Get 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.boolean
hasFileExt
(PackExt ext) Whether the pack file extension is known to exist.int
hashCode()
(package private) static boolean
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.(package private) static Comparator<DfsPackDescription>
(package private) static Comparator<DfsPackDescription>
setBlockSize
(PackExt ext, int blockSize) Set blockSize of the file, in bytes.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.setObjectCount
(long cnt) Set number of objects in the pack.Set the source of the pack.(package private) DfsPackDescription
setPackStats
(PackStatistics stats) (package private) void
toString()
-
Field Details
-
repoDesc
-
packName
-
packSource
-
lastModified
private long lastModified -
sizeMap
private long[] sizeMap -
blockSizeMap
private int[] blockSizeMap -
objectCount
private long objectCount -
deltaCount
private long deltaCount -
minUpdateIndex
private long minUpdateIndex -
maxUpdateIndex
private long maxUpdateIndex -
packStats
-
refStats
-
extensions
private int extensions -
indexVersion
private int indexVersion -
estimatedPackSize
private long estimatedPackSize
-
-
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_COMPARATOR
for 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.
-
reftableComparator
-
reuseComparator
-
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.
-
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.
-
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.
-
setPackStats
-
getReftableStats
Get stats from the sibling reftable, if created.- Returns:
- stats from the sibling reftable, if created.
-
setReftableStats
-
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
-
hashCode
public int hashCode() -
equals
-
isGC
-
toString
-