public class DfsPackDescription extends Object implements 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.
Constructor and Description |
---|
DfsPackDescription(DfsRepositoryDescription repoDesc,
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(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.
|
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() |
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.
|
String |
toString() |
public DfsPackDescription(DfsRepositoryDescription repoDesc, 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 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.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()
public ReftableWriter.Stats getReftableStats()
public DfsPackDescription clearPackStats()
this
public int getIndexVersion()
public DfsPackDescription setIndexVersion(int version)
version
- the version of the index file written.this
public 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 Comparable<DfsPackDescription>
Copyright © 2018 Eclipse JGit Project. All rights reserved.