public class ReftableWriter extends Object
 A reftable can be written in a streaming fashion, provided the caller sorts
 all references. A
 ReftableWriter is
 single-use, and not thread-safe.
| Modifier and Type | Class and Description | 
|---|---|
static class  | 
ReftableWriter.Stats
Statistics about a written reftable. 
 | 
| Constructor and Description | 
|---|
ReftableWriter()
Initialize a writer with a default configuration. 
 | 
ReftableWriter(ReftableConfig cfg)
Initialize a writer with a specific configuration. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
ReftableWriter | 
begin(OutputStream os)
Begin writing the reftable. 
 | 
void | 
deleteLog(String ref,
         long updateIndex)
Record deletion of one reflog entry in this reftable. 
 | 
long | 
estimateTotalBytes()
Get an estimate of the current size in bytes of the reftable 
 | 
ReftableWriter | 
finish()
Finish writing the reftable by writing its trailer. 
 | 
ReftableWriter.Stats | 
getStats()
Get statistics of the last written reftable. 
 | 
ReftableWriter | 
setConfig(ReftableConfig cfg)
Set configuration for the writer. 
 | 
ReftableWriter | 
setMaxUpdateIndex(long max)
Set the maximum update index for log entries that appear in this
 reftable. 
 | 
ReftableWriter | 
setMinUpdateIndex(long min)
Set the minimum update index for log entries that appear in this
 reftable. 
 | 
ReftableWriter | 
sortAndWriteRefs(Collection<Ref> refsToPack)
Sort a collection of references and write them to the reftable. 
 | 
void | 
writeLog(String ref,
        long updateIndex,
        PersonIdent who,
        ObjectId oldId,
        ObjectId newId,
        String message)
Write one reflog entry to the reftable. 
 | 
void | 
writeRef(Ref ref)
Write one reference to the reftable. 
 | 
void | 
writeRef(Ref ref,
        long updateIndex)
Write one reference to the reftable. 
 | 
public ReftableWriter()
public ReftableWriter(ReftableConfig cfg)
cfg - configuration for the writer.public ReftableWriter setConfig(ReftableConfig cfg)
cfg - configuration for the writer.thispublic ReftableWriter setMinUpdateIndex(long min)
min - the minimum update index for log entries that appear in this
            reftable. This should be 1 higher than the prior reftable's
            maxUpdateIndex if this table will be used in a stack.thispublic ReftableWriter setMaxUpdateIndex(long max)
max - the maximum update index for log entries that appear in this
            reftable. This should be at least 1 higher than the prior
            reftable's maxUpdateIndex if this table will be used
            in a stack.thispublic ReftableWriter begin(OutputStream os) throws IOException
os - stream to write the table to. Caller is responsible for
            closing the stream after invoking finish().thisIOException - if reftable header cannot be written.public ReftableWriter sortAndWriteRefs(Collection<Ref> refsToPack) throws IOException
refsToPack - references to sort and write.thisIOException - if reftable cannot be written.public void writeRef(Ref ref) throws IOException
References must be passed in sorted order.
ref - the reference to store.IOException - if reftable cannot be written.public void writeRef(Ref ref, long updateIndex) throws IOException
References must be passed in sorted order.
ref - the reference to store.updateIndex - the updateIndex that modified this reference. Must be
            >= minUpdateIndex for this file.IOException - if reftable cannot be written.public void writeLog(String ref, long updateIndex, PersonIdent who, ObjectId oldId, ObjectId newId, @Nullable String message) throws IOException
 Reflog entries must be written in reference name and descending
 updateIndex (highest first) order.
ref - name of the reference.updateIndex - identifier of the transaction that created the log record. The
            updateIndex must be unique within the scope of
            ref, and must be within the bounds defined by
            minUpdateIndex <= updateIndex <= maxUpdateIndex.who - committer of the reflog entry.oldId - prior id; pass ObjectId.zeroId()
            for creations.newId - new id; pass ObjectId.zeroId()
            for deletions.message - optional message (may be null).IOException - if reftable cannot be written.public void deleteLog(String ref, long updateIndex) throws IOException
 The deletion can shadow an entry stored in a lower table in the stack.
 This is useful for refs/stash and dropping an entry from its
 reflog.
 
 Deletion must be properly interleaved in sorted updateIndex order with
 any other logs written by
 writeLog(String, long, PersonIdent, ObjectId, ObjectId, String).
ref - the ref to delete (hide) a reflog entry from.updateIndex - the update index that must be hidden.IOException - if reftable cannot be written.public long estimateTotalBytes()
ReftableConfig.setIndexObjects(boolean)
         is false and
         ReftableConfig.setMaxIndexLevels(int)
         is 1.public ReftableWriter finish() throws IOException
thisIOException - if reftable cannot be written.public ReftableWriter.Stats getStats()
Copyright © 2018 Eclipse JGit Project. All rights reserved.