1 /*
2 * Copyright (C) 2008-2010, Google Inc.
3 * Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>
4 * and other copyright owners as documented in the project's IP log.
5 *
6 * This program and the accompanying materials are made available
7 * under the terms of the Eclipse Distribution License v1.0 which
8 * accompanies this distribution, is reproduced below, and is
9 * available at http://www.eclipse.org/org/documents/edl-v10.php
10 *
11 * All rights reserved.
12 *
13 * Redistribution and use in source and binary forms, with or
14 * without modification, are permitted provided that the following
15 * conditions are met:
16 *
17 * - Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 *
20 * - Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer in the documentation and/or other materials provided
23 * with the distribution.
24 *
25 * - Neither the name of the Eclipse Foundation, Inc. nor the
26 * names of its contributors may be used to endorse or promote
27 * products derived from this software without specific prior
28 * written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
31 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
32 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
33 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
35 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
37 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
39 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
41 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
42 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 */
44
45 package org.eclipse.jgit.storage.pack;
46
47 import java.util.concurrent.Executor;
48 import java.util.zip.Deflater;
49
50 import org.eclipse.jgit.internal.storage.file.PackIndexWriter;
51 import org.eclipse.jgit.lib.Config;
52 import org.eclipse.jgit.lib.Repository;
53
54 /**
55 * Configuration used by a pack writer when constructing the stream.
56 *
57 * A configuration may be modified once created, but should not be modified
58 * while it is being used by a PackWriter. If a configuration is not modified it
59 * is safe to share the same configuration instance between multiple concurrent
60 * threads executing different PackWriters.
61 */
62 public class PackConfig {
63 /**
64 * Default value of deltas reuse option: {@value}
65 *
66 * @see #setReuseDeltas(boolean)
67 */
68 public static final boolean DEFAULT_REUSE_DELTAS = true;
69
70 /**
71 * Default value of objects reuse option: {@value}
72 *
73 * @see #setReuseObjects(boolean)
74 */
75 public static final boolean DEFAULT_REUSE_OBJECTS = true;
76
77 /**
78 * Default value of delta compress option: {@value}
79 *
80 * @see #setDeltaCompress(boolean)
81 */
82 public static final boolean DEFAULT_DELTA_COMPRESS = true;
83
84 /**
85 * Default value of delta base as offset option: {@value}
86 *
87 * @see #setDeltaBaseAsOffset(boolean)
88 */
89 public static final boolean DEFAULT_DELTA_BASE_AS_OFFSET = false;
90
91 /**
92 * Default value of maximum delta chain depth: {@value}
93 *
94 * @see #setMaxDeltaDepth(int)
95 */
96 public static final int DEFAULT_MAX_DELTA_DEPTH = 50;
97
98 /**
99 * Default window size during packing: {@value}
100 *
101 * @see #setDeltaSearchWindowSize(int)
102 */
103 public static final int DEFAULT_DELTA_SEARCH_WINDOW_SIZE = 10;
104
105 /**
106 * Default big file threshold: {@value}
107 *
108 * @see #setBigFileThreshold(int)
109 */
110 public static final int DEFAULT_BIG_FILE_THRESHOLD = 50 * 1024 * 1024;
111
112 /**
113 * Default delta cache size: {@value}
114 *
115 * @see #setDeltaCacheSize(long)
116 */
117 public static final long DEFAULT_DELTA_CACHE_SIZE = 50 * 1024 * 1024;
118
119 /**
120 * Default delta cache limit: {@value}
121 *
122 * @see #setDeltaCacheLimit(int)
123 */
124 public static final int DEFAULT_DELTA_CACHE_LIMIT = 100;
125
126 /**
127 * Default index version: {@value}
128 *
129 * @see #setIndexVersion(int)
130 */
131 public static final int DEFAULT_INDEX_VERSION = 2;
132
133 /**
134 * Default value of the build bitmaps option: {@value}
135 *
136 * @see #setBuildBitmaps(boolean)
137 * @since 3.0
138 */
139 public static final boolean DEFAULT_BUILD_BITMAPS = true;
140
141
142 private int compressionLevel = Deflater.DEFAULT_COMPRESSION;
143
144 private boolean reuseDeltas = DEFAULT_REUSE_DELTAS;
145
146 private boolean reuseObjects = DEFAULT_REUSE_OBJECTS;
147
148 private boolean deltaBaseAsOffset = DEFAULT_DELTA_BASE_AS_OFFSET;
149
150 private boolean deltaCompress = DEFAULT_DELTA_COMPRESS;
151
152 private int maxDeltaDepth = DEFAULT_MAX_DELTA_DEPTH;
153
154 private int deltaSearchWindowSize = DEFAULT_DELTA_SEARCH_WINDOW_SIZE;
155
156 private long deltaSearchMemoryLimit;
157
158 private long deltaCacheSize = DEFAULT_DELTA_CACHE_SIZE;
159
160 private int deltaCacheLimit = DEFAULT_DELTA_CACHE_LIMIT;
161
162 private int bigFileThreshold = DEFAULT_BIG_FILE_THRESHOLD;
163
164 private int threads;
165
166 private Executor executor;
167
168 private int indexVersion = DEFAULT_INDEX_VERSION;
169
170 private boolean buildBitmaps = DEFAULT_BUILD_BITMAPS;
171
172 private boolean cutDeltaChains;
173
174 /** Create a default configuration. */
175 public PackConfig() {
176 // Fields are initialized to defaults.
177 }
178
179 /**
180 * Create a configuration honoring the repository's settings.
181 *
182 * @param db
183 * the repository to read settings from. The repository is not
184 * retained by the new configuration, instead its settings are
185 * copied during the constructor.
186 */
187 public PackConfig(Repository db) {
188 fromConfig(db.getConfig());
189 }
190
191 /**
192 * Create a configuration honoring settings in a {@link Config}.
193 *
194 * @param cfg
195 * the source to read settings from. The source is not retained
196 * by the new configuration, instead its settings are copied
197 * during the constructor.
198 */
199 public PackConfig(Config cfg) {
200 fromConfig(cfg);
201 }
202
203 /**
204 * Copy an existing configuration to a new instance.
205 *
206 * @param cfg
207 * the source configuration to copy from.
208 */
209 public PackConfig(PackConfig cfg) {
210 this.compressionLevel = cfg.compressionLevel;
211 this.reuseDeltas = cfg.reuseDeltas;
212 this.reuseObjects = cfg.reuseObjects;
213 this.deltaBaseAsOffset = cfg.deltaBaseAsOffset;
214 this.deltaCompress = cfg.deltaCompress;
215 this.maxDeltaDepth = cfg.maxDeltaDepth;
216 this.deltaSearchWindowSize = cfg.deltaSearchWindowSize;
217 this.deltaSearchMemoryLimit = cfg.deltaSearchMemoryLimit;
218 this.deltaCacheSize = cfg.deltaCacheSize;
219 this.deltaCacheLimit = cfg.deltaCacheLimit;
220 this.bigFileThreshold = cfg.bigFileThreshold;
221 this.threads = cfg.threads;
222 this.executor = cfg.executor;
223 this.indexVersion = cfg.indexVersion;
224 this.buildBitmaps = cfg.buildBitmaps;
225 this.cutDeltaChains = cfg.cutDeltaChains;
226 }
227
228 /**
229 * Check whether to reuse deltas existing in repository.
230 *
231 * Default setting: {@value #DEFAULT_REUSE_DELTAS}
232 *
233 * @return true if object is configured to reuse deltas; false otherwise.
234 */
235 public boolean isReuseDeltas() {
236 return reuseDeltas;
237 }
238
239 /**
240 * Set reuse deltas configuration option for the writer.
241 *
242 * When enabled, writer will search for delta representation of object in
243 * repository and use it if possible. Normally, only deltas with base to
244 * another object existing in set of objects to pack will be used. The
245 * exception however is thin-packs where the base object may exist on the
246 * other side.
247 *
248 * When raw delta data is directly copied from a pack file, its checksum is
249 * computed to verify the data is not corrupt.
250 *
251 * Default setting: {@value #DEFAULT_REUSE_DELTAS}
252 *
253 * @param reuseDeltas
254 * boolean indicating whether or not try to reuse deltas.
255 */
256 public void setReuseDeltas(boolean reuseDeltas) {
257 this.reuseDeltas = reuseDeltas;
258 }
259
260 /**
261 * Checks whether to reuse existing objects representation in repository.
262 *
263 * Default setting: {@value #DEFAULT_REUSE_OBJECTS}
264 *
265 * @return true if writer is configured to reuse objects representation from
266 * pack; false otherwise.
267 */
268 public boolean isReuseObjects() {
269 return reuseObjects;
270 }
271
272 /**
273 * Set reuse objects configuration option for the writer.
274 *
275 * If enabled, writer searches for compressed representation in a pack file.
276 * If possible, compressed data is directly copied from such a pack file.
277 * Data checksum is verified.
278 *
279 * Default setting: {@value #DEFAULT_REUSE_OBJECTS}
280 *
281 * @param reuseObjects
282 * boolean indicating whether or not writer should reuse existing
283 * objects representation.
284 */
285 public void setReuseObjects(boolean reuseObjects) {
286 this.reuseObjects = reuseObjects;
287 }
288
289 /**
290 * True if writer can use offsets to point to a delta base.
291 *
292 * If true the writer may choose to use an offset to point to a delta base
293 * in the same pack, this is a newer style of reference that saves space.
294 * False if the writer has to use the older (and more compatible style) of
295 * storing the full ObjectId of the delta base.
296 *
297 * Default setting: {@value #DEFAULT_DELTA_BASE_AS_OFFSET}
298 *
299 * @return true if delta base is stored as an offset; false if it is stored
300 * as an ObjectId.
301 */
302 public boolean isDeltaBaseAsOffset() {
303 return deltaBaseAsOffset;
304 }
305
306 /**
307 * Set writer delta base format.
308 *
309 * Delta base can be written as an offset in a pack file (new approach
310 * reducing file size) or as an object id (legacy approach, compatible with
311 * old readers).
312 *
313 * Default setting: {@value #DEFAULT_DELTA_BASE_AS_OFFSET}
314 *
315 * @param deltaBaseAsOffset
316 * boolean indicating whether delta base can be stored as an
317 * offset.
318 */
319 public void setDeltaBaseAsOffset(boolean deltaBaseAsOffset) {
320 this.deltaBaseAsOffset = deltaBaseAsOffset;
321 }
322
323 /**
324 * Check whether the writer will create new deltas on the fly.
325 *
326 * Default setting: {@value #DEFAULT_DELTA_COMPRESS}
327 *
328 * @return true if the writer will create a new delta when either
329 * {@link #isReuseDeltas()} is false, or no suitable delta is
330 * available for reuse.
331 */
332 public boolean isDeltaCompress() {
333 return deltaCompress;
334 }
335
336 /**
337 * Set whether or not the writer will create new deltas on the fly.
338 *
339 * Default setting: {@value #DEFAULT_DELTA_COMPRESS}
340 *
341 * @param deltaCompress
342 * true to create deltas when {@link #isReuseDeltas()} is false,
343 * or when a suitable delta isn't available for reuse. Set to
344 * false to write whole objects instead.
345 */
346 public void setDeltaCompress(boolean deltaCompress) {
347 this.deltaCompress = deltaCompress;
348 }
349
350 /**
351 * Get maximum depth of delta chain set up for the writer.
352 *
353 * Generated chains are not longer than this value.
354 *
355 * Default setting: {@value #DEFAULT_MAX_DELTA_DEPTH}
356 *
357 * @return maximum delta chain depth.
358 */
359 public int getMaxDeltaDepth() {
360 return maxDeltaDepth;
361 }
362
363 /**
364 * Set up maximum depth of delta chain for the writer.
365 *
366 * Generated chains are not longer than this value. Too low value causes low
367 * compression level, while too big makes unpacking (reading) longer.
368 *
369 * Default setting: {@value #DEFAULT_MAX_DELTA_DEPTH}
370 *
371 * @param maxDeltaDepth
372 * maximum delta chain depth.
373 */
374 public void setMaxDeltaDepth(int maxDeltaDepth) {
375 this.maxDeltaDepth = maxDeltaDepth;
376 }
377
378 /**
379 * @return true if existing delta chains should be cut at
380 * {@link #getMaxDeltaDepth()}. Default is false, allowing existing
381 * chains to be of any length.
382 * @since 3.0
383 */
384 public boolean getCutDeltaChains() {
385 return cutDeltaChains;
386 }
387
388 /**
389 * Enable cutting existing delta chains at {@link #getMaxDeltaDepth()}.
390 *
391 * By default this is disabled and existing chains are kept at whatever
392 * length a prior packer was configured to create. This allows objects to be
393 * packed one with a large depth (for example 250), and later to quickly
394 * repack the repository with a shorter depth (such as 50), but reusing the
395 * complete delta chains created by the earlier 250 depth.
396 *
397 * @param cut
398 * true to cut existing chains.
399 * @since 3.0
400 */
401 public void setCutDeltaChains(boolean cut) {
402 cutDeltaChains = cut;
403 }
404
405 /**
406 * Get the number of objects to try when looking for a delta base.
407 *
408 * This limit is per thread, if 4 threads are used the actual memory used
409 * will be 4 times this value.
410 *
411 * Default setting: {@value #DEFAULT_DELTA_SEARCH_WINDOW_SIZE}
412 *
413 * @return the object count to be searched.
414 */
415 public int getDeltaSearchWindowSize() {
416 return deltaSearchWindowSize;
417 }
418
419 /**
420 * Set the number of objects considered when searching for a delta base.
421 *
422 * Default setting: {@value #DEFAULT_DELTA_SEARCH_WINDOW_SIZE}
423 *
424 * @param objectCount
425 * number of objects to search at once. Must be at least 2.
426 */
427 public void setDeltaSearchWindowSize(int objectCount) {
428 if (objectCount <= 2)
429 setDeltaCompress(false);
430 else
431 deltaSearchWindowSize = objectCount;
432 }
433
434 /**
435 * Get maximum number of bytes to put into the delta search window.
436 *
437 * Default setting is 0, for an unlimited amount of memory usage. Actual
438 * memory used is the lower limit of either this setting, or the sum of
439 * space used by at most {@link #getDeltaSearchWindowSize()} objects.
440 *
441 * This limit is per thread, if 4 threads are used the actual memory limit
442 * will be 4 times this value.
443 *
444 * @return the memory limit.
445 */
446 public long getDeltaSearchMemoryLimit() {
447 return deltaSearchMemoryLimit;
448 }
449
450 /**
451 * Set the maximum number of bytes to put into the delta search window.
452 *
453 * Default setting is 0, for an unlimited amount of memory usage. If the
454 * memory limit is reached before {@link #getDeltaSearchWindowSize()} the
455 * window size is temporarily lowered.
456 *
457 * @param memoryLimit
458 * Maximum number of bytes to load at once, 0 for unlimited.
459 */
460 public void setDeltaSearchMemoryLimit(long memoryLimit) {
461 deltaSearchMemoryLimit = memoryLimit;
462 }
463
464 /**
465 * Get the size of the in-memory delta cache.
466 *
467 * This limit is for the entire writer, even if multiple threads are used.
468 *
469 * Default setting: {@value #DEFAULT_DELTA_CACHE_SIZE}
470 *
471 * @return maximum number of bytes worth of delta data to cache in memory.
472 * If 0 the cache is infinite in size (up to the JVM heap limit
473 * anyway). A very tiny size such as 1 indicates the cache is
474 * effectively disabled.
475 */
476 public long getDeltaCacheSize() {
477 return deltaCacheSize;
478 }
479
480 /**
481 * Set the maximum number of bytes of delta data to cache.
482 *
483 * During delta search, up to this many bytes worth of small or hard to
484 * compute deltas will be stored in memory. This cache speeds up writing by
485 * allowing the cached entry to simply be dumped to the output stream.
486 *
487 * Default setting: {@value #DEFAULT_DELTA_CACHE_SIZE}
488 *
489 * @param size
490 * number of bytes to cache. Set to 0 to enable an infinite
491 * cache, set to 1 (an impossible size for any delta) to disable
492 * the cache.
493 */
494 public void setDeltaCacheSize(long size) {
495 deltaCacheSize = size;
496 }
497
498 /**
499 * Maximum size in bytes of a delta to cache.
500 *
501 * Default setting: {@value #DEFAULT_DELTA_CACHE_LIMIT}
502 *
503 * @return maximum size (in bytes) of a delta that should be cached.
504 */
505 public int getDeltaCacheLimit() {
506 return deltaCacheLimit;
507 }
508
509 /**
510 * Set the maximum size of a delta that should be cached.
511 *
512 * During delta search, any delta smaller than this size will be cached, up
513 * to the {@link #getDeltaCacheSize()} maximum limit. This speeds up writing
514 * by allowing these cached deltas to be output as-is.
515 *
516 * Default setting: {@value #DEFAULT_DELTA_CACHE_LIMIT}
517 *
518 * @param size
519 * maximum size (in bytes) of a delta to be cached.
520 */
521 public void setDeltaCacheLimit(int size) {
522 deltaCacheLimit = size;
523 }
524
525 /**
526 * Get the maximum file size that will be delta compressed.
527 *
528 * Files bigger than this setting will not be delta compressed, as they are
529 * more than likely already highly compressed binary data files that do not
530 * delta compress well, such as MPEG videos.
531 *
532 * Default setting: {@value #DEFAULT_BIG_FILE_THRESHOLD}
533 *
534 * @return the configured big file threshold.
535 */
536 public int getBigFileThreshold() {
537 return bigFileThreshold;
538 }
539
540 /**
541 * Set the maximum file size that should be considered for deltas.
542 *
543 * Default setting: {@value #DEFAULT_BIG_FILE_THRESHOLD}
544 *
545 * @param bigFileThreshold
546 * the limit, in bytes.
547 */
548 public void setBigFileThreshold(int bigFileThreshold) {
549 this.bigFileThreshold = bigFileThreshold;
550 }
551
552 /**
553 * Get the compression level applied to objects in the pack.
554 *
555 * Default setting: {@value java.util.zip.Deflater#DEFAULT_COMPRESSION}
556 *
557 * @return current compression level, see {@link java.util.zip.Deflater}.
558 */
559 public int getCompressionLevel() {
560 return compressionLevel;
561 }
562
563 /**
564 * Set the compression level applied to objects in the pack.
565 *
566 * Default setting: {@value java.util.zip.Deflater#DEFAULT_COMPRESSION}
567 *
568 * @param level
569 * compression level, must be a valid level recognized by the
570 * {@link java.util.zip.Deflater} class.
571 */
572 public void setCompressionLevel(int level) {
573 compressionLevel = level;
574 }
575
576 /**
577 * Get the number of threads used during delta compression.
578 *
579 * Default setting: 0 (auto-detect processors)
580 *
581 * @return number of threads used for delta compression. 0 will auto-detect
582 * the threads to the number of available processors.
583 */
584 public int getThreads() {
585 return threads;
586 }
587
588 /**
589 * Set the number of threads to use for delta compression.
590 *
591 * During delta compression, if there are enough objects to be considered
592 * the writer will start up concurrent threads and allow them to compress
593 * different sections of the repository concurrently.
594 *
595 * An application thread pool can be set by {@link #setExecutor(Executor)}.
596 * If not set a temporary pool will be created by the writer, and torn down
597 * automatically when compression is over.
598 *
599 * Default setting: 0 (auto-detect processors)
600 *
601 * @param threads
602 * number of threads to use. If <= 0 the number of available
603 * processors for this JVM is used.
604 */
605 public void setThreads(int threads) {
606 this.threads = threads;
607 }
608
609 /** @return the preferred thread pool to execute delta search on. */
610 public Executor getExecutor() {
611 return executor;
612 }
613
614 /**
615 * Set the executor to use when using threads.
616 *
617 * During delta compression if the executor is non-null jobs will be queued
618 * up on it to perform delta compression in parallel. Aside from setting the
619 * executor, the caller must set {@link #setThreads(int)} to enable threaded
620 * delta search.
621 *
622 * @param executor
623 * executor to use for threads. Set to null to create a temporary
624 * executor just for the writer.
625 */
626 public void setExecutor(Executor executor) {
627 this.executor = executor;
628 }
629
630 /**
631 * Get the pack index file format version this instance creates.
632 *
633 * Default setting: {@value #DEFAULT_INDEX_VERSION}
634 *
635 * @return the index version, the special version 0 designates the oldest
636 * (most compatible) format available for the objects.
637 * @see PackIndexWriter
638 */
639 public int getIndexVersion() {
640 return indexVersion;
641 }
642
643 /**
644 * Set the pack index file format version this instance will create.
645 *
646 * Default setting: {@value #DEFAULT_INDEX_VERSION}
647 *
648 * @param version
649 * the version to write. The special version 0 designates the
650 * oldest (most compatible) format available for the objects.
651 * @see PackIndexWriter
652 */
653 public void setIndexVersion(final int version) {
654 indexVersion = version;
655 }
656
657 /**
658 * True if writer is allowed to build bitmaps for indexes.
659 *
660 * Default setting: {@value #DEFAULT_BUILD_BITMAPS}
661 *
662 * @return true if delta base is the writer can choose to output an index
663 * with bitmaps.
664 * @since 3.0
665 */
666 public boolean isBuildBitmaps() {
667 return buildBitmaps;
668 }
669
670 /**
671 * Set writer to allow building bitmaps for supported pack files.
672 *
673 * Index files can include bitmaps to speed up future ObjectWalks.
674 *
675 * Default setting: {@value #DEFAULT_BUILD_BITMAPS}
676 *
677 * @param buildBitmaps
678 * boolean indicating whether bitmaps may be included in the
679 * index.
680 * @since 3.0
681 */
682 public void setBuildBitmaps(boolean buildBitmaps) {
683 this.buildBitmaps = buildBitmaps;
684 }
685
686 /**
687 * Update properties by setting fields from the configuration.
688 *
689 * If a property's corresponding variable is not defined in the supplied
690 * configuration, then it is left unmodified.
691 *
692 * @param rc
693 * configuration to read properties from.
694 */
695 public void fromConfig(final Config rc) {
696 setMaxDeltaDepth(rc.getInt("pack", "depth", getMaxDeltaDepth())); //$NON-NLS-1$ //$NON-NLS-2$
697 setDeltaSearchWindowSize(rc.getInt(
698 "pack", "window", getDeltaSearchWindowSize())); //$NON-NLS-1$ //$NON-NLS-2$
699 setDeltaSearchMemoryLimit(rc.getLong(
700 "pack", "windowmemory", getDeltaSearchMemoryLimit())); //$NON-NLS-1$ //$NON-NLS-2$
701 setDeltaCacheSize(rc.getLong(
702 "pack", "deltacachesize", getDeltaCacheSize())); //$NON-NLS-1$ //$NON-NLS-2$
703 setDeltaCacheLimit(rc.getInt(
704 "pack", "deltacachelimit", getDeltaCacheLimit())); //$NON-NLS-1$ //$NON-NLS-2$
705 setCompressionLevel(rc.getInt("pack", "compression", //$NON-NLS-1$ //$NON-NLS-2$
706 rc.getInt("core", "compression", getCompressionLevel()))); //$NON-NLS-1$ //$NON-NLS-2$
707 setIndexVersion(rc.getInt("pack", "indexversion", getIndexVersion())); //$NON-NLS-1$ //$NON-NLS-2$
708 setBigFileThreshold(rc.getInt(
709 "core", "bigfilethreshold", getBigFileThreshold())); //$NON-NLS-1$ //$NON-NLS-2$
710 setThreads(rc.getInt("pack", "threads", getThreads())); //$NON-NLS-1$ //$NON-NLS-2$
711
712 // These variables aren't standardized
713 //
714 setReuseDeltas(rc.getBoolean("pack", "reusedeltas", isReuseDeltas())); //$NON-NLS-1$ //$NON-NLS-2$
715 setReuseObjects(rc.getBoolean("pack", "reuseobjects", isReuseObjects())); //$NON-NLS-1$ //$NON-NLS-2$
716 setDeltaCompress(rc.getBoolean(
717 "pack", "deltacompression", isDeltaCompress())); //$NON-NLS-1$ //$NON-NLS-2$
718 setCutDeltaChains(rc.getBoolean(
719 "pack", "cutdeltachains", getCutDeltaChains())); //$NON-NLS-1$ //$NON-NLS-2$
720 setBuildBitmaps(rc.getBoolean("pack", "buildbitmaps", isBuildBitmaps())); //$NON-NLS-1$ //$NON-NLS-2$
721 }
722
723 public String toString() {
724 final StringBuilder b = new StringBuilder();
725 b.append("maxDeltaDepth=").append(getMaxDeltaDepth()); //$NON-NLS-1$
726 b.append(", deltaSearchWindowSize=").append(getDeltaSearchWindowSize()); //$NON-NLS-1$
727 b.append(", deltaSearchMemoryLimit=").append(getDeltaSearchMemoryLimit()); //$NON-NLS-1$
728 b.append(", deltaCacheSize=").append(getDeltaCacheSize()); //$NON-NLS-1$
729 b.append(", deltaCacheLimit=").append(getDeltaCacheLimit()); //$NON-NLS-1$
730 b.append(", compressionLevel=").append(getCompressionLevel()); //$NON-NLS-1$
731 b.append(", indexVersion=").append(getIndexVersion()); //$NON-NLS-1$
732 b.append(", bigFileThreshold=").append(getBigFileThreshold()); //$NON-NLS-1$
733 b.append(", threads=").append(getThreads()); //$NON-NLS-1$
734 b.append(", reuseDeltas=").append(isReuseDeltas()); //$NON-NLS-1$
735 b.append(", reuseObjects=").append(isReuseObjects()); //$NON-NLS-1$
736 b.append(", deltaCompress=").append(isDeltaCompress()); //$NON-NLS-1$
737 b.append(", buildBitmaps=").append(isBuildBitmaps()); //$NON-NLS-1$
738 return b.toString();
739 }
740 }