org.eclipse.jgit.storage.dfs
Class DfsPackDescription

java.lang.Object
  extended by org.eclipse.jgit.storage.dfs.DfsPackDescription
All Implemented Interfaces:
Comparable<DfsPackDescription>

public class DfsPackDescription
extends Object
implements Comparable<DfsPackDescription>

Description of a DFS stored pack/index file.

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
DfsPackDescription(DfsRepositoryDescription repoDesc, String name)
          Initialize a description by pack name and repository.
 
Method Summary
 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 getIndexName()
           
 long getIndexSize()
           
 long getLastModified()
           
 long getObjectCount()
           
 String getPackName()
           
 long getPackSize()
           
 PackWriter.Statistics getPackStats()
           
 DfsRepositoryDescription getRepositoryDescription()
           
 int getReverseIndexSize()
           
 Set<ObjectId> getTips()
           
 int hashCode()
           
 DfsPackDescription setDeltaCount(long cnt)
           
 DfsPackDescription setIndexSize(long bytes)
           
 DfsPackDescription setLastModified(long timeMillis)
           
 DfsPackDescription setObjectCount(long cnt)
           
 DfsPackDescription setPackSize(long bytes)
           
 DfsPackDescription setTips(Set<ObjectId> tips)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DfsPackDescription

public DfsPackDescription(DfsRepositoryDescription repoDesc,
                          String name)
Initialize a description by pack name and repository.

The corresponding index file is assumed to exist and end with ".idx" instead of ".pack". If this is not true implementors must extend the class and override getIndexName().

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.
Method Detail

getRepositoryDescription

public DfsRepositoryDescription getRepositoryDescription()
Returns:
description of the repository.

getPackName

public String getPackName()
Returns:
name of the pack file.

getIndexName

public String getIndexName()
Returns:
name of the index file.

getLastModified

public long getLastModified()
Returns:
time the pack was created, in milliseconds.

setLastModified

public DfsPackDescription setLastModified(long timeMillis)
Parameters:
timeMillis - time the pack was created, in milliseconds. 0 if not known.
Returns:
this

getPackSize

public long getPackSize()
Returns:
size of the pack, in bytes. If 0 the pack size is not yet known.

setPackSize

public DfsPackDescription setPackSize(long bytes)
Parameters:
bytes - size of the pack in bytes. If 0 the size is not known and will be determined on first read.
Returns:
this

getIndexSize

public long getIndexSize()
Returns:
size of the index, in bytes. If 0 the index size is not yet known.

setIndexSize

public DfsPackDescription setIndexSize(long bytes)
Parameters:
bytes - size of the index in bytes. If 0 the size is not known and will be determined on first read.
Returns:
this

getReverseIndexSize

public int getReverseIndexSize()
Returns:
size of the reverse index, in bytes.

getObjectCount

public long getObjectCount()
Returns:
number of objects in the pack.

setObjectCount

public DfsPackDescription setObjectCount(long cnt)
Parameters:
cnt - number of objects in the pack.
Returns:
this

getDeltaCount

public long getDeltaCount()
Returns:
number of delta compressed objects in the pack.

setDeltaCount

public DfsPackDescription setDeltaCount(long cnt)
Parameters:
cnt - number of delta compressed objects in the pack.
Returns:
this

getTips

public Set<ObjectId> getTips()
Returns:
the tips that created this pack, if known.

setTips

public DfsPackDescription setTips(Set<ObjectId> tips)
Parameters:
tips - the tips of the pack, null if it has no known tips.
Returns:
this

getPackStats

public PackWriter.Statistics getPackStats()
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.

clearPackStats

public DfsPackDescription clearPackStats()
Discard the pack statistics, if it was populated.

Returns:
this

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object b)
Overrides:
equals in class Object

compareTo

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.

Specified by:
compareTo in interface Comparable<DfsPackDescription>
Parameters:
b - the other pack.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.