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.
|
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 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 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 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 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)
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>
b
- the other pack.Copyright © 2018 Eclipse JGit Project. All rights reserved.