this.hash = ObjectId.zeroId();
}
+ /** {@inheritDoc} */
@Override
protected boolean notifyUponTransientChanges() {
// we will notify listeners upon save()
return false;
}
- /** @return location of the configuration file on disk */
+ /**
+ * Get location of the configuration file on disk
+ *
+ * @return location of the configuration file on disk
+ */
public final File getFile() {
return configFile;
}
/**
+ * {@inheritDoc}
+ * <p>
* Load the configuration as a Git text style configuration file.
* <p>
* If the file does not exist, this configuration is cleared, and thus
* behaves the same as though the file exists, but is empty.
- *
- * @throws IOException
- * the file could not be read (but does exist).
- * @throws ConfigInvalidException
- * the file is not a properly formatted configuration file.
*/
@Override
public void load() throws IOException, ConfigInvalidException {
}
/**
+ * {@inheritDoc}
+ * <p>
* Save the configuration as a Git text style configuration file.
* <p>
* <b>Warning:</b> Although this method uses the traditional Git file
* configuration file, it does not ensure that the file has not been
* modified since the last read, which means updates performed by other
* objects accessing the same backing file may be lost.
- *
- * @throws IOException
- * the file could not be written.
*/
@Override
public void save() throws IOException {
fireConfigChangedEvent();
}
+ /** {@inheritDoc} */
@Override
public void clear() {
hash = hash(new byte[0]);
return ObjectId.fromRaw(Constants.newMessageDigest().digest(rawText));
}
+ /** {@inheritDoc} */
@SuppressWarnings("nls")
@Override
public String toString() {
}
/**
+ * Whether the currently loaded configuration file is outdated
+ *
* @return returns true if the currently loaded configuration file is older
- * than the file on disk
+ * than the file on disk
*/
public boolean isOutdated() {
return snapshot.isModified(getFile());
}
/**
+ * {@inheritDoc}
+ *
* @since 4.10
*/
@Override
import org.eclipse.jgit.lib.Repository;
/**
- * Constructs a {@link FileRepository}.
+ * Constructs a {@link org.eclipse.jgit.internal.storage.file.FileRepository}.
* <p>
* Applications must set one of {@link #setGitDir(File)} or
* {@link #setWorkTree(File)}, or use {@link #readEnvironment()} or
public class FileRepositoryBuilder extends
BaseRepositoryBuilder<FileRepositoryBuilder, Repository> {
/**
+ * {@inheritDoc}
+ * <p>
* Create a repository matching the configuration in this builder.
* <p>
* If an option was not set, the build method will try to default the option
* based on other options. If insufficient information is available, an
* exception is thrown to the caller.
*
- * @return a repository matching this configuration.
- * @throws IllegalArgumentException
- * insufficient parameters were set.
- * @throws IOException
- * the repository could not be accessed to configure the rest of
- * the builder's parameters.
* @since 3.0
*/
@Override
}
/**
- * Convenience factory method to construct a {@link FileRepository}.
+ * Convenience factory method to construct a
+ * {@link org.eclipse.jgit.internal.storage.file.FileRepository}.
*
* @param gitDir
* {@code GIT_DIR}, the repository meta directory.
* @return a repository matching this configuration.
- * @throws IOException
+ * @throws java.io.IOException
* the repository could not be accessed to configure the rest of
* the builder's parameters.
* @since 3.0
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.storage.pack.PackConfig;
-/** Configuration parameters for JVM-wide buffer cache used by JGit. */
+/**
+ * Configuration parameters for JVM-wide buffer cache used by JGit.
+ */
public class WindowCacheConfig {
/** 1024 (number of bytes in one kibibyte/kilobyte) */
public static final int KB = 1024;
private int streamFileThreshold;
- /** Create a default configuration. */
+ /**
+ * Create a default configuration.
+ */
public WindowCacheConfig() {
packedGitOpenFiles = 128;
packedGitLimit = 10 * MB;
}
/**
+ * Get maximum number of streams to open at a time.
+ *
* @return maximum number of streams to open at a time. Open packs count
* against the process limits. <b>Default is 128.</b>
*/
}
/**
+ * Set maximum number of streams to open at a time.
+ *
* @param fdLimit
* maximum number of streams to open at a time. Open packs count
* against the process limits
}
/**
+ * Get maximum number bytes of heap memory to dedicate to caching pack file
+ * data.
+ *
* @return maximum number bytes of heap memory to dedicate to caching pack
* file data. <b>Default is 10 MB.</b>
*/
}
/**
+ * Set maximum number bytes of heap memory to dedicate to caching pack file
+ * data.
+ *
* @param newLimit
* maximum number bytes of heap memory to dedicate to caching
* pack file data.
}
/**
+ * Get size in bytes of a single window mapped or read in from the pack
+ * file.
+ *
* @return size in bytes of a single window mapped or read in from the pack
* file. <b>Default is 8 KB.</b>
*/
}
/**
+ * Set size in bytes of a single window read in from the pack file.
+ *
* @param newSize
* size in bytes of a single window read in from the pack file.
*/
}
/**
- * @return true enables use of Java NIO virtual memory mapping for windows;
- * false reads entire window into a byte[] with standard read calls.
- * <b>Default false.</b>
+ * Whether to use Java NIO virtual memory mapping for windows
+ *
+ * @return {@code true} enables use of Java NIO virtual memory mapping for
+ * windows; false reads entire window into a byte[] with standard
+ * read calls. <b>Default false.</b>
*/
public boolean isPackedGitMMAP() {
return packedGitMMAP;
}
/**
+ * Set whether to enable use of Java NIO virtual memory mapping for windows
+ *
* @param usemmap
- * true enables use of Java NIO virtual memory mapping for
- * windows; false reads entire window into a byte[] with standard
- * read calls.
+ * {@code true} enables use of Java NIO virtual memory mapping
+ * for windows; false reads entire window into a byte[] with
+ * standard read calls.
*/
public void setPackedGitMMAP(final boolean usemmap) {
packedGitMMAP = usemmap;
}
/**
+ * Get maximum number of bytes to cache in delta base cache for inflated,
+ * recently accessed objects, without delta chains.
+ *
* @return maximum number of bytes to cache in delta base cache for
* inflated, recently accessed objects, without delta chains.
* <b>Default 10 MB.</b>
}
/**
+ * Set maximum number of bytes to cache in delta base cache for inflated,
+ * recently accessed objects, without delta chains.
+ *
* @param newLimit
* maximum number of bytes to cache in delta base cache for
* inflated, recently accessed objects, without delta chains.
deltaBaseCacheLimit = newLimit;
}
- /** @return the size threshold beyond which objects must be streamed. */
+ /**
+ * Get the size threshold beyond which objects must be streamed.
+ *
+ * @return the size threshold beyond which objects must be streamed.
+ */
public int getStreamFileThreshold() {
return streamFileThreshold;
}
/**
+ * Set new byte limit for objects that must be streamed.
+ *
* @param newLimit
* new byte limit for objects that must be streamed. Objects
* smaller than this size can be obtained as a contiguous byte
private boolean singlePack;
- /** Create a default configuration. */
+ /**
+ * Create a default configuration.
+ */
public PackConfig() {
// Fields are initialized to defaults.
}
}
/**
- * Create a configuration honoring settings in a {@link Config}.
+ * Create a configuration honoring settings in a
+ * {@link org.eclipse.jgit.lib.Config}.
*
* @param cfg
* the source to read settings from. The source is not retained
}
/**
+ * Whether existing delta chains should be cut at
+ * {@link #getMaxDeltaDepth()}.
+ *
* @return true if existing delta chains should be cut at
* {@link #getMaxDeltaDepth()}. Default is false, allowing existing
* chains to be of any length.
}
/**
+ * Whether all of refs/* should be packed in a single pack.
+ *
* @return true if all of refs/* should be packed in a single pack. Default
- * is false, packing a separate GC_REST pack for references outside
- * of refs/heads/* and refs/tags/*.
+ * is false, packing a separate GC_REST pack for references outside
+ * of refs/heads/* and refs/tags/*.
* @since 4.9
*/
public boolean getSinglePack() {
this.threads = threads;
}
- /** @return the preferred thread pool to execute delta search on. */
+ /**
+ * Get the preferred thread pool to execute delta search on.
+ *
+ * @return the preferred thread pool to execute delta search on.
+ */
public Executor getExecutor() {
return executor;
}
getBitmapInactiveBranchAgeInDays()));
}
+ /** {@inheritDoc} */
@Override
public String toString() {
final StringBuilder b = new StringBuilder();
private Accumulator statistics;
/**
- * Creates a new {@link PackStatistics} object from the accumulator.
+ * Creates a new {@link org.eclipse.jgit.storage.pack.PackStatistics} object
+ * from the accumulator.
*
* @param accumulator
* the accumulator of the statistics
}
/**
+ * Get unmodifiable collection of objects to be included in the pack.
+ *
* @return unmodifiable collection of objects to be included in the pack.
* May be {@code null} if the pack was hand-crafted in a unit test.
*/
}
/**
+ * Get unmodifiable collection of objects that should be excluded from the
+ * pack
+ *
* @return unmodifiable collection of objects that should be excluded from
* the pack, as the peer that will receive the pack already has
* these objects.
}
/**
+ * Get unmodifiable collection of objects that were shallow commits on the
+ * client.
+ *
* @return unmodifiable collection of objects that were shallow commits on
* the client.
*/
}
/**
+ * Get unmodifiable list of the cached packs that were reused in the output
+ *
* @return unmodifiable list of the cached packs that were reused in the
* output, if any were selected for reuse.
*/
return statistics.reusedPacks;
}
- /** @return unmodifiable collection of the root commits of the history. */
+ /**
+ * Get unmodifiable collection of the root commits of the history.
+ *
+ * @return unmodifiable collection of the root commits of the history.
+ */
public Set<ObjectId> getRootCommits() {
return statistics.rootCommits;
}
/**
+ * Get number of objects in the output pack that went through the delta
+ * search process in order to find a potential delta base.
+ *
* @return number of objects in the output pack that went through the delta
* search process in order to find a potential delta base.
*/
}
/**
+ * Get number of objects in the output pack that went through delta base
+ * search and found a suitable base.
+ *
* @return number of objects in the output pack that went through delta base
* search and found a suitable base. This is a subset of
* {@link #getDeltaSearchNonEdgeObjects()}.
}
/**
+ * Get total number of objects output.
+ *
* @return total number of objects output. This total includes the value of
* {@link #getTotalDeltas()}.
*/
}
/**
+ * Get the count of objects that needed to be discovered through an object
+ * walk because they were not found in bitmap indices.
+ *
* @return the count of objects that needed to be discovered through an
* object walk because they were not found in bitmap indices.
* Returns -1 if no bitmap indices were found.
}
/**
+ * Get total number of deltas output.
+ *
* @return total number of deltas output. This may be lower than the actual
* number of deltas if a cached pack was reused.
*/
}
/**
+ * Get number of objects whose existing representation was reused in the
+ * output.
+ *
* @return number of objects whose existing representation was reused in the
* output. This count includes {@link #getReusedDeltas()}.
*/
}
/**
+ * Get number of deltas whose existing representation was reused in the
+ * output.
+ *
* @return number of deltas whose existing representation was reused in the
* output, as their base object was also output or was assumed
* present for a thin pack. This may be lower than the actual number
}
/**
+ * Get total number of bytes written.
+ *
* @return total number of bytes written. This size includes the pack
* header, trailer, thin pack, and reused cached pack(s).
*/
}
/**
+ * Get size of the thin pack in bytes.
+ *
* @return size of the thin pack in bytes, if a thin pack was generated. A
* thin pack is created when the client already has objects and some
* deltas are created against those objects, or if a cached pack is
}
/**
+ * Get information about this type of object in the pack.
+ *
* @param typeCode
* object type code, e.g. OBJ_COMMIT or OBJ_TREE.
* @return information about this type of object in the pack.
return new ObjectType(statistics.objectTypes[typeCode]);
}
- /** @return true if the resulting pack file was a shallow pack. */
+ /**
+ * Whether the resulting pack file was a shallow pack.
+ *
+ * @return {@code true} if the resulting pack file was a shallow pack.
+ */
public boolean isShallow() {
return statistics.depth > 0;
}
- /** @return depth (in commits) the pack includes if shallow. */
+ /**
+ * Get depth (in commits) the pack includes if shallow.
+ *
+ * @return depth (in commits) the pack includes if shallow.
+ */
public int getDepth() {
return statistics.depth;
}
/**
+ * Get time in milliseconds spent enumerating the objects that need to be
+ * included in the output.
+ *
* @return time in milliseconds spent enumerating the objects that need to
* be included in the output. This time includes any restarts that
* occur when a cached pack is selected for reuse.
}
/**
+ * Get time in milliseconds spent matching existing representations against
+ * objects that will be transmitted.
+ *
* @return time in milliseconds spent matching existing representations
* against objects that will be transmitted, or that the client can
* be assumed to already have.
}
/**
+ * Get time in milliseconds spent finding the sizes of all objects that will
+ * enter the delta compression search window.
+ *
* @return time in milliseconds spent finding the sizes of all objects that
* will enter the delta compression search window. The sizes need to
* be known to better match similar objects together and improve
}
/**
+ * Get time in milliseconds spent on delta compression.
+ *
* @return time in milliseconds spent on delta compression. This is observed
* wall-clock time and does not accurately track CPU time used when
* multiple threads were used to perform the delta compression.
}
/**
+ * Get time in milliseconds spent writing the pack output, from start of
+ * header until end of trailer.
+ *
* @return time in milliseconds spent writing the pack output, from start of
* header until end of trailer. The transfer speed can be
* approximated by dividing {@link #getTotalBytes()} by this value.
return statistics.timeWriting;
}
- /** @return total time spent processing this pack. */
+ /**
+ * Get total time spent processing this pack.
+ *
+ * @return total time spent processing this pack.
+ */
public long getTimeTotal() {
return statistics.timeCounting + statistics.timeSearchingForReuse
+ statistics.timeSearchingForSizes + statistics.timeCompressing
}
/**
- * @return get the average output speed in terms of bytes-per-second.
+ * Get the average output speed in terms of bytes-per-second.
+ *
+ * @return the average output speed in terms of bytes-per-second.
* {@code getTotalBytes() / (getTimeWriting() / 1000.0)}.
*/
public double getTransferRate() {
return getTotalBytes() / (getTimeWriting() / 1000.0);
}
- /** @return formatted message string for display to clients. */
+ /**
+ * Get formatted message string for display to clients.
+ *
+ * @return formatted message string for display to clients.
+ */
public String getMessage() {
return MessageFormat.format(JGitText.get().packWriterStatistics,
Long.valueOf(statistics.totalObjects),
Long.valueOf(statistics.reusedDeltas));
}
- /** @return a map containing ObjectType statistics. */
+ /**
+ * Get a map containing ObjectType statistics.
+ *
+ * @return a map containing ObjectType statistics.
+ */
public Map<Integer, ObjectType> getObjectTypes() {
HashMap<Integer, ObjectType> map = new HashMap<>();
map.put(Integer.valueOf(OBJ_BLOB), new ObjectType(