public class DfsGarbageCollector extends Object
Constructor and Description |
---|
DfsGarbageCollector(DfsRepository repository)
Initialize a garbage collector.
|
public DfsGarbageCollector(DfsRepository repository)
repository
- repository objects to be packed will be read from.public PackConfig getPackConfig()
public DfsGarbageCollector setPackConfig(PackConfig newConfig)
newConfig
- the new configuration to use when creating the pack file.this
public DfsGarbageCollector setReftableConfig(ReftableConfig cfg)
cfg
- configuration to write a reftable. Reftable writing is
disabled (default) when cfg
is null
.this
public DfsGarbageCollector setConvertToReftable(boolean convert)
convert
- if true, setReftableConfig(ReftableConfig)
has been
set non-null, and a GC reftable doesn't yet exist, the garbage
collector will make one by scanning the existing references,
and writing a new reftable. Default is true
.this
public DfsGarbageCollector setReftableInitialMinUpdateIndex(long u)
u
- minUpdateIndex for the initial reftable created by scanning
DfsRefDatabase.getRefs(String)
. Ignored unless caller
has also set setReftableConfig(ReftableConfig)
.
Defaults to 1
. Must be u >= 0
.this
public DfsGarbageCollector setReftableInitialMaxUpdateIndex(long u)
u
- maxUpdateIndex for the initial reftable created by scanning
DfsRefDatabase.getRefs(String)
. Ignored unless caller
has also set setReftableConfig(ReftableConfig)
.
Defaults to 1
. Must be u >= 0
.this
public long getCoalesceGarbageLimit()
public DfsGarbageCollector setCoalesceGarbageLimit(long limit)
Any UNREACHABLE_GARBAGE pack smaller than this limit will be repacked at the end of the run. This allows the garbage collector to coalesce unreachable objects into a single file.
If an UNREACHABLE_GARBAGE pack is already larger than this limit it will be left alone by the garbage collector. This avoids unnecessary disk IO reading and copying the objects.
If limit is set to 0 the UNREACHABLE_GARBAGE coalesce is disabled.
If limit is set to Long.MAX_VALUE
, everything is coalesced.
Keeping unreachable garbage prevents race conditions with repository changes that may suddenly need an object whose only copy was stored in the UNREACHABLE_GARBAGE pack.
limit
- size in bytes.this
public long getGarbageTtlMillis()
public DfsGarbageCollector setGarbageTtl(long ttl, TimeUnit unit)
Any UNREACHABLE_GARBAGE older than this limit will be pruned at the end of the run.
If timeToLiveMillis is set to 0, UNREACHABLE_GARBAGE purging is disabled.
ttl
- Time to live whatever unit is specified.unit
- The specified time unit.this
public boolean pack(ProgressMonitor pm) throws IOException
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.
pm
- progress monitor to receive updates on as packing may take a
while, depending on the size of the repository.IOException
- a new pack cannot be created.public Set<DfsPackDescription> getSourcePacks()
public List<DfsPackDescription> getNewPacks()
public List<PackStatistics> getNewPackStatistics()
getNewPacks()
.Copyright © 2017 Eclipse JGit Project. All rights reserved.