/** * 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. */ public ObjectType byObjectType(int typeCode) { return new ObjectType(statistics.objectTypes[typeCode]); }
/** * 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); }
/** * Constructor for GarbageCollectCommand. * * @param repo * a {@link org.eclipse.jgit.lib.Repository} object. */ protected GarbageCollectCommand(Repository repo) { super(repo); pconfig = new PackConfig(repo); }
MutableState() { phase = PackingPhase.COUNTING; if (config.isDeltaCompress()) { int threads = config.getThreads(); if (threads <= 0) threads = Runtime.getRuntime().availableProcessors(); totalDeltaSearchBytes = (threads * config.getDeltaSearchMemoryLimit()) + config.getBigFileThreshold(); } else totalDeltaSearchBytes = 0; }
/** * Whether to prune preserved pack files in the preserved directory. * * @since 4.7 * @param prunePreserved * whether to prune preserved pack files * @return this instance */ public GarbageCollectCommand setPrunePreserved(boolean prunePreserved) { if (pconfig == null) pconfig = new PackConfig(repo); pconfig.setPrunePreserved(prunePreserved); return this; }
/** * Whether to preserve old pack files instead of deleting them. * * @since 4.7 * @param preserveOldPacks * whether to preserve old pack files * @return this instance */ public GarbageCollectCommand setPreserveOldPacks(boolean preserveOldPacks) { if (pconfig == null) pconfig = new PackConfig(repo); pconfig.setPreserveOldPacks(preserveOldPacks); return this; }
DeltaWindow(PackConfig pc, DeltaCache dc, ObjectReader or, ProgressMonitor pm, long bpu, ObjectToPack[] in, int beginIndex, int endIndex) { config = pc; deltaCache = dc; reader = or; monitor = pm; bytesPerUnit = bpu; toSearch = in; cur = beginIndex; end = endIndex; maxMemory = Math.max(0, config.getDeltaSearchMemoryLimit()); maxDepth = config.getMaxDeltaDepth(); res = DeltaWindowEntry.createWindow(config.getDeltaSearchWindowSize()); }
DfsPackDescription setPackStats(PackStatistics stats) { this.packStats = stats; setFileSize(PACK, stats.getTotalBytes()); setObjectCount(stats.getTotalObjects()); setDeltaCount(stats.getTotalDeltas()); return this; }
private void searchForDeltas(final ProgressMonitor monitor, final ObjectToPack[] list, final int cnt) throws MissingObjectException, IncorrectObjectTypeException, LargeObjectException, IOException { int threads = config.getThreads(); if (threads == 0) threads = Runtime.getRuntime().availableProcessors(); if (threads <= 1 || cnt <= config.getDeltaSearchWindowSize()) singleThreadDeltaSearch(monitor, list, cnt); else parallelDeltaSearch(monitor, list, cnt, threads); }
DeltaCache(PackConfig pc) { size = pc.getDeltaCacheSize(); entryLimit = pc.getDeltaCacheLimit(); queue = new ReferenceQueue<>(); }
/** * 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 * by the new configuration, instead its settings are copied * during the constructor. */ public PackConfig(Config cfg) { fromConfig(cfg); }
/** * Set the number of objects considered when searching for a delta base. * * Default setting: {@value #DEFAULT_DELTA_SEARCH_WINDOW_SIZE} * * @param objectCount * number of objects to search at once. Must be at least 2. */ public void setDeltaSearchWindowSize(int objectCount) { if (objectCount <= 2) setDeltaCompress(false); else deltaSearchWindowSize = objectCount; }
private Deflater deflater() { if (myDeflater == null) myDeflater = new Deflater(config.getCompressionLevel()); return myDeflater; }
/** * Get statistics of what this PackWriter did in order to create the final * pack stream. * * @return description of what this PackWriter did in order to create the * final pack stream. This should only be invoked after the calls to * create the pack/index/bitmap have completed. */ public PackStatistics getStatistics() { return new PackStatistics(stats); }
/** * Create a writer to load objects from the specified reader. * <p> * Objects for packing are specified in {@link #preparePack(Iterator)} or * {@link #preparePack(ProgressMonitor, Set, Set)}. * * @param reader * reader to read from the repository with. */ public PackWriter(ObjectReader reader) { this(new PackConfig(), reader); }
/** * Create a configuration honoring the repository's settings. * * @param db * the repository to read settings from. The repository is not * retained by the new configuration, instead its settings are * copied during the constructor. */ public PackConfig(Repository db) { fromConfig(db.getConfig()); }
private Deflater deflater() { if (deflater == null) deflater = new Deflater(config.getCompressionLevel()); else deflater.reset(); return deflater; }
/** * Create writer for specified repository. * <p> * Objects for packing are specified in {@link #preparePack(Iterator)} or * {@link #preparePack(ProgressMonitor, Set, Set)}. * * @param repo * repository where objects are stored. * @param reader * reader to read from the repository with. */ public PackWriter(Repository repo, ObjectReader reader) { this(new PackConfig(repo), reader); }
/** * Get the configuration used by the pack generator to make packs. * * If {@link #setPackConfig(PackConfig)} was previously given null a new * PackConfig is created on demand by this method using the source * repository's settings. * * @return the pack configuration. Never null. */ public PackConfig getPackConfig() { if (packConfig == null) packConfig = new PackConfig(local); return packConfig; }
private PackWriter newPackWriter() { PackConfig pc = packConfig; if (pc == null) { pc = db != null ? new PackConfig(db) : new PackConfig(); } return new PackWriter(pc, reader != null ? reader : db.newObjectReader()); }