Fix javadoc in org.eclipse.jgit storage/reftable package
Change-Id: I14764c5d5b2309d82fe2ccc0593120b51328bf41 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
783dbf1b03
commit
43e26de7ec
|
@ -45,7 +45,10 @@
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/** Thrown if {@link ReftableWriter} cannot fit a reference. */
|
/**
|
||||||
|
* Thrown if {@link org.eclipse.jgit.internal.storage.reftable.ReftableWriter}
|
||||||
|
* cannot fit a reference.
|
||||||
|
*/
|
||||||
public class BlockSizeTooSmallException extends IOException {
|
public class BlockSizeTooSmallException extends IOException {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -55,7 +58,11 @@ public class BlockSizeTooSmallException extends IOException {
|
||||||
minBlockSize = b;
|
minBlockSize = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return minimum block size in bytes reftable requires to write a ref. */
|
/**
|
||||||
|
* Get minimum block size in bytes reftable requires to write a ref.
|
||||||
|
*
|
||||||
|
* @return minimum block size in bytes reftable requires to write a ref.
|
||||||
|
*/
|
||||||
public int getMinimumBlockSize() {
|
public int getMinimumBlockSize() {
|
||||||
return minBlockSize;
|
return minBlockSize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,26 +49,31 @@
|
||||||
|
|
||||||
/** Empty {@link LogCursor} with no results. */
|
/** Empty {@link LogCursor} with no results. */
|
||||||
class EmptyLogCursor extends LogCursor {
|
class EmptyLogCursor extends LogCursor {
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public boolean next() throws IOException {
|
public boolean next() throws IOException {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public String getRefName() {
|
public String getRefName() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public long getUpdateIndex() {
|
public long getUpdateIndex() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public ReflogEntry getReflogEntry() {
|
public ReflogEntry getReflogEntry() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
|
|
|
@ -47,26 +47,42 @@
|
||||||
|
|
||||||
import org.eclipse.jgit.lib.ReflogEntry;
|
import org.eclipse.jgit.lib.ReflogEntry;
|
||||||
|
|
||||||
/** Iterator over logs inside a {@link Reftable}. */
|
/**
|
||||||
|
* Iterator over logs inside a
|
||||||
|
* {@link org.eclipse.jgit.internal.storage.reftable.Reftable}.
|
||||||
|
*/
|
||||||
public abstract class LogCursor implements AutoCloseable {
|
public abstract class LogCursor implements AutoCloseable {
|
||||||
/**
|
/**
|
||||||
* Check if another log record is available.
|
* Check if another log record is available.
|
||||||
*
|
*
|
||||||
* @return {@code true} if there is another result.
|
* @return {@code true} if there is another result.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* logs cannot be read.
|
* logs cannot be read.
|
||||||
*/
|
*/
|
||||||
public abstract boolean next() throws IOException;
|
public abstract boolean next() throws IOException;
|
||||||
|
|
||||||
/** @return name of the current reference. */
|
/**
|
||||||
|
* Get name of the current reference.
|
||||||
|
*
|
||||||
|
* @return name of the current reference.
|
||||||
|
*/
|
||||||
public abstract String getRefName();
|
public abstract String getRefName();
|
||||||
|
|
||||||
/** @return identifier of the transaction that created the log record. */
|
/**
|
||||||
|
* Get identifier of the transaction that created the log record.
|
||||||
|
*
|
||||||
|
* @return identifier of the transaction that created the log record.
|
||||||
|
*/
|
||||||
public abstract long getUpdateIndex();
|
public abstract long getUpdateIndex();
|
||||||
|
|
||||||
/** @return current log entry. */
|
/**
|
||||||
|
* Get current log entry.
|
||||||
|
*
|
||||||
|
* @return current log entry.
|
||||||
|
*/
|
||||||
public abstract ReflogEntry getReflogEntry();
|
public abstract ReflogEntry getReflogEntry();
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public abstract void close();
|
public abstract void close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,10 @@
|
||||||
/**
|
/**
|
||||||
* Merges multiple reference tables together.
|
* Merges multiple reference tables together.
|
||||||
* <p>
|
* <p>
|
||||||
* A {@link MergedReftable} merge-joins multiple {@link ReftableReader} on the
|
* A {@link org.eclipse.jgit.internal.storage.reftable.MergedReftable}
|
||||||
* fly. Tables higher/later in the stack shadow lower/earlier tables, hiding
|
* merge-joins multiple
|
||||||
|
* {@link org.eclipse.jgit.internal.storage.reftable.ReftableReader} on the fly.
|
||||||
|
* Tables higher/later in the stack shadow lower/earlier tables, hiding
|
||||||
* references that been updated/replaced.
|
* references that been updated/replaced.
|
||||||
* <p>
|
* <p>
|
||||||
* By default deleted references are skipped and not returned to the caller.
|
* By default deleted references are skipped and not returned to the caller.
|
||||||
|
@ -89,6 +91,7 @@ public MergedReftable(List<Reftable> tableStack) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public RefCursor allRefs() throws IOException {
|
public RefCursor allRefs() throws IOException {
|
||||||
MergedRefCursor m = new MergedRefCursor();
|
MergedRefCursor m = new MergedRefCursor();
|
||||||
|
@ -98,6 +101,7 @@ public RefCursor allRefs() throws IOException {
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public RefCursor seekRef(String name) throws IOException {
|
public RefCursor seekRef(String name) throws IOException {
|
||||||
MergedRefCursor m = new MergedRefCursor();
|
MergedRefCursor m = new MergedRefCursor();
|
||||||
|
@ -107,6 +111,7 @@ public RefCursor seekRef(String name) throws IOException {
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public RefCursor byObjectId(AnyObjectId name) throws IOException {
|
public RefCursor byObjectId(AnyObjectId name) throws IOException {
|
||||||
MergedRefCursor m = new MergedRefCursor();
|
MergedRefCursor m = new MergedRefCursor();
|
||||||
|
@ -116,6 +121,7 @@ public RefCursor byObjectId(AnyObjectId name) throws IOException {
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public LogCursor allLogs() throws IOException {
|
public LogCursor allLogs() throws IOException {
|
||||||
MergedLogCursor m = new MergedLogCursor();
|
MergedLogCursor m = new MergedLogCursor();
|
||||||
|
@ -125,6 +131,7 @@ public LogCursor allLogs() throws IOException {
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public LogCursor seekLog(String refName, long updateIdx)
|
public LogCursor seekLog(String refName, long updateIdx)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
@ -135,6 +142,7 @@ public LogCursor seekLog(String refName, long updateIdx)
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
for (Reftable t : tables) {
|
for (Reftable t : tables) {
|
||||||
|
|
|
@ -47,29 +47,45 @@
|
||||||
|
|
||||||
import org.eclipse.jgit.lib.Ref;
|
import org.eclipse.jgit.lib.Ref;
|
||||||
|
|
||||||
/** Iterator over references inside a {@link Reftable}. */
|
/**
|
||||||
|
* Iterator over references inside a
|
||||||
|
* {@link org.eclipse.jgit.internal.storage.reftable.Reftable}.
|
||||||
|
*/
|
||||||
public abstract class RefCursor implements AutoCloseable {
|
public abstract class RefCursor implements AutoCloseable {
|
||||||
/**
|
/**
|
||||||
* Check if another reference is available.
|
* Check if another reference is available.
|
||||||
*
|
*
|
||||||
* @return {@code true} if there is another result.
|
* @return {@code true} if there is another result.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* references cannot be read.
|
* references cannot be read.
|
||||||
*/
|
*/
|
||||||
public abstract boolean next() throws IOException;
|
public abstract boolean next() throws IOException;
|
||||||
|
|
||||||
/** @return reference at the current position. */
|
/**
|
||||||
|
* Get reference at the current position.
|
||||||
|
*
|
||||||
|
* @return reference at the current position.
|
||||||
|
*/
|
||||||
public abstract Ref getRef();
|
public abstract Ref getRef();
|
||||||
|
|
||||||
/** @return updateIndex that last modified the current reference, */
|
/**
|
||||||
|
* Get updateIndex that last modified the current reference.
|
||||||
|
*
|
||||||
|
* @return updateIndex that last modified the current reference.
|
||||||
|
*/
|
||||||
public abstract long getUpdateIndex();
|
public abstract long getUpdateIndex();
|
||||||
|
|
||||||
/** @return {@code true} if the current reference was deleted. */
|
/**
|
||||||
|
* Whether the current reference was deleted.
|
||||||
|
*
|
||||||
|
* @return {@code true} if the current reference was deleted.
|
||||||
|
*/
|
||||||
public boolean wasDeleted() {
|
public boolean wasDeleted() {
|
||||||
Ref r = getRef();
|
Ref r = getRef();
|
||||||
return r.getStorage() == Ref.Storage.NEW && r.getObjectId() == null;
|
return r.getStorage() == Ref.Storage.NEW && r.getObjectId() == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public abstract void close();
|
public abstract void close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,9 +55,13 @@
|
||||||
import org.eclipse.jgit.lib.Ref;
|
import org.eclipse.jgit.lib.Ref;
|
||||||
import org.eclipse.jgit.lib.SymbolicRef;
|
import org.eclipse.jgit.lib.SymbolicRef;
|
||||||
|
|
||||||
/** Abstract table of references. */
|
/**
|
||||||
|
* Abstract table of references.
|
||||||
|
*/
|
||||||
public abstract class Reftable implements AutoCloseable {
|
public abstract class Reftable implements AutoCloseable {
|
||||||
/**
|
/**
|
||||||
|
* References to convert into a reftable
|
||||||
|
*
|
||||||
* @param refs
|
* @param refs
|
||||||
* references to convert into a reftable; may be empty.
|
* references to convert into a reftable; may be empty.
|
||||||
* @return a reader for the supplied references.
|
* @return a reader for the supplied references.
|
||||||
|
@ -83,6 +87,8 @@ public static Reftable from(Collection<Ref> refs) {
|
||||||
protected boolean includeDeletes;
|
protected boolean includeDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Whether deleted references will be returned.
|
||||||
|
*
|
||||||
* @param deletes
|
* @param deletes
|
||||||
* if {@code true} deleted references will be returned. If
|
* if {@code true} deleted references will be returned. If
|
||||||
* {@code false} (default behavior), deleted references will be
|
* {@code false} (default behavior), deleted references will be
|
||||||
|
@ -96,7 +102,7 @@ public void setIncludeDeletes(boolean deletes) {
|
||||||
* Seek to the first reference, to iterate in order.
|
* Seek to the first reference, to iterate in order.
|
||||||
*
|
*
|
||||||
* @return cursor to iterate.
|
* @return cursor to iterate.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if references cannot be read.
|
* if references cannot be read.
|
||||||
*/
|
*/
|
||||||
public abstract RefCursor allRefs() throws IOException;
|
public abstract RefCursor allRefs() throws IOException;
|
||||||
|
@ -115,7 +121,7 @@ public void setIncludeDeletes(boolean deletes) {
|
||||||
* @param refName
|
* @param refName
|
||||||
* reference name or subtree to find.
|
* reference name or subtree to find.
|
||||||
* @return cursor to iterate; empty cursor if no references match.
|
* @return cursor to iterate; empty cursor if no references match.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if references cannot be read.
|
* if references cannot be read.
|
||||||
*/
|
*/
|
||||||
public abstract RefCursor seekRef(String refName) throws IOException;
|
public abstract RefCursor seekRef(String refName) throws IOException;
|
||||||
|
@ -126,7 +132,7 @@ public void setIncludeDeletes(boolean deletes) {
|
||||||
* @param id
|
* @param id
|
||||||
* object to find.
|
* object to find.
|
||||||
* @return cursor to iterate; empty cursor if no references match.
|
* @return cursor to iterate; empty cursor if no references match.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if references cannot be read.
|
* if references cannot be read.
|
||||||
*/
|
*/
|
||||||
public abstract RefCursor byObjectId(AnyObjectId id) throws IOException;
|
public abstract RefCursor byObjectId(AnyObjectId id) throws IOException;
|
||||||
|
@ -135,7 +141,7 @@ public void setIncludeDeletes(boolean deletes) {
|
||||||
* Seek reader to read log records.
|
* Seek reader to read log records.
|
||||||
*
|
*
|
||||||
* @return cursor to iterate; empty cursor if no logs are present.
|
* @return cursor to iterate; empty cursor if no logs are present.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if logs cannot be read.
|
* if logs cannot be read.
|
||||||
*/
|
*/
|
||||||
public abstract LogCursor allLogs() throws IOException;
|
public abstract LogCursor allLogs() throws IOException;
|
||||||
|
@ -146,7 +152,7 @@ public void setIncludeDeletes(boolean deletes) {
|
||||||
* @param refName
|
* @param refName
|
||||||
* exact name of the reference whose log to read.
|
* exact name of the reference whose log to read.
|
||||||
* @return cursor to iterate; empty cursor if no logs match.
|
* @return cursor to iterate; empty cursor if no logs match.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if logs cannot be read.
|
* if logs cannot be read.
|
||||||
*/
|
*/
|
||||||
public LogCursor seekLog(String refName) throws IOException {
|
public LogCursor seekLog(String refName) throws IOException {
|
||||||
|
@ -162,7 +168,7 @@ public LogCursor seekLog(String refName) throws IOException {
|
||||||
* most recent index to return first in the log cursor. Log
|
* most recent index to return first in the log cursor. Log
|
||||||
* records at or before {@code updateIndex} will be returned.
|
* records at or before {@code updateIndex} will be returned.
|
||||||
* @return cursor to iterate; empty cursor if no logs match.
|
* @return cursor to iterate; empty cursor if no logs match.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if logs cannot be read.
|
* if logs cannot be read.
|
||||||
*/
|
*/
|
||||||
public abstract LogCursor seekLog(String refName, long updateIndex)
|
public abstract LogCursor seekLog(String refName, long updateIndex)
|
||||||
|
@ -174,7 +180,7 @@ public abstract LogCursor seekLog(String refName, long updateIndex)
|
||||||
* @param refName
|
* @param refName
|
||||||
* reference name to find.
|
* reference name to find.
|
||||||
* @return the reference, or {@code null} if not found.
|
* @return the reference, or {@code null} if not found.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if references cannot be read.
|
* if references cannot be read.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -196,7 +202,7 @@ public Ref exactRef(String refName) throws IOException {
|
||||||
* reference name or subtree to find.
|
* reference name or subtree to find.
|
||||||
* @return {@code true} if the reference exists, or at least one reference
|
* @return {@code true} if the reference exists, or at least one reference
|
||||||
* exists in the subtree.
|
* exists in the subtree.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if references cannot be read.
|
* if references cannot be read.
|
||||||
*/
|
*/
|
||||||
public boolean hasRef(String refName) throws IOException {
|
public boolean hasRef(String refName) throws IOException {
|
||||||
|
@ -212,7 +218,7 @@ public boolean hasRef(String refName) throws IOException {
|
||||||
* ObjectId to find.
|
* ObjectId to find.
|
||||||
* @return {@code true} if any reference exists directly referencing
|
* @return {@code true} if any reference exists directly referencing
|
||||||
* {@code id}, or a annotated tag that peels to {@code id}.
|
* {@code id}, or a annotated tag that peels to {@code id}.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if references cannot be read.
|
* if references cannot be read.
|
||||||
*/
|
*/
|
||||||
public boolean hasId(AnyObjectId id) throws IOException {
|
public boolean hasId(AnyObjectId id) throws IOException {
|
||||||
|
@ -227,7 +233,7 @@ public boolean hasId(AnyObjectId id) throws IOException {
|
||||||
* @param symref
|
* @param symref
|
||||||
* reference to resolve.
|
* reference to resolve.
|
||||||
* @return resolved {@code symref}, or {@code null}.
|
* @return resolved {@code symref}, or {@code null}.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if references cannot be read.
|
* if references cannot be read.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -257,6 +263,7 @@ private Ref resolve(Ref ref, int depth) throws IOException {
|
||||||
return new SymbolicRef(ref.getName(), dst);
|
return new SymbolicRef(ref.getName(), dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public abstract void close() throws IOException;
|
public abstract void close() throws IOException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,8 @@ public class ReftableCompactor {
|
||||||
private Stats stats;
|
private Stats stats;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set configuration for the reftable.
|
||||||
|
*
|
||||||
* @param cfg
|
* @param cfg
|
||||||
* configuration for the reftable.
|
* configuration for the reftable.
|
||||||
* @return {@code this}
|
* @return {@code this}
|
||||||
|
@ -90,6 +92,8 @@ public ReftableCompactor setConfig(ReftableConfig cfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set limit on number of bytes from source tables to compact.
|
||||||
|
*
|
||||||
* @param bytes
|
* @param bytes
|
||||||
* limit on number of bytes from source tables to compact.
|
* limit on number of bytes from source tables to compact.
|
||||||
* @return {@code this}
|
* @return {@code this}
|
||||||
|
@ -100,6 +104,9 @@ public ReftableCompactor setCompactBytesLimit(long bytes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Whether to include deletions in the output, which may be necessary for
|
||||||
|
* partial compaction.
|
||||||
|
*
|
||||||
* @param deletes
|
* @param deletes
|
||||||
* {@code true} to include deletions in the output, which may be
|
* {@code true} to include deletions in the output, which may be
|
||||||
* necessary for partial compaction.
|
* necessary for partial compaction.
|
||||||
|
@ -111,6 +118,9 @@ public ReftableCompactor setIncludeDeletes(boolean deletes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set the minimum update index for log entries that appear in the compacted
|
||||||
|
* reftable.
|
||||||
|
*
|
||||||
* @param min
|
* @param min
|
||||||
* the minimum update index for log entries that appear in the
|
* the minimum update index for log entries that appear in the
|
||||||
* compacted reftable. This should be 1 higher than the prior
|
* compacted reftable. This should be 1 higher than the prior
|
||||||
|
@ -124,6 +134,9 @@ public ReftableCompactor setMinUpdateIndex(long min) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set the maximum update index for log entries that appear in the compacted
|
||||||
|
* reftable.
|
||||||
|
*
|
||||||
* @param max
|
* @param max
|
||||||
* the maximum update index for log entries that appear in the
|
* the maximum update index for log entries that appear in the
|
||||||
* compacted reftable. This should be at least 1 higher than the
|
* compacted reftable. This should be at least 1 higher than the
|
||||||
|
@ -137,6 +150,8 @@ public ReftableCompactor setMaxUpdateIndex(long max) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set oldest reflog time to preserve.
|
||||||
|
*
|
||||||
* @param timeMillis
|
* @param timeMillis
|
||||||
* oldest log time to preserve. Entries whose timestamps are
|
* oldest log time to preserve. Entries whose timestamps are
|
||||||
* {@code >= timeMillis} will be copied into the output file. Log
|
* {@code >= timeMillis} will be copied into the output file. Log
|
||||||
|
@ -159,7 +174,7 @@ public ReftableCompactor setOldestReflogTimeMillis(long timeMillis) {
|
||||||
* tables to compact. Tables should be ordered oldest first/most
|
* tables to compact. Tables should be ordered oldest first/most
|
||||||
* recent last so that the more recent tables can shadow the
|
* recent last so that the more recent tables can shadow the
|
||||||
* older results. Caller is responsible for closing the readers.
|
* older results. Caller is responsible for closing the readers.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* update indexes of a reader cannot be accessed.
|
* update indexes of a reader cannot be accessed.
|
||||||
*/
|
*/
|
||||||
public void addAll(List<? extends Reftable> readers) throws IOException {
|
public void addAll(List<? extends Reftable> readers) throws IOException {
|
||||||
|
@ -184,7 +199,7 @@ public void addAll(List<? extends Reftable> readers) throws IOException {
|
||||||
* responsible for closing the reader.
|
* responsible for closing the reader.
|
||||||
* @return {@code true} if the compactor accepted this table; {@code false}
|
* @return {@code true} if the compactor accepted this table; {@code false}
|
||||||
* if the compactor has reached its limit.
|
* if the compactor has reached its limit.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if size of {@code reader}, or its update indexes cannot be read.
|
* if size of {@code reader}, or its update indexes cannot be read.
|
||||||
*/
|
*/
|
||||||
public boolean tryAddFirst(ReftableReader reader) throws IOException {
|
public boolean tryAddFirst(ReftableReader reader) throws IOException {
|
||||||
|
@ -213,7 +228,7 @@ private void adjustUpdateIndexes(ReftableReader reader) throws IOException {
|
||||||
* @param out
|
* @param out
|
||||||
* stream to write the compacted tables to. Caller is responsible
|
* stream to write the compacted tables to. Caller is responsible
|
||||||
* for closing {@code out}.
|
* for closing {@code out}.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if tables cannot be read, or cannot be written.
|
* if tables cannot be read, or cannot be written.
|
||||||
*/
|
*/
|
||||||
public void compact(OutputStream out) throws IOException {
|
public void compact(OutputStream out) throws IOException {
|
||||||
|
@ -229,7 +244,11 @@ public void compact(OutputStream out) throws IOException {
|
||||||
stats = writer.getStats();
|
stats = writer.getStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return statistics of the last written reftable. */
|
/**
|
||||||
|
* Get statistics of the last written reftable.
|
||||||
|
*
|
||||||
|
* @return statistics of the last written reftable.
|
||||||
|
*/
|
||||||
public Stats getStats() {
|
public Stats getStats() {
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,9 @@
|
||||||
import org.eclipse.jgit.lib.Config;
|
import org.eclipse.jgit.lib.Config;
|
||||||
import org.eclipse.jgit.lib.Repository;
|
import org.eclipse.jgit.lib.Repository;
|
||||||
|
|
||||||
/** Configuration used by a reftable writer when constructing the stream. */
|
/**
|
||||||
|
* Configuration used by a reftable writer when constructing the stream.
|
||||||
|
*/
|
||||||
public class ReftableConfig {
|
public class ReftableConfig {
|
||||||
private int refBlockSize = 4 << 10;
|
private int refBlockSize = 4 << 10;
|
||||||
private int logBlockSize;
|
private int logBlockSize;
|
||||||
|
@ -57,7 +59,9 @@ public class ReftableConfig {
|
||||||
private boolean alignBlocks = true;
|
private boolean alignBlocks = true;
|
||||||
private boolean indexObjects = true;
|
private boolean indexObjects = true;
|
||||||
|
|
||||||
/** Create a default configuration. */
|
/**
|
||||||
|
* Create a default configuration.
|
||||||
|
*/
|
||||||
public ReftableConfig() {
|
public ReftableConfig() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +78,8 @@ public ReftableConfig(Repository db) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a configuration honoring settings in a {@link Config}.
|
* Create a configuration honoring settings in a
|
||||||
|
* {@link org.eclipse.jgit.lib.Config}.
|
||||||
*
|
*
|
||||||
* @param cfg
|
* @param cfg
|
||||||
* the source to read settings from. The source is not retained
|
* the source to read settings from. The source is not retained
|
||||||
|
@ -100,12 +105,18 @@ public ReftableConfig(ReftableConfig cfg) {
|
||||||
this.indexObjects = cfg.indexObjects;
|
this.indexObjects = cfg.indexObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return desired output block size for references, in bytes */
|
/**
|
||||||
|
* Get desired output block size for references, in bytes.
|
||||||
|
*
|
||||||
|
* @return desired output block size for references, in bytes.
|
||||||
|
*/
|
||||||
public int getRefBlockSize() {
|
public int getRefBlockSize() {
|
||||||
return refBlockSize;
|
return refBlockSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set desired output block size for references, in bytes.
|
||||||
|
*
|
||||||
* @param szBytes
|
* @param szBytes
|
||||||
* desired output block size for references, in bytes.
|
* desired output block size for references, in bytes.
|
||||||
*/
|
*/
|
||||||
|
@ -117,6 +128,8 @@ public void setRefBlockSize(int szBytes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get desired output block size for log entries, in bytes.
|
||||||
|
*
|
||||||
* @return desired output block size for log entries, in bytes. If 0 the
|
* @return desired output block size for log entries, in bytes. If 0 the
|
||||||
* writer will default to {@code 2 * getRefBlockSize()}.
|
* writer will default to {@code 2 * getRefBlockSize()}.
|
||||||
*/
|
*/
|
||||||
|
@ -125,6 +138,8 @@ public int getLogBlockSize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set desired output block size for log entries, in bytes.
|
||||||
|
*
|
||||||
* @param szBytes
|
* @param szBytes
|
||||||
* desired output block size for log entries, in bytes. If 0 will
|
* desired output block size for log entries, in bytes. If 0 will
|
||||||
* default to {@code 2 * getRefBlockSize()}.
|
* default to {@code 2 * getRefBlockSize()}.
|
||||||
|
@ -136,12 +151,18 @@ public void setLogBlockSize(int szBytes) {
|
||||||
logBlockSize = Math.max(0, szBytes);
|
logBlockSize = Math.max(0, szBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return number of references between binary search markers. */
|
/**
|
||||||
|
* Get number of references between binary search markers.
|
||||||
|
*
|
||||||
|
* @return number of references between binary search markers.
|
||||||
|
*/
|
||||||
public int getRestartInterval() {
|
public int getRestartInterval() {
|
||||||
return restartInterval;
|
return restartInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* <p>Setter for the field <code>restartInterval</code>.</p>
|
||||||
|
*
|
||||||
* @param interval
|
* @param interval
|
||||||
* number of references between binary search markers. If
|
* number of references between binary search markers. If
|
||||||
* {@code interval} is 0 (default), the writer will select a
|
* {@code interval} is 0 (default), the writer will select a
|
||||||
|
@ -151,12 +172,18 @@ public void setRestartInterval(int interval) {
|
||||||
restartInterval = Math.max(0, interval);
|
restartInterval = Math.max(0, interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return maximum depth of the index; 0 for unlimited. */
|
/**
|
||||||
|
* Get maximum depth of the index; 0 for unlimited.
|
||||||
|
*
|
||||||
|
* @return maximum depth of the index; 0 for unlimited.
|
||||||
|
*/
|
||||||
public int getMaxIndexLevels() {
|
public int getMaxIndexLevels() {
|
||||||
return maxIndexLevels;
|
return maxIndexLevels;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set maximum number of levels to use in indexes.
|
||||||
|
*
|
||||||
* @param levels
|
* @param levels
|
||||||
* maximum number of levels to use in indexes. Lower levels of
|
* maximum number of levels to use in indexes. Lower levels of
|
||||||
* the index respect {@link #getRefBlockSize()}, and the highest
|
* the index respect {@link #getRefBlockSize()}, and the highest
|
||||||
|
@ -166,12 +193,19 @@ public void setMaxIndexLevels(int levels) {
|
||||||
maxIndexLevels = Math.max(0, levels);
|
maxIndexLevels = Math.max(0, levels);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@code true} if the writer should align blocks. */
|
/**
|
||||||
|
* Whether the writer should align blocks.
|
||||||
|
*
|
||||||
|
* @return {@code true} if the writer should align blocks.
|
||||||
|
*/
|
||||||
public boolean isAlignBlocks() {
|
public boolean isAlignBlocks() {
|
||||||
return alignBlocks;
|
return alignBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Whether blocks are written aligned to multiples of
|
||||||
|
* {@link #getRefBlockSize()}.
|
||||||
|
*
|
||||||
* @param align
|
* @param align
|
||||||
* if {@code true} blocks are written aligned to multiples of
|
* if {@code true} blocks are written aligned to multiples of
|
||||||
* {@link #getRefBlockSize()}. May increase file size due to NUL
|
* {@link #getRefBlockSize()}. May increase file size due to NUL
|
||||||
|
@ -181,12 +215,19 @@ public void setAlignBlocks(boolean align) {
|
||||||
alignBlocks = align;
|
alignBlocks = align;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@code true} if the writer should index object to ref. */
|
/**
|
||||||
|
* Whether the writer should index object to ref.
|
||||||
|
*
|
||||||
|
* @return {@code true} if the writer should index object to ref.
|
||||||
|
*/
|
||||||
public boolean isIndexObjects() {
|
public boolean isIndexObjects() {
|
||||||
return indexObjects;
|
return indexObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Whether the reftable may include additional storage to efficiently map
|
||||||
|
* from {@code ObjectId} to reference names.
|
||||||
|
*
|
||||||
* @param index
|
* @param index
|
||||||
* if {@code true} the reftable may include additional storage to
|
* if {@code true} the reftable may include additional storage to
|
||||||
* efficiently map from {@code ObjectId} to reference names. By
|
* efficiently map from {@code ObjectId} to reference names. By
|
||||||
|
|
|
@ -92,12 +92,14 @@ void setBlockSize(int bs) {
|
||||||
blockSize = bs;
|
blockSize = bs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void write(int b) {
|
public void write(int b) {
|
||||||
ensureBytesAvailableInBlockBuf(1);
|
ensureBytesAvailableInBlockBuf(1);
|
||||||
blockBuf[cur++] = (byte) b;
|
blockBuf[cur++] = (byte) b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void write(byte[] b, int off, int cnt) {
|
public void write(byte[] b, int off, int cnt) {
|
||||||
ensureBytesAvailableInBlockBuf(cnt);
|
ensureBytesAvailableInBlockBuf(cnt);
|
||||||
|
|
|
@ -112,10 +112,13 @@ public ReftableReader(BlockSource src) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get the block size in bytes chosen for this file by the writer.
|
||||||
|
*
|
||||||
* @return the block size in bytes chosen for this file by the writer. Most
|
* @return the block size in bytes chosen for this file by the writer. Most
|
||||||
* reads from the {@link BlockSource} will be aligned to the block
|
* reads from the
|
||||||
* size.
|
* {@link org.eclipse.jgit.internal.storage.io.BlockSource} will be
|
||||||
* @throws IOException
|
* aligned to the block size.
|
||||||
|
* @throws java.io.IOException
|
||||||
* file cannot be read.
|
* file cannot be read.
|
||||||
*/
|
*/
|
||||||
public int blockSize() throws IOException {
|
public int blockSize() throws IOException {
|
||||||
|
@ -126,10 +129,13 @@ public int blockSize() throws IOException {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get the minimum update index for log entries that appear in this
|
||||||
|
* reftable.
|
||||||
|
*
|
||||||
* @return the minimum update index for log entries that appear in this
|
* @return the minimum update index for log entries that appear in this
|
||||||
* reftable. This should be 1 higher than the prior reftable's
|
* reftable. This should be 1 higher than the prior reftable's
|
||||||
* {@code maxUpdateIndex} if this table is used in a stack.
|
* {@code maxUpdateIndex} if this table is used in a stack.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* file cannot be read.
|
* file cannot be read.
|
||||||
*/
|
*/
|
||||||
public long minUpdateIndex() throws IOException {
|
public long minUpdateIndex() throws IOException {
|
||||||
|
@ -140,10 +146,13 @@ public long minUpdateIndex() throws IOException {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get the maximum update index for log entries that appear in this
|
||||||
|
* reftable.
|
||||||
|
*
|
||||||
* @return the maximum update index for log entries that appear in this
|
* @return the maximum update index for log entries that appear in this
|
||||||
* reftable. This should be 1 higher than the prior reftable's
|
* reftable. This should be 1 higher than the prior reftable's
|
||||||
* {@code maxUpdateIndex} if this table is used in a stack.
|
* {@code maxUpdateIndex} if this table is used in a stack.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* file cannot be read.
|
* file cannot be read.
|
||||||
*/
|
*/
|
||||||
public long maxUpdateIndex() throws IOException {
|
public long maxUpdateIndex() throws IOException {
|
||||||
|
@ -153,6 +162,7 @@ public long maxUpdateIndex() throws IOException {
|
||||||
return maxUpdateIndex;
|
return maxUpdateIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public RefCursor allRefs() throws IOException {
|
public RefCursor allRefs() throws IOException {
|
||||||
if (blockSize == -1) {
|
if (blockSize == -1) {
|
||||||
|
@ -167,6 +177,7 @@ public RefCursor allRefs() throws IOException {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public RefCursor seekRef(String refName) throws IOException {
|
public RefCursor seekRef(String refName) throws IOException {
|
||||||
initRefIndex();
|
initRefIndex();
|
||||||
|
@ -179,6 +190,7 @@ public RefCursor seekRef(String refName) throws IOException {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public RefCursor byObjectId(AnyObjectId id) throws IOException {
|
public RefCursor byObjectId(AnyObjectId id) throws IOException {
|
||||||
initObjIndex();
|
initObjIndex();
|
||||||
|
@ -191,6 +203,7 @@ public RefCursor byObjectId(AnyObjectId id) throws IOException {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public LogCursor allLogs() throws IOException {
|
public LogCursor allLogs() throws IOException {
|
||||||
initLogIndex();
|
initLogIndex();
|
||||||
|
@ -203,6 +216,7 @@ public LogCursor allLogs() throws IOException {
|
||||||
return new EmptyLogCursor();
|
return new EmptyLogCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public LogCursor seekLog(String refName, long updateIndex)
|
public LogCursor seekLog(String refName, long updateIndex)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
@ -437,13 +451,14 @@ private int blocksIn(long pos, long end) {
|
||||||
* Get size of the reftable, in bytes.
|
* Get size of the reftable, in bytes.
|
||||||
*
|
*
|
||||||
* @return size of the reftable, in bytes.
|
* @return size of the reftable, in bytes.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* size cannot be obtained.
|
* size cannot be obtained.
|
||||||
*/
|
*/
|
||||||
public long size() throws IOException {
|
public long size() throws IOException {
|
||||||
return src.size();
|
return src.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
src.close();
|
src.close();
|
||||||
|
|
|
@ -89,7 +89,9 @@
|
||||||
* Writes a reftable formatted file.
|
* Writes a reftable formatted file.
|
||||||
* <p>
|
* <p>
|
||||||
* A reftable can be written in a streaming fashion, provided the caller sorts
|
* A reftable can be written in a streaming fashion, provided the caller sorts
|
||||||
* all references. A {@link ReftableWriter} is single-use, and not thread-safe.
|
* all references. A
|
||||||
|
* {@link org.eclipse.jgit.internal.storage.reftable.ReftableWriter} is
|
||||||
|
* single-use, and not thread-safe.
|
||||||
*/
|
*/
|
||||||
public class ReftableWriter {
|
public class ReftableWriter {
|
||||||
private ReftableConfig config;
|
private ReftableConfig config;
|
||||||
|
@ -113,7 +115,9 @@ public class ReftableWriter {
|
||||||
private int objIdLen;
|
private int objIdLen;
|
||||||
private Stats stats;
|
private Stats stats;
|
||||||
|
|
||||||
/** Initialize a writer with a default configuration. */
|
/**
|
||||||
|
* Initialize a writer with a default configuration.
|
||||||
|
*/
|
||||||
public ReftableWriter() {
|
public ReftableWriter() {
|
||||||
this(new ReftableConfig());
|
this(new ReftableConfig());
|
||||||
}
|
}
|
||||||
|
@ -129,6 +133,8 @@ public ReftableWriter(ReftableConfig cfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set configuration for the writer.
|
||||||
|
*
|
||||||
* @param cfg
|
* @param cfg
|
||||||
* configuration for the writer.
|
* configuration for the writer.
|
||||||
* @return {@code this}
|
* @return {@code this}
|
||||||
|
@ -139,6 +145,9 @@ public ReftableWriter setConfig(ReftableConfig cfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set the minimum update index for log entries that appear in this
|
||||||
|
* reftable.
|
||||||
|
*
|
||||||
* @param min
|
* @param min
|
||||||
* the minimum update index for log entries that appear in this
|
* the minimum update index for log entries that appear in this
|
||||||
* reftable. This should be 1 higher than the prior reftable's
|
* reftable. This should be 1 higher than the prior reftable's
|
||||||
|
@ -151,6 +160,9 @@ public ReftableWriter setMinUpdateIndex(long min) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set the maximum update index for log entries that appear in this
|
||||||
|
* reftable.
|
||||||
|
*
|
||||||
* @param max
|
* @param max
|
||||||
* the maximum update index for log entries that appear in this
|
* the maximum update index for log entries that appear in this
|
||||||
* reftable. This should be at least 1 higher than the prior
|
* reftable. This should be at least 1 higher than the prior
|
||||||
|
@ -170,7 +182,7 @@ public ReftableWriter setMaxUpdateIndex(long max) {
|
||||||
* stream to write the table to. Caller is responsible for
|
* stream to write the table to. Caller is responsible for
|
||||||
* closing the stream after invoking {@link #finish()}.
|
* closing the stream after invoking {@link #finish()}.
|
||||||
* @return {@code this}
|
* @return {@code this}
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if reftable header cannot be written.
|
* if reftable header cannot be written.
|
||||||
*/
|
*/
|
||||||
public ReftableWriter begin(OutputStream os) throws IOException {
|
public ReftableWriter begin(OutputStream os) throws IOException {
|
||||||
|
@ -208,7 +220,7 @@ public ReftableWriter begin(OutputStream os) throws IOException {
|
||||||
* @param refsToPack
|
* @param refsToPack
|
||||||
* references to sort and write.
|
* references to sort and write.
|
||||||
* @return {@code this}
|
* @return {@code this}
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if reftable cannot be written.
|
* if reftable cannot be written.
|
||||||
*/
|
*/
|
||||||
public ReftableWriter sortAndWriteRefs(Collection<Ref> refsToPack)
|
public ReftableWriter sortAndWriteRefs(Collection<Ref> refsToPack)
|
||||||
|
@ -232,7 +244,7 @@ public ReftableWriter sortAndWriteRefs(Collection<Ref> refsToPack)
|
||||||
*
|
*
|
||||||
* @param ref
|
* @param ref
|
||||||
* the reference to store.
|
* the reference to store.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if reftable cannot be written.
|
* if reftable cannot be written.
|
||||||
*/
|
*/
|
||||||
public void writeRef(Ref ref) throws IOException {
|
public void writeRef(Ref ref) throws IOException {
|
||||||
|
@ -249,7 +261,7 @@ public void writeRef(Ref ref) throws IOException {
|
||||||
* @param updateIndex
|
* @param updateIndex
|
||||||
* the updateIndex that modified this reference. Must be
|
* the updateIndex that modified this reference. Must be
|
||||||
* {@code >= minUpdateIndex} for this file.
|
* {@code >= minUpdateIndex} for this file.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if reftable cannot be written.
|
* if reftable cannot be written.
|
||||||
*/
|
*/
|
||||||
public void writeRef(Ref ref, long updateIndex) throws IOException {
|
public void writeRef(Ref ref, long updateIndex) throws IOException {
|
||||||
|
@ -295,12 +307,14 @@ private void indexId(ObjectId id, long blockPos) {
|
||||||
* @param who
|
* @param who
|
||||||
* committer of the reflog entry.
|
* committer of the reflog entry.
|
||||||
* @param oldId
|
* @param oldId
|
||||||
* prior id; pass {@link ObjectId#zeroId()} for creations.
|
* prior id; pass {@link org.eclipse.jgit.lib.ObjectId#zeroId()}
|
||||||
|
* for creations.
|
||||||
* @param newId
|
* @param newId
|
||||||
* new id; pass {@link ObjectId#zeroId()} for deletions.
|
* new id; pass {@link org.eclipse.jgit.lib.ObjectId#zeroId()}
|
||||||
|
* for deletions.
|
||||||
* @param message
|
* @param message
|
||||||
* optional message (may be null).
|
* optional message (may be null).
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if reftable cannot be written.
|
* if reftable cannot be written.
|
||||||
*/
|
*/
|
||||||
public void writeLog(String ref, long updateIndex, PersonIdent who,
|
public void writeLog(String ref, long updateIndex, PersonIdent who,
|
||||||
|
@ -327,7 +341,7 @@ public void writeLog(String ref, long updateIndex, PersonIdent who,
|
||||||
* the ref to delete (hide) a reflog entry from.
|
* the ref to delete (hide) a reflog entry from.
|
||||||
* @param updateIndex
|
* @param updateIndex
|
||||||
* the update index that must be hidden.
|
* the update index that must be hidden.
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if reftable cannot be written.
|
* if reftable cannot be written.
|
||||||
*/
|
*/
|
||||||
public void deleteLog(String ref, long updateIndex) throws IOException {
|
public void deleteLog(String ref, long updateIndex) throws IOException {
|
||||||
|
@ -345,10 +359,14 @@ private void beginLog() throws IOException {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get an estimate of the current size in bytes of the reftable
|
||||||
|
*
|
||||||
* @return an estimate of the current size in bytes of the reftable, if it
|
* @return an estimate of the current size in bytes of the reftable, if it
|
||||||
* was finished right now. Estimate is only accurate if
|
* was finished right now. Estimate is only accurate if
|
||||||
* {@link ReftableConfig#setIndexObjects(boolean)} is {@code false}
|
* {@link org.eclipse.jgit.internal.storage.reftable.ReftableConfig#setIndexObjects(boolean)}
|
||||||
* and {@link ReftableConfig#setMaxIndexLevels(int)} is {@code 1}.
|
* is {@code false} and
|
||||||
|
* {@link org.eclipse.jgit.internal.storage.reftable.ReftableConfig#setMaxIndexLevels(int)}
|
||||||
|
* is {@code 1}.
|
||||||
*/
|
*/
|
||||||
public long estimateTotalBytes() {
|
public long estimateTotalBytes() {
|
||||||
long bytes = out.size();
|
long bytes = out.size();
|
||||||
|
@ -381,7 +399,7 @@ public long estimateTotalBytes() {
|
||||||
* Finish writing the reftable by writing its trailer.
|
* Finish writing the reftable by writing its trailer.
|
||||||
*
|
*
|
||||||
* @return {@code this}
|
* @return {@code this}
|
||||||
* @throws IOException
|
* @throws java.io.IOException
|
||||||
* if reftable cannot be written.
|
* if reftable cannot be written.
|
||||||
*/
|
*/
|
||||||
public ReftableWriter finish() throws IOException {
|
public ReftableWriter finish() throws IOException {
|
||||||
|
@ -480,7 +498,11 @@ private static long indexPosition(@Nullable Section s) {
|
||||||
return s != null && s.idx != null ? s.idx.rootPosition : 0;
|
return s != null && s.idx != null ? s.idx.rootPosition : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return statistics of the last written reftable. */
|
/**
|
||||||
|
* Get statistics of the last written reftable.
|
||||||
|
*
|
||||||
|
* @return statistics of the last written reftable.
|
||||||
|
*/
|
||||||
public Stats getStats() {
|
public Stats getStats() {
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue