A reftable can be written in a streaming fashion, provided the caller sorts
all references. A
org. is
single-use, and not thread-safe.
| Modifier and Type | Class and Description |
|---|---|
| private class | |
| private static class | |
| private class | |
| public static class | ReftableWriter.
Statistics about a written reftable. |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private ReftableConfig | |
| private BlockWriter | |
| private boolean | |
| private BlockWriter. | |
| private BlockWriter. | |
| private int | |
| private ReftableWriter. | |
| private int | |
| private long | |
| private long | |
| private ObjectIdSubclassMap | |
| private int | |
| private ReftableWriter. | |
| private ReftableOutputStream | |
| private OutputStream | |
| private int | |
| private ReftableWriter. | |
| private int | |
| private ReftableWriter. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ReftableWriter(ReftableConfig
configuration for the writer cfg, OutputStream output stream. os)Initialize a writer with a configuration. |
| Modifier and Type | Method and Description |
|---|---|
| public ReftableWriter | |
| private void | |
| public void | |
| private void | |
| public long | Returns: an estimate of the current size in bytes of the reftable, if it was finished right now. Estimate is only accurate iforg.
is false and
org.
is 1.Get an estimate of the current size in bytes of the reftable |
| public ReftableWriter | |
| private void | |
| private void | |
| private static long | |
| public ReftableWriter. | Returns: statistics of the last written reftable.Get statistics of the last written reftable. |
| private void | |
| private static long | |
| private void | |
| public ReftableWriter | Returns: thisconfiguration for the writer. cfg)Set configuration for the writer. |
| public ReftableWriter | Returns: thisthe maximum update index for log entries that appear in this
reftable. This should be at least 1 higher than the prior
reftable's max)maxUpdateIndex if this table will be used
in a stack.Set the maximum update index for log entries that appear in this reftable. |
| public ReftableWriter | Returns: thisthe minimum update index for log entries that appear in this
reftable. This should be 1 higher than the prior reftable's
min)maxUpdateIndex if this table will be used in a stack.Set the minimum update index for log entries that appear in this reftable. |
| private static int | |
| private boolean | |
| public ReftableWriter | Returns: thisreferences to sort and write. refsToPack)Sort a collection of references and write them to the reftable. |
| private static List | |
| private void | |
| private void | |
| private void | |
| public void | writeLog(String
name of the reference. ref, long identifier of the transaction that created the log record. The
updateIndex, PersonIdent updateIndex must be unique within the scope of
ref, and must be within the bounds defined by
minUpdateIndex <= updateIndex <= maxUpdateIndex.committer of the reflog entry. who, ObjectId prior id; pass oldId, ObjectId org.
for creations.new id; pass newId, String org.
for deletions.optional message (may be null). message)Write one reflog entry to the reftable. |
| private void | |
| public void | |
| public void |
| alignBlocks | back to summary |
|---|---|
| private boolean alignBlocks | |
| config | back to summary |
|---|---|
| private ReftableConfig config | |
| cur | back to summary |
|---|---|
| private BlockWriter cur | |
| indexObjects | back to summary |
|---|---|
| private boolean indexObjects | |
| lastLog | back to summary |
|---|---|
| private BlockWriter. | |
| lastRef | back to summary |
|---|---|
| private BlockWriter. | |
| logBlockSize | back to summary |
|---|---|
| private int logBlockSize | |
| logs | back to summary |
|---|---|
| private ReftableWriter. | |
| maxIndexLevels | back to summary |
|---|---|
| private int maxIndexLevels | |
| maxUpdateIndex | back to summary |
|---|---|
| private long maxUpdateIndex | |
| minUpdateIndex | back to summary |
|---|---|
| private long minUpdateIndex | |
| obj2ref | back to summary |
|---|---|
| private ObjectIdSubclassMap<ReftableWriter. | |
| objIdLen | back to summary |
|---|---|
| private int objIdLen | |
| objs | back to summary |
|---|---|
| private ReftableWriter. | |
| out | back to summary |
|---|---|
| private ReftableOutputStream out | |
| outputStream | back to summary |
|---|---|
| private OutputStream outputStream | |
| refBlockSize | back to summary |
|---|---|
| private int refBlockSize | |
| refs | back to summary |
|---|---|
| private ReftableWriter. | |
| restartInterval | back to summary |
|---|---|
| private int restartInterval | |
| stats | back to summary |
|---|---|
| private ReftableWriter. | |
| ReftableWriter | back to summary |
|---|---|
| public ReftableWriter(OutputStream os) Initialize a writer with a default configuration.
| |
| ReftableWriter | back to summary |
|---|---|
| public ReftableWriter(ReftableConfig cfg, OutputStream os) Initialize a writer with a configuration.
| |
| begin | back to summary |
|---|---|
| public ReftableWriter begin() Begin writing the reftable. Should be called only once. Call this if a stream was passed to the constructor.
| |
| beginLog | back to summary |
|---|---|
| private void beginLog() throws IOException | |
| deleteLog | back to summary |
|---|---|
| public void deleteLog(String ref, long updateIndex) throws IOException Record deletion of one reflog entry in this reftable.
The deletion can shadow an entry stored in a lower table in the stack.
This is useful for
Deletion must be properly interleaved in sorted updateIndex order with
any other logs written by
| |
| encodeHeader | back to summary |
|---|---|
| private void encodeHeader(byte[] hdr) | |
| estimateTotalBytes | back to summary |
|---|---|
| public long estimateTotalBytes() Get an estimate of the current size in bytes of the reftable
| |
| finish | back to summary |
|---|---|
| public ReftableWriter finish() throws IOException Finish writing the reftable by writing its trailer.
| |
| finishLogSection | back to summary |
|---|---|
| private void finishLogSection() throws IOException | |
| finishRefAndObjSections | back to summary |
|---|---|
| private void finishRefAndObjSections() throws IOException | |
| firstBlockPosition | back to summary |
|---|---|
| private static long firstBlockPosition(ReftableWriter. | |
| getStats | back to summary |
|---|---|
| public ReftableWriter. Get statistics of the last written reftable.
| |
| indexId | back to summary |
|---|---|
| private void indexId(ObjectId id, long blockPos) | |
| indexPosition | back to summary |
|---|---|
| private static long indexPosition(ReftableWriter. | |
| indexRef | back to summary |
|---|---|
| private void indexRef(Ref ref, long blockPos) | |
| setConfig | back to summary |
|---|---|
| public ReftableWriter setConfig(ReftableConfig cfg) Set configuration for the writer.
| |
| setMaxUpdateIndex | back to summary |
|---|---|
| public ReftableWriter setMaxUpdateIndex(long max) Set the maximum update index for log entries that appear in this reftable.
| |
| setMinUpdateIndex | back to summary |
|---|---|
| public ReftableWriter setMinUpdateIndex(long min) Set the minimum update index for log entries that appear in this reftable.
| |
| shortestUniqueAbbreviation | back to summary |
|---|---|
| private static int shortestUniqueAbbreviation(List<ReftableWriter. | |
| shouldHaveIndex | back to summary |
|---|---|
| private boolean shouldHaveIndex(ReftableWriter. | |
| sortAndWriteRefs | back to summary |
|---|---|
| public ReftableWriter sortAndWriteRefs(Collection<Ref> refsToPack) throws IOException Sort a collection of references and write them to the reftable. The input refs may not have duplicate names.
| |
| sortById | back to summary |
|---|---|
| private static List | |
| throwIllegalEntry | back to summary |
|---|---|
| private void throwIllegalEntry(BlockWriter. | |
| writeFileFooter | back to summary |
|---|---|
| private void writeFileFooter() | |
| writeFileHeader | back to summary |
|---|---|
| private void writeFileHeader() | |
| writeLog | back to summary |
|---|---|
| public void writeLog(String ref, long updateIndex, PersonIdent who, ObjectId oldId, ObjectId newId, String message) throws IOException Write one reflog entry to the reftable.
Reflog entries must be written in reference name and descending
| |
| writeObjBlocks | back to summary |
|---|---|
| private void writeObjBlocks() throws IOException | |
| writeRef | back to summary |
|---|---|
| public void writeRef(Ref ref) throws IOException Write one reference to the reftable. References must be passed in sorted order.
| |
| writeRef | back to summary |
|---|---|
| public void writeRef(Ref ref, long updateIndex) throws IOException Write one reference to the reftable. References must be passed in sorted order.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv int | |
| pack-priv List | |
| pack-priv final byte | |
| pack-priv int | |
| pack-priv long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv int | |
| pack-priv void | |
| private void | |
| private List |
| bytes | back to summary |
|---|---|
| pack-priv int bytes | |
| entries | back to summary |
|---|---|
| pack-priv List<BlockWriter. | |
| keyType | back to summary |
|---|---|
| pack-priv final byte keyType | |
| levels | back to summary |
|---|---|
| pack-priv int levels | |
| rootPosition | back to summary |
|---|---|
| pack-priv long rootPosition | |
| IndexBuilder | back to summary |
|---|---|
| pack-priv IndexBuilder(byte kt) | |
| estimateBytes | back to summary |
|---|---|
| pack-priv int estimateBytes(long curBlockPos) | |
| writeIndex | back to summary |
|---|---|
| pack-priv void writeIndex() throws IOException | |
| writeMultiLevelIndex | back to summary |
|---|---|
| private void writeMultiLevelIndex(List<BlockWriter. | |
| writeOneLevel | back to summary |
|---|---|
| private List | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void |
| blockPos | back to summary |
|---|---|
| pack-priv final LongList blockPos | |
| RefList | back to summary |
|---|---|
| pack-priv RefList(AnyObjectId id) | |
| addBlock | back to summary |
|---|---|
| pack-priv void addBlock(long pos) | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv long | |
| pack-priv long | |
| pack-priv final long | |
| pack-priv final ReftableWriter. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv long |
| bytes | back to summary |
|---|---|
| pack-priv long bytes | |
| entryCnt | back to summary |
|---|---|
| pack-priv long entryCnt | |
| firstBlockPosition | back to summary |
|---|---|
| pack-priv final long firstBlockPosition | |
| idx | back to summary |
|---|---|
| pack-priv final ReftableWriter. | |
| Section | back to summary |
|---|---|
| pack-priv Section(byte keyType) | |
| beginBlock | back to summary |
|---|---|
| private void beginBlock(BlockWriter. | |
| finishSectionMaybeWriteIndex | back to summary |
|---|---|
| pack-priv void finishSectionMaybeWriteIndex() throws IOException | |
| flushCurBlock | back to summary |
|---|---|
| pack-priv void flushCurBlock() throws IOException | |
| write | back to summary |
|---|---|
| pack-priv long write(BlockWriter. | |
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private final long | |
| private final long | |
| private final long | |
| private final long | |
| private final long | |
| private final long | |
| private final int | |
| private final int | |
| private final int | |
| private final long | |
| private final int | |
| private final long | |
| private final long | |
| private final int | |
| private final int | |
| private final int | |
| private final long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public long | |
| public long | |
| public long | |
| public long | |
| public long | Returns: number of bytes for objects, including object index.Get number of bytes for objects |
| public long | |
| public int | Returns: number of bytes required to uniquely identify all objects in the reftable. Unique abbreviations in hex would be2 * objIdLength().Get number of bytes required to uniquely identify all objects in the reftable |
| public int | |
| public int | |
| public long | Returns: bytes of padding used to maintain block alignment.Get number of padding bytes |
| public int | |
| public long | Returns: number of bytes for references, including ref index.Get number of bytes for references |
| public long | |
| public int | |
| public int | Returns: number of bytes in the ref index; 0 if no index was used.Get size of ref index |
| public int | |
| public long |
| logBlockSize | back to summary |
|---|---|
| private final int logBlockSize | |
| logBytes | back to summary |
|---|---|
| private final long logBytes | |
| logCnt | back to summary |
|---|---|
| private final long logCnt | |
| maxUpdateIndex | back to summary |
|---|---|
| private final long maxUpdateIndex | |
| minUpdateIndex | back to summary |
|---|---|
| private final long minUpdateIndex | |
| objBytes | back to summary |
|---|---|
| private final long objBytes | |
| objCnt | back to summary |
|---|---|
| private final long objCnt | |
| objIdLen | back to summary |
|---|---|
| private final int objIdLen | |
| objIndexLevels | back to summary |
|---|---|
| private final int objIndexLevels | |
| objIndexSize | back to summary |
|---|---|
| private final int objIndexSize | |
| paddingUsed | back to summary |
|---|---|
| private final long paddingUsed | |
| refBlockSize | back to summary |
|---|---|
| private final int refBlockSize | |
| refBytes | back to summary |
|---|---|
| private final long refBytes | |
| refCnt | back to summary |
|---|---|
| private final long refCnt | |
| refIndexLevels | back to summary |
|---|---|
| private final int refIndexLevels | |
| refIndexSize | back to summary |
|---|---|
| private final int refIndexSize | |
| restartInterval | back to summary |
|---|---|
| private final int restartInterval | |
| totalBytes | back to summary |
|---|---|
| private final long totalBytes | |
| Stats | back to summary |
|---|---|
| pack-priv Stats(ReftableWriter w, ReftableOutputStream o) | |
| logBlockSize | back to summary |
|---|---|
| public int logBlockSize() Get log block size
| |
| logBytes | back to summary |
|---|---|
| public long logBytes() Get number of bytes for log
| |
| logCount | back to summary |
|---|---|
| public long logCount() Get number of log records
| |
| maxUpdateIndex | back to summary |
|---|---|
| public long maxUpdateIndex() Get largest updated index
| |
| minUpdateIndex | back to summary |
|---|---|
| public long minUpdateIndex() Get smallest update index
| |
| objBytes | back to summary |
|---|---|
| public long objBytes() Get number of bytes for objects
| |
| objCount | back to summary |
|---|---|
| public long objCount() Get number of unique objects
| |
| objIdLength | back to summary |
|---|---|
| public int objIdLength() Get number of bytes required to uniquely identify all objects in the reftable
| |
| objIndexLevels | back to summary |
|---|---|
| public int objIndexLevels() Get number of levels in object index
| |
| objIndexSize | back to summary |
|---|---|
| public int objIndexSize() Get size of object index
| |
| paddingBytes | back to summary |
|---|---|
| public long paddingBytes() Get number of padding bytes
| |
| refBlockSize | back to summary |
|---|---|
| public int refBlockSize() Get ref block size
| |
| refBytes | back to summary |
|---|---|
| public long refBytes() Get number of bytes for references
| |
| refCount | back to summary |
|---|---|
| public long refCount() Get number of refs
| |
| refIndexLevels | back to summary |
|---|---|
| public int refIndexLevels() Get number of ref index levels
| |
| refIndexSize | back to summary |
|---|---|
| public int refIndexSize() Get size of ref index
| |
| restartInterval | back to summary |
|---|---|
| public int restartInterval() Get restart interval
| |
| totalBytes | back to summary |
|---|---|
| public long totalBytes() Get total number of bytes
| |