public class ReftableCompactor extends Object
 For a partial compaction callers should setIncludeDeletes(boolean)
 to true to ensure the new reftable continues to use a delete marker
 to shadow any lower reftable that may have the reference present.
 
 By default all log entries within the range defined by
 setMinUpdateIndex(long) and setMaxUpdateIndex(long) are
 copied, even if no references in the output file match the log records.
 Callers may truncate the log to a more recent time horizon with
 setOldestReflogTimeMillis(long), or disable the log altogether with
 setOldestReflogTimeMillis(Long.MAX_VALUE).
| Constructor and Description | 
|---|
ReftableCompactor()  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addAll(List<? extends Reftable> readers)
Add all of the tables, in the specified order. 
 | 
void | 
compact(OutputStream out)
Write a compaction to  
out. | 
ReftableWriter.Stats | 
getStats()
Get statistics of the last written reftable. 
 | 
ReftableCompactor | 
setCompactBytesLimit(long bytes)
Set limit on number of bytes from source tables to compact. 
 | 
ReftableCompactor | 
setConfig(ReftableConfig cfg)
Set configuration for the reftable. 
 | 
ReftableCompactor | 
setIncludeDeletes(boolean deletes)
Whether to include deletions in the output, which may be necessary for
 partial compaction. 
 | 
ReftableCompactor | 
setMaxUpdateIndex(long max)
Set the maximum update index for log entries that appear in the compacted
 reftable. 
 | 
ReftableCompactor | 
setMinUpdateIndex(long min)
Set the minimum update index for log entries that appear in the compacted
 reftable. 
 | 
ReftableCompactor | 
setOldestReflogTimeMillis(long timeMillis)
Set oldest reflog time to preserve. 
 | 
boolean | 
tryAddFirst(ReftableReader reader)
Try to add this reader at the bottom of the stack. 
 | 
public ReftableCompactor setConfig(ReftableConfig cfg)
cfg - configuration for the reftable.thispublic ReftableCompactor setCompactBytesLimit(long bytes)
bytes - limit on number of bytes from source tables to compact.thispublic ReftableCompactor setIncludeDeletes(boolean deletes)
deletes - true to include deletions in the output, which may be
            necessary for partial compaction.thispublic ReftableCompactor setMinUpdateIndex(long min)
min - the minimum update index for log entries that appear in the
            compacted reftable. This should be 1 higher than the prior
            reftable's maxUpdateIndex if this table will be used
            in a stack.thispublic ReftableCompactor setMaxUpdateIndex(long max)
max - the maximum update index for log entries that appear in the
            compacted reftable. This should be at least 1 higher than the
            prior reftable's maxUpdateIndex if this table will be
            used in a stack.thispublic ReftableCompactor setOldestReflogTimeMillis(long timeMillis)
timeMillis - oldest log time to preserve. Entries whose timestamps are
            >= timeMillis will be copied into the output file. Log
            entries that predate timeMillis will be discarded.
            Specified in Java standard milliseconds since the epoch.thispublic void addAll(List<? extends Reftable> readers) throws IOException
 Unconditionally adds all tables, ignoring the
 setCompactBytesLimit(long).
readers - tables to compact. Tables should be ordered oldest first/most
            recent last so that the more recent tables can shadow the
            older results. Caller is responsible for closing the readers.IOException - update indexes of a reader cannot be accessed.public boolean tryAddFirst(ReftableReader reader) throws IOException
 A reader may be rejected by returning false if the compactor is
 already rewriting its setCompactBytesLimit(long). When this
 happens the caller should stop trying to add tables, and execute the
 compaction.
reader - the reader to insert at the bottom of the stack. Caller is
            responsible for closing the reader.true if the compactor accepted this table; false
         if the compactor has reached its limit.IOException - if size of reader, or its update indexes cannot be read.public void compact(OutputStream out) throws IOException
out.out - stream to write the compacted tables to. Caller is responsible
            for closing out.IOException - if tables cannot be read, or cannot be written.public ReftableWriter.Stats getStats()
Copyright © 2018 Eclipse JGit Project. All rights reserved.