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)
Sort packs according to the optimal lookup ordering.
|
boolean |
equals(Object b) |
long |
getDeltaCount() |
String |
getFileName(PackExt ext) |
long |
getFileSize(PackExt ext) |
int |
getIndexVersion() |
long |
getLastModified() |
long |
getObjectCount() |
DfsObjDatabase.PackSource |
getPackSource() |
PackStatistics |
getPackStats() |
DfsRepositoryDescription |
getRepositoryDescription() |
boolean |
hasFileExt(PackExt ext) |
int |
hashCode() |
DfsPackDescription |
setDeltaCount(long cnt) |
DfsPackDescription |
setFileSize(PackExt ext,
long bytes) |
DfsPackDescription |
setIndexVersion(int version) |
DfsPackDescription |
setLastModified(long timeMillis) |
DfsPackDescription |
setObjectCount(long cnt) |
DfsPackDescription |
setPackSource(DfsObjDatabase.PackSource source) |
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 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 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 © 2015 Eclipse JGit Project. All rights reserved.