org.eclipse.jgit.storage.dfs
Class DfsGarbageCollector

java.lang.Object
  extended by org.eclipse.jgit.storage.dfs.DfsGarbageCollector

public class DfsGarbageCollector
extends Object

Repack and garbage collect a repository.


Constructor Summary
DfsGarbageCollector(DfsRepository repository)
          Initialize a garbage collector.
 
Method Summary
 List<DfsPackDescription> getNewPacks()
           
 List<PackWriter.Statistics> getNewPackStatistics()
           
 PackConfig getPackConfig()
           
 List<DfsPackDescription> getSourcePacks()
           
 boolean pack(ProgressMonitor pm)
          Create a single new pack file containing all of the live objects.
 DfsGarbageCollector setPackConfig(PackConfig newConfig)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DfsGarbageCollector

public DfsGarbageCollector(DfsRepository repository)
Initialize a garbage collector.

Parameters:
repository - repository objects to be packed will be read from.
Method Detail

getPackConfig

public PackConfig getPackConfig()
Returns:
configuration used to generate the new pack file.

setPackConfig

public DfsGarbageCollector setPackConfig(PackConfig newConfig)
Parameters:
newConfig - the new configuration to use when creating the pack file.
Returns:
this

pack

public boolean pack(ProgressMonitor pm)
             throws IOException
Create a single new pack file containing all of the live objects.

This method safely decides which packs can be expired after the new pack is created by validating the references have not been modified in an incompatible way.

Parameters:
pm - progress monitor to receive updates on as packing may take a while, depending on the size of the repository.
Returns:
true if the repack was successful without race conditions. False if a race condition was detected and the repack should be run again later.
Throws:
IOException - a new pack cannot be created.

getSourcePacks

public List<DfsPackDescription> getSourcePacks()
Returns:
all of the source packs that fed into this compaction.

getNewPacks

public List<DfsPackDescription> getNewPacks()
Returns:
new packs created by this compaction.

getNewPackStatistics

public List<PackWriter.Statistics> getNewPackStatistics()
Returns:
statistics corresponding to the getNewPacks().


Copyright © 2012. All Rights Reserved.