|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jgit.storage.file.GC
public class GC
A garbage collector for git FileRepository
. Instances of this class
are not thread-safe. Don't use the same instance from multiple threads.
This class started as a copy of DfsGarbageCollector from Shawn O. Pearce
adapted to FileRepositories.
Nested Class Summary | |
---|---|
class |
GC.RepoStatistics
A class holding statistical data for a FileRepository regarding how many objects are stored as loose or packed objects |
Constructor Summary | |
---|---|
GC(FileRepository repo)
Creates a new garbage collector with default values. |
Method Summary | |
---|---|
Collection<PackFile> |
gc()
Runs a garbage collector on a FileRepository . |
GC.RepoStatistics |
getStatistics()
Returns the number of objects stored in pack files. |
void |
packRefs()
Packs all non-symbolic, loose refs into packed-refs. |
void |
prune(Set<ObjectId> objectsToKeep)
Like "git prune" this method tries to prune all loose objects which are unreferenced. |
void |
prunePacked()
Like "git prune-packed" this method tries to prune all loose objects which can be found in packs. |
Collection<PackFile> |
repack()
Packs all objects which reachable from any of the heads into one pack file. |
void |
setExpire(Date expire)
During gc() or prune() each unreferenced, loose object which has been created or modified after or at expire will not be pruned. |
void |
setExpireAgeMillis(long expireAgeMillis)
During gc() or prune() each unreferenced, loose object which has been created or modified in the last expireAgeMillis milliseconds
will not be pruned. |
GC |
setProgressMonitor(ProgressMonitor pm)
Set the progress monitor used for garbage collection methods. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GC(FileRepository repo)
null
as progress monitor will be used.
repo
- the repo to work onMethod Detail |
---|
public Collection<PackFile> gc() throws IOException, ParseException
FileRepository
. It will
PackFile
's which are newly created
IOException
ParseException
- If the configuration parameter "gc.pruneexpire" couldn't be
parsedpublic void prunePacked() throws IOException
IOException
public void prune(Set<ObjectId> objectsToKeep) throws IOException, ParseException
objectsToKeep
- a set of objects which should explicitly not be pruned
IOException
ParseException
- If the configuration parameter "gc.pruneexpire" couldn't be
parsedpublic void packRefs() throws IOException
IOException
public Collection<PackFile> repack() throws IOException
IOException
- when during reading of refs, index, packfiles, objects,
reflog-entries or during writing to the packfiles
IOException
occurspublic GC.RepoStatistics getStatistics() throws IOException
IOException
public GC setProgressMonitor(ProgressMonitor pm)
pm
-
public void setExpireAgeMillis(long expireAgeMillis)
expireAgeMillis
milliseconds
will not be pruned. Only older objects may be pruned. If set to 0 then
every object is a candidate for pruning.
expireAgeMillis
- minimal age of objects to be pruned in milliseconds.public void setExpire(Date expire)
expire
will not be pruned.
Only older objects may be pruned. If set to null then every object is a
candidate for pruning.
expire
- instant in time which defines object expiration
objects with modification time before this instant are expired
objects with modification time newer or equal to this instant
are not expired
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |