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
setReflogExpireMinUpdateIndex(long)
and setReflogExpireMaxUpdateIndex(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
setReflogExpireOldestReflogTimeMillis(long)
, or disable the log altogether with
setOldestReflogTimeMillis(Long.MAX_VALUE)
.
Constructor and Description |
---|
ReftableCompactor(OutputStream out)
Creates a new compactor.
|
Modifier and Type | Method and Description |
---|---|
void |
addAll(List<ReftableReader> readers)
Add all of the tables, in the specified order.
|
void |
compact()
Write a compaction to
out . |
ReftableWriter.Stats |
getStats()
Get statistics of the last written reftable.
|
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 |
setReflogExpireMaxUpdateIndex(long max)
Set the maximum update index for log entries that appear in the compacted
reftable.
|
ReftableCompactor |
setReflogExpireMinUpdateIndex(long min)
Set the minimum update index for log entries that appear in the compacted
reftable.
|
ReftableCompactor |
setReflogExpireOldestReflogTimeMillis(long timeMillis)
Set oldest reflog time to preserve.
|
public ReftableCompactor(OutputStream out)
out
- stream to write the compacted tables to. Caller is responsible
for closing out
.public ReftableCompactor setConfig(ReftableConfig cfg)
cfg
- configuration for the reftable.this
public ReftableCompactor setIncludeDeletes(boolean deletes)
deletes
- true
to include deletions in the output, which may be
necessary for partial compaction.this
public ReftableCompactor setReflogExpireMinUpdateIndex(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.this
public ReftableCompactor setReflogExpireMaxUpdateIndex(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.this
public ReftableCompactor setReflogExpireOldestReflogTimeMillis(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.this
public void addAll(List<ReftableReader> readers) throws IOException
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 void compact() throws IOException
out
.IOException
- if tables cannot be read, or cannot be written.public ReftableWriter.Stats getStats()
Copyright © 2021 Eclipse JGit Project. All rights reserved.