Package org.eclipse.jgit.storage.pack
Class PackConfig
java.lang.Object
org.eclipse.jgit.storage.pack.PackConfig
Configuration used by a pack writer when constructing the stream.
A configuration may be modified once created, but should not be modified
while it is being used by a PackWriter. If a configuration is not modified it
is safe to share the same configuration instance between multiple concurrent
threads executing different PackWriters.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate booleanprivate intprivate booleanstatic final intDefault big file threshold: 52428800static final intDefault count of most recent commits to select for bitmaps.static final intDefault spacing between commits in distant history when selecting commits for bitmaps.static final intDefault count of branches required to activate inactive branch commit selection.static final intDefault age at which a branch is considered inactive.static final intCount at which the span between selected commits changes from "bitmapRecentCommitSpan" to "bitmapDistantCommitSpan".static final intDefault spacing between commits in recent history when selecting commits for bitmaps.static final booleanDefault value of the build bitmaps option: truestatic final booleanDefault value of delta base as offset option: falsestatic final intDefault delta cache limit: 100static final longDefault delta cache size: 52428800Lstatic final booleanDefault value of delta compress option: truestatic final intDefault window size during packing: 10static final intDefault index version: 2static final intDefault value of maximum delta chain depth: 50static final longDefault if we wait before opening a newly written pack to prevent its lastModified timestamp could be racystatic final booleanDefault value of keep old packs option: falsestatic final booleanDefault value of prune old packs option: falsestatic final booleanDefault value of deltas reuse option: truestatic final booleanDefault value of objects reuse option: truestatic final DurationDefault max time to spend during the search for reuse phase.static final booleanDefault if we wait before opening a newly written pack to prevent its lastModified timestamp could be racyprivate booleanprivate intprivate longprivate booleanprivate longprivate intprivate Executorprivate intprivate intprivate static final intprivate longprivate booleanprivate booleanprivate booleanprivate booleanprivate Durationprivate booleanprivate intprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionCreate a default configuration.PackConfig(Config cfg) Create a configuration honoring settings in aConfig.PackConfig(Repository db) Create a configuration honoring the repository's settings.PackConfig(PackConfig cfg) Copy an existing configuration to a new instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleandoWaitPreventRacyPack(long packSize) Get whether we wait before opening a newly written pack to prevent its lastModified timestamp could be racy.voidfromConfig(Config rc) Update properties by setting fields from the configuration.intGet the maximum file size that will be delta compressed.intGet the count of most recent commits for which to build bitmaps.intGet the span of commits when building bitmaps for distant history.intGet the count of branches deemed "excessive".intGet the age in days that marks a branch as "inactive".intGet the count at which to switch from "bitmapRecentCommitSpan" to "bitmapDistantCommitSpan".intGet the span of commits when building bitmaps for recent history.intGet the compression level applied to objects in the pack.booleanWhether existing delta chains should be cut atgetMaxDeltaDepth().intMaximum size in bytes of a delta to cache.longGet the size of the in-memory delta cache.longGet maximum number of bytes to put into the delta search window.intGet the number of objects to try when looking for a delta base.Get the preferred thread pool to execute delta search on.intGet the pack index file format version this instance creates.intGet maximum depth of delta chain set up for the writer.longGet minimum packfile size for which we wait before opening a newly written pack to prevent its lastModified timestamp could be racy ifisWaitToPreventRacyPackistrue.Get the max time to spend during the search for reuse phase.booleanWhether all of refs/* should be packed in a single pack.intGet the number of threads used during delta compression.booleanTrue if writer is allowed to build bitmaps for indexes.booleanTrue if writer can use offsets to point to a delta base.booleanCheck whether the writer will create new deltas on the fly.booleanChecks whether to preserve old packs in a preserved directory Default setting: falsebooleanChecks whether to remove preserved pack files in a preserved directory Default setting: falsebooleanCheck whether to reuse deltas existing in repository.booleanChecks whether to reuse existing objects representation in repository.booleanGet whether we wait before opening a newly written pack to prevent its lastModified timestamp could be racyvoidsetBigFileThreshold(int bigFileThreshold) Set the maximum file size that should be considered for deltas.voidsetBitmapContiguousCommitCount(int count) Set the count of most recent commits for which to build bitmaps.voidsetBitmapDistantCommitSpan(int span) Set the span of commits when building bitmaps for distant history.voidsetBitmapExcessiveBranchCount(int count) Set the count of branches deemed "excessive".voidsetBitmapInactiveBranchAgeInDays(int ageInDays) Set the age in days that marks a branch as "inactive".voidsetBitmapRecentCommitCount(int count) Set the count at which to switch from "bitmapRecentCommitSpan" to "bitmapDistantCommitSpan".voidsetBitmapRecentCommitSpan(int span) Set the span of commits when building bitmaps for recent history.voidsetBuildBitmaps(boolean buildBitmaps) Set writer to allow building bitmaps for supported pack files.voidsetCompressionLevel(int level) Set the compression level applied to objects in the pack.voidsetCutDeltaChains(boolean cut) Enable cutting existing delta chains atgetMaxDeltaDepth().voidsetDeltaBaseAsOffset(boolean deltaBaseAsOffset) Set writer delta base format.voidsetDeltaCacheLimit(int size) Set the maximum size of a delta that should be cached.voidsetDeltaCacheSize(long size) Set the maximum number of bytes of delta data to cache.voidsetDeltaCompress(boolean deltaCompress) Set whether or not the writer will create new deltas on the fly.voidsetDeltaSearchMemoryLimit(long memoryLimit) Set the maximum number of bytes to put into the delta search window.voidsetDeltaSearchWindowSize(int objectCount) Set the number of objects considered when searching for a delta base.voidsetExecutor(Executor executor) Set the executor to use when using threads.voidsetIndexVersion(int version) Set the pack index file format version this instance will create.voidsetMaxDeltaDepth(int maxDeltaDepth) Set up maximum depth of delta chain for the writer.voidsetMinSizePreventRacyPack(long minSizePreventRacyPack) Set minimum packfile size for which we wait before opening a newly written pack to prevent its lastModified timestamp could be racy ifisWaitToPreventRacyPackistrue.voidsetPreserveOldPacks(boolean preserveOldPacks) Set preserve old packs configuration option for repacking.voidsetPrunePreserved(boolean prunePreserved) Set prune preserved configuration option for repacking.voidsetReuseDeltas(boolean reuseDeltas) Set reuse deltas configuration option for the writer.voidsetReuseObjects(boolean reuseObjects) Set reuse objects configuration option for the writer.voidsetSearchForReuseTimeout(Duration timeout) Set the max time to spend during the search for reuse phase.voidsetSinglePack(boolean single) Iftrue, packs a single GC pack for all objects reachable from refs/*.voidsetThreads(int threads) Set the number of threads to use for delta compression.voidsetWaitPreventRacyPack(boolean waitPreventRacyPack) Set whether we wait before opening a newly written pack to prevent its lastModified timestamp could be racytoString()
-
Field Details
-
DEFAULT_REUSE_DELTAS
public static final boolean DEFAULT_REUSE_DELTASDefault value of deltas reuse option: true- See Also:
-
DEFAULT_REUSE_OBJECTS
public static final boolean DEFAULT_REUSE_OBJECTSDefault value of objects reuse option: true -
DEFAULT_PRESERVE_OLD_PACKS
public static final boolean DEFAULT_PRESERVE_OLD_PACKSDefault value of keep old packs option: false- Since:
- 4.7
- See Also:
-
DEFAULT_PRUNE_PRESERVED
public static final boolean DEFAULT_PRUNE_PRESERVEDDefault value of prune old packs option: false- Since:
- 4.7
- See Also:
-
DEFAULT_DELTA_COMPRESS
public static final boolean DEFAULT_DELTA_COMPRESSDefault value of delta compress option: true -
DEFAULT_DELTA_BASE_AS_OFFSET
public static final boolean DEFAULT_DELTA_BASE_AS_OFFSETDefault value of delta base as offset option: false -
DEFAULT_MAX_DELTA_DEPTH
public static final int DEFAULT_MAX_DELTA_DEPTHDefault value of maximum delta chain depth: 50- See Also:
-
DEFAULT_DELTA_SEARCH_WINDOW_SIZE
public static final int DEFAULT_DELTA_SEARCH_WINDOW_SIZEDefault window size during packing: 10 -
MB
private static final int MB- See Also:
-
DEFAULT_BIG_FILE_THRESHOLD
public static final int DEFAULT_BIG_FILE_THRESHOLDDefault big file threshold: 52428800 -
DEFAULT_WAIT_PREVENT_RACY_PACK
public static final boolean DEFAULT_WAIT_PREVENT_RACY_PACKDefault if we wait before opening a newly written pack to prevent its lastModified timestamp could be racy- Since:
- 5.1.8
- See Also:
-
DEFAULT_MINSIZE_PREVENT_RACY_PACK
public static final long DEFAULT_MINSIZE_PREVENT_RACY_PACKDefault if we wait before opening a newly written pack to prevent its lastModified timestamp could be racy- Since:
- 5.1.8
- See Also:
-
DEFAULT_DELTA_CACHE_SIZE
public static final long DEFAULT_DELTA_CACHE_SIZEDefault delta cache size: 52428800L- See Also:
-
DEFAULT_DELTA_CACHE_LIMIT
public static final int DEFAULT_DELTA_CACHE_LIMITDefault delta cache limit: 100- See Also:
-
DEFAULT_INDEX_VERSION
public static final int DEFAULT_INDEX_VERSIONDefault index version: 2- See Also:
-
DEFAULT_BUILD_BITMAPS
public static final boolean DEFAULT_BUILD_BITMAPSDefault value of the build bitmaps option: true- Since:
- 3.0
- See Also:
-
DEFAULT_BITMAP_CONTIGUOUS_COMMIT_COUNT
public static final int DEFAULT_BITMAP_CONTIGUOUS_COMMIT_COUNTDefault count of most recent commits to select for bitmaps. Only applies when bitmaps are enabled: 100- Since:
- 4.2
- See Also:
-
DEFAULT_BITMAP_RECENT_COMMIT_COUNT
public static final int DEFAULT_BITMAP_RECENT_COMMIT_COUNTCount at which the span between selected commits changes from "bitmapRecentCommitSpan" to "bitmapDistantCommitSpan". Only applies when bitmaps are enabled: 20000- Since:
- 4.2
- See Also:
-
DEFAULT_BITMAP_RECENT_COMMIT_SPAN
public static final int DEFAULT_BITMAP_RECENT_COMMIT_SPANDefault spacing between commits in recent history when selecting commits for bitmaps. Only applies when bitmaps are enabled: 100- Since:
- 4.2
- See Also:
-
DEFAULT_BITMAP_DISTANT_COMMIT_SPAN
public static final int DEFAULT_BITMAP_DISTANT_COMMIT_SPANDefault spacing between commits in distant history when selecting commits for bitmaps. Only applies when bitmaps are enabled: 5000- Since:
- 4.2
- See Also:
-
DEFAULT_BITMAP_EXCESSIVE_BRANCH_COUNT
public static final int DEFAULT_BITMAP_EXCESSIVE_BRANCH_COUNTDefault count of branches required to activate inactive branch commit selection. If the number of branches is less than this then bitmaps for the entire commit history of all branches will be created, otherwise branches marked as "inactive" will have coverage for only partial history: 100- Since:
- 4.2
- See Also:
-
DEFAULT_BITMAP_INACTIVE_BRANCH_AGE_IN_DAYS
public static final int DEFAULT_BITMAP_INACTIVE_BRANCH_AGE_IN_DAYSDefault age at which a branch is considered inactive. Age is taken as the number of days ago that the most recent commit was made to a branch. Only affects bitmap processing if bitmaps are enabled and the "excessive branch count" has been exceeded: 90- Since:
- 4.2
- See Also:
-
DEFAULT_SEARCH_FOR_REUSE_TIMEOUT
Default max time to spend during the search for reuse phase. This optimization is disabled by default:- Since:
- 5.13
- See Also:
-
compressionLevel
private int compressionLevel -
reuseDeltas
private boolean reuseDeltas -
reuseObjects
private boolean reuseObjects -
preserveOldPacks
private boolean preserveOldPacks -
prunePreserved
private boolean prunePreserved -
deltaBaseAsOffset
private boolean deltaBaseAsOffset -
deltaCompress
private boolean deltaCompress -
maxDeltaDepth
private int maxDeltaDepth -
deltaSearchWindowSize
private int deltaSearchWindowSize -
deltaSearchMemoryLimit
private long deltaSearchMemoryLimit -
deltaCacheSize
private long deltaCacheSize -
deltaCacheLimit
private int deltaCacheLimit -
bigFileThreshold
private int bigFileThreshold -
waitPreventRacyPack
private boolean waitPreventRacyPack -
minSizePreventRacyPack
private long minSizePreventRacyPack -
threads
private int threads -
executor
-
indexVersion
private int indexVersion -
buildBitmaps
private boolean buildBitmaps -
bitmapContiguousCommitCount
private int bitmapContiguousCommitCount -
bitmapRecentCommitCount
private int bitmapRecentCommitCount -
bitmapRecentCommitSpan
private int bitmapRecentCommitSpan -
bitmapDistantCommitSpan
private int bitmapDistantCommitSpan -
bitmapExcessiveBranchCount
private int bitmapExcessiveBranchCount -
bitmapInactiveBranchAgeInDays
private int bitmapInactiveBranchAgeInDays -
searchForReuseTimeout
-
cutDeltaChains
private boolean cutDeltaChains -
singlePack
private boolean singlePack
-
-
Constructor Details
-
PackConfig
public PackConfig()Create a default configuration. -
PackConfig
Create a configuration honoring the repository's settings.- Parameters:
db- the repository to read settings from. The repository is not retained by the new configuration, instead its settings are copied during the constructor.
-
PackConfig
Create a configuration honoring settings in aConfig.- Parameters:
cfg- the source to read settings from. The source is not retained by the new configuration, instead its settings are copied during the constructor.
-
PackConfig
Copy an existing configuration to a new instance.- Parameters:
cfg- the source configuration to copy from.
-
-
Method Details
-
isReuseDeltas
public boolean isReuseDeltas()Check whether to reuse deltas existing in repository. Default setting: true- Returns:
- true if object is configured to reuse deltas; false otherwise.
-
setReuseDeltas
public void setReuseDeltas(boolean reuseDeltas) Set reuse deltas configuration option for the writer. When enabled, writer will search for delta representation of object in repository and use it if possible. Normally, only deltas with base to another object existing in set of objects to pack will be used. The exception however is thin-packs where the base object may exist on the other side. When raw delta data is directly copied from a pack file, its checksum is computed to verify the data is not corrupt. Default setting: true- Parameters:
reuseDeltas- boolean indicating whether or not try to reuse deltas.
-
isReuseObjects
public boolean isReuseObjects()Checks whether to reuse existing objects representation in repository. Default setting: true- Returns:
- true if writer is configured to reuse objects representation from pack; false otherwise.
-
setReuseObjects
public void setReuseObjects(boolean reuseObjects) Set reuse objects configuration option for the writer. If enabled, writer searches for compressed representation in a pack file. If possible, compressed data is directly copied from such a pack file. Data checksum is verified. Default setting: true- Parameters:
reuseObjects- boolean indicating whether or not writer should reuse existing objects representation.
-
isPreserveOldPacks
public boolean isPreserveOldPacks()Checks whether to preserve old packs in a preserved directory Default setting: false- Returns:
- true if repacking will preserve old pack files.
- Since:
- 4.7
-
setPreserveOldPacks
public void setPreserveOldPacks(boolean preserveOldPacks) Set preserve old packs configuration option for repacking. If enabled, old pack files are moved into a preserved subdirectory instead of being deleted Default setting: false- Parameters:
preserveOldPacks- boolean indicating whether or not preserve old pack files- Since:
- 4.7
-
isPrunePreserved
public boolean isPrunePreserved()Checks whether to remove preserved pack files in a preserved directory Default setting: false- Returns:
- true if repacking will remove preserved pack files.
- Since:
- 4.7
-
setPrunePreserved
public void setPrunePreserved(boolean prunePreserved) Set prune preserved configuration option for repacking. If enabled, preserved pack files are removed from a preserved subdirectory Default setting: false- Parameters:
prunePreserved- boolean indicating whether or not preserve old pack files- Since:
- 4.7
-
isDeltaBaseAsOffset
public boolean isDeltaBaseAsOffset()True if writer can use offsets to point to a delta base. If true the writer may choose to use an offset to point to a delta base in the same pack, this is a newer style of reference that saves space. False if the writer has to use the older (and more compatible style) of storing the full ObjectId of the delta base. Default setting: false- Returns:
- true if delta base is stored as an offset; false if it is stored as an ObjectId.
-
setDeltaBaseAsOffset
public void setDeltaBaseAsOffset(boolean deltaBaseAsOffset) Set writer delta base format. Delta base can be written as an offset in a pack file (new approach reducing file size) or as an object id (legacy approach, compatible with old readers). Default setting: false- Parameters:
deltaBaseAsOffset- boolean indicating whether delta base can be stored as an offset.
-
isDeltaCompress
public boolean isDeltaCompress()Check whether the writer will create new deltas on the fly. Default setting: true- Returns:
- true if the writer will create a new delta when either
isReuseDeltas()is false, or no suitable delta is available for reuse.
-
setDeltaCompress
public void setDeltaCompress(boolean deltaCompress) Set whether or not the writer will create new deltas on the fly. Default setting: true- Parameters:
deltaCompress- true to create deltas whenisReuseDeltas()is false, or when a suitable delta isn't available for reuse. Set to false to write whole objects instead.
-
getMaxDeltaDepth
public int getMaxDeltaDepth()Get maximum depth of delta chain set up for the writer. Generated chains are not longer than this value. Default setting: 50- Returns:
- maximum delta chain depth.
-
setMaxDeltaDepth
public void setMaxDeltaDepth(int maxDeltaDepth) Set up maximum depth of delta chain for the writer. Generated chains are not longer than this value. Too low value causes low compression level, while too big makes unpacking (reading) longer. Default setting: 50- Parameters:
maxDeltaDepth- maximum delta chain depth.
-
getCutDeltaChains
public boolean getCutDeltaChains()Whether existing delta chains should be cut atgetMaxDeltaDepth().- Returns:
- true if existing delta chains should be cut at
getMaxDeltaDepth(). Default is false, allowing existing chains to be of any length. - Since:
- 3.0
-
setCutDeltaChains
public void setCutDeltaChains(boolean cut) Enable cutting existing delta chains atgetMaxDeltaDepth(). By default this is disabled and existing chains are kept at whatever length a prior packer was configured to create. This allows objects to be packed one with a large depth (for example 250), and later to quickly repack the repository with a shorter depth (such as 50), but reusing the complete delta chains created by the earlier 250 depth.- Parameters:
cut- true to cut existing chains.- Since:
- 3.0
-
getSinglePack
public boolean getSinglePack()Whether all of refs/* should be packed in a single pack.- Returns:
- 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/*.
- Since:
- 4.9
-
setSinglePack
public void setSinglePack(boolean single) Iftrue, packs a single GC pack for all objects reachable from refs/*. Otherwise packs the GC pack with objects reachable from refs/heads/* and refs/tags/*, and a GC_REST pack with the remaining reachable objects. Disabled by default, packing GC and GC_REST.- Parameters:
single- true to pack a single GC pack rather than GC and GC_REST packs- Since:
- 4.9
-
getDeltaSearchWindowSize
public int getDeltaSearchWindowSize()Get the number of objects to try when looking for a delta base. This limit is per thread, if 4 threads are used the actual memory used will be 4 times this value. Default setting: 10- Returns:
- the object count to be searched.
-
setDeltaSearchWindowSize
public void setDeltaSearchWindowSize(int objectCount) Set the number of objects considered when searching for a delta base. Default setting: 10- Parameters:
objectCount- number of objects to search at once. Must be at least 2.
-
getDeltaSearchMemoryLimit
public long getDeltaSearchMemoryLimit()Get maximum number of bytes to put into the delta search window. Default setting is 0, for an unlimited amount of memory usage. Actual memory used is the lower limit of either this setting, or the sum of space used by at mostgetDeltaSearchWindowSize()objects. This limit is per thread, if 4 threads are used the actual memory limit will be 4 times this value.- Returns:
- the memory limit.
-
setDeltaSearchMemoryLimit
public void setDeltaSearchMemoryLimit(long memoryLimit) Set the maximum number of bytes to put into the delta search window. Default setting is 0, for an unlimited amount of memory usage. If the memory limit is reached beforegetDeltaSearchWindowSize()the window size is temporarily lowered.- Parameters:
memoryLimit- Maximum number of bytes to load at once, 0 for unlimited.
-
getDeltaCacheSize
public long getDeltaCacheSize()Get the size of the in-memory delta cache. This limit is for the entire writer, even if multiple threads are used. Default setting: 52428800L- Returns:
- maximum number of bytes worth of delta data to cache in memory. If 0 the cache is infinite in size (up to the JVM heap limit anyway). A very tiny size such as 1 indicates the cache is effectively disabled.
-
setDeltaCacheSize
public void setDeltaCacheSize(long size) Set the maximum number of bytes of delta data to cache. During delta search, up to this many bytes worth of small or hard to compute deltas will be stored in memory. This cache speeds up writing by allowing the cached entry to simply be dumped to the output stream. Default setting: 52428800L- Parameters:
size- number of bytes to cache. Set to 0 to enable an infinite cache, set to 1 (an impossible size for any delta) to disable the cache.
-
getDeltaCacheLimit
public int getDeltaCacheLimit()Maximum size in bytes of a delta to cache. Default setting: 100- Returns:
- maximum size (in bytes) of a delta that should be cached.
-
setDeltaCacheLimit
public void setDeltaCacheLimit(int size) Set the maximum size of a delta that should be cached. During delta search, any delta smaller than this size will be cached, up to thegetDeltaCacheSize()maximum limit. This speeds up writing by allowing these cached deltas to be output as-is. Default setting: 100- Parameters:
size- maximum size (in bytes) of a delta to be cached.
-
getBigFileThreshold
public int getBigFileThreshold()Get the maximum file size that will be delta compressed. Files bigger than this setting will not be delta compressed, as they are more than likely already highly compressed binary data files that do not delta compress well, such as MPEG videos. Default setting: 52428800- Returns:
- the configured big file threshold.
-
setBigFileThreshold
public void setBigFileThreshold(int bigFileThreshold) Set the maximum file size that should be considered for deltas. Default setting: 52428800- Parameters:
bigFileThreshold- the limit, in bytes.
-
isWaitPreventRacyPack
public boolean isWaitPreventRacyPack()Get whether we wait before opening a newly written pack to prevent its lastModified timestamp could be racy- Returns:
- whether we wait before opening a newly written pack to prevent its lastModified timestamp could be racy
- Since:
- 5.1.8
-
doWaitPreventRacyPack
public boolean doWaitPreventRacyPack(long packSize) Get whether we wait before opening a newly written pack to prevent its lastModified timestamp could be racy. ReturnstrueifwaitToPreventRacyPack = trueandpackSize > minSizePreventRacyPack,falseotherwise.- Parameters:
packSize- size of the pack file- Returns:
- whether we wait before opening a newly written pack to prevent its lastModified timestamp could be racy
- Since:
- 5.1.8
-
setWaitPreventRacyPack
public void setWaitPreventRacyPack(boolean waitPreventRacyPack) Set whether we wait before opening a newly written pack to prevent its lastModified timestamp could be racy- Parameters:
waitPreventRacyPack- whether we wait before opening a newly written pack to prevent its lastModified timestamp could be racy- Since:
- 5.1.8
-
getMinSizePreventRacyPack
public long getMinSizePreventRacyPack()Get minimum packfile size for which we wait before opening a newly written pack to prevent its lastModified timestamp could be racy ifisWaitToPreventRacyPackistrue.- Returns:
- minimum packfile size, default is 100 MiB
- Since:
- 5.1.8
-
setMinSizePreventRacyPack
public void setMinSizePreventRacyPack(long minSizePreventRacyPack) Set minimum packfile size for which we wait before opening a newly written pack to prevent its lastModified timestamp could be racy ifisWaitToPreventRacyPackistrue.- Parameters:
minSizePreventRacyPack- minimum packfile size, default is 100 MiB- Since:
- 5.1.8
-
getCompressionLevel
public int getCompressionLevel()Get the compression level applied to objects in the pack. Default setting: -1- Returns:
- current compression level, see
Deflater.
-
setCompressionLevel
public void setCompressionLevel(int level) Set the compression level applied to objects in the pack. Default setting: -1- Parameters:
level- compression level, must be a valid level recognized by theDeflaterclass.
-
getThreads
public int getThreads()Get the number of threads used during delta compression. Default setting: 0 (auto-detect processors)- Returns:
- number of threads used for delta compression. 0 will auto-detect the threads to the number of available processors.
-
setThreads
public void setThreads(int threads) Set the number of threads to use for delta compression. During delta compression, if there are enough objects to be considered the writer will start up concurrent threads and allow them to compress different sections of the repository concurrently. An application thread pool can be set bysetExecutor(Executor). If not set a temporary pool will be created by the writer, and torn down automatically when compression is over. Default setting: 0 (auto-detect processors)- Parameters:
threads- number of threads to use. If <= 0 the number of available processors for this JVM is used.
-
getExecutor
Get the preferred thread pool to execute delta search on.- Returns:
- the preferred thread pool to execute delta search on.
-
setExecutor
Set the executor to use when using threads. During delta compression if the executor is non-null jobs will be queued up on it to perform delta compression in parallel. Aside from setting the executor, the caller must setsetThreads(int)to enable threaded delta search.- Parameters:
executor- executor to use for threads. Set to null to create a temporary executor just for the writer.
-
getIndexVersion
public int getIndexVersion()Get the pack index file format version this instance creates. Default setting: 2- Returns:
- the index version, the special version 0 designates the oldest (most compatible) format available for the objects.
- See Also:
-
setIndexVersion
public void setIndexVersion(int version) Set the pack index file format version this instance will create. Default setting: 2- Parameters:
version- the version to write. The special version 0 designates the oldest (most compatible) format available for the objects.- See Also:
-
isBuildBitmaps
public boolean isBuildBitmaps()True if writer is allowed to build bitmaps for indexes. Default setting: true- Returns:
- true if delta base is the writer can choose to output an index with bitmaps.
- Since:
- 3.0
-
setBuildBitmaps
public void setBuildBitmaps(boolean buildBitmaps) Set writer to allow building bitmaps for supported pack files. Index files can include bitmaps to speed up future ObjectWalks. Default setting: true- Parameters:
buildBitmaps- boolean indicating whether bitmaps may be included in the index.- Since:
- 3.0
-
getBitmapContiguousCommitCount
public int getBitmapContiguousCommitCount()Get the count of most recent commits for which to build bitmaps. Default setting: 100- Returns:
- the count of most recent commits for which to build bitmaps
- Since:
- 4.2
-
setBitmapContiguousCommitCount
public void setBitmapContiguousCommitCount(int count) Set the count of most recent commits for which to build bitmaps. Default setting: 100- Parameters:
count- the count of most recent commits for which to build bitmaps- Since:
- 4.2
-
getBitmapRecentCommitCount
public int getBitmapRecentCommitCount()Get the count at which to switch from "bitmapRecentCommitSpan" to "bitmapDistantCommitSpan". Default setting: 20000- Returns:
- the count for switching between recent and distant spans
- Since:
- 4.2
-
setBitmapRecentCommitCount
public void setBitmapRecentCommitCount(int count) Set the count at which to switch from "bitmapRecentCommitSpan" to "bitmapDistantCommitSpan". Default setting: 20000- Parameters:
count- the count for switching between recent and distant spans- Since:
- 4.2
-
getBitmapRecentCommitSpan
public int getBitmapRecentCommitSpan()Get the span of commits when building bitmaps for recent history. Default setting: 100- Returns:
- the span of commits when building bitmaps for recent history
- Since:
- 4.2
-
setBitmapRecentCommitSpan
public void setBitmapRecentCommitSpan(int span) Set the span of commits when building bitmaps for recent history. Default setting: 100- Parameters:
span- the span of commits when building bitmaps for recent history- Since:
- 4.2
-
getBitmapDistantCommitSpan
public int getBitmapDistantCommitSpan()Get the span of commits when building bitmaps for distant history. Default setting: 5000- Returns:
- the span of commits when building bitmaps for distant history
- Since:
- 4.2
-
setBitmapDistantCommitSpan
public void setBitmapDistantCommitSpan(int span) Set the span of commits when building bitmaps for distant history. Default setting: 5000- Parameters:
span- the span of commits when building bitmaps for distant history- Since:
- 4.2
-
getBitmapExcessiveBranchCount
public int getBitmapExcessiveBranchCount()Get the count of branches deemed "excessive". If the count of branches in a repository exceeds this number and bitmaps are enabled, "inactive" branches will have fewer bitmaps than "active" branches. Default setting: 100- Returns:
- the count of branches deemed "excessive"
- Since:
- 4.2
-
setBitmapExcessiveBranchCount
public void setBitmapExcessiveBranchCount(int count) Set the count of branches deemed "excessive". If the count of branches in a repository exceeds this number and bitmaps are enabled, "inactive" branches will have fewer bitmaps than "active" branches. Default setting: 100- Parameters:
count- the count of branches deemed "excessive"- Since:
- 4.2
-
getBitmapInactiveBranchAgeInDays
public int getBitmapInactiveBranchAgeInDays()Get the age in days that marks a branch as "inactive". Default setting: 90- Returns:
- the age in days that marks a branch as "inactive"
- Since:
- 4.2
-
getSearchForReuseTimeout
Get the max time to spend during the search for reuse phase. Default setting:- Returns:
- the maximum time to spend during the search for reuse phase.
- Since:
- 5.13
-
setBitmapInactiveBranchAgeInDays
public void setBitmapInactiveBranchAgeInDays(int ageInDays) Set the age in days that marks a branch as "inactive". Default setting: 90- Parameters:
ageInDays- the age in days that marks a branch as "inactive"- Since:
- 4.2
-
setSearchForReuseTimeout
Set the max time to spend during the search for reuse phase.- Parameters:
timeout- max time allowed during the search for reuse phase Default setting:- Since:
- 5.13
-
fromConfig
Update properties by setting fields from the configuration. If a property's corresponding variable is not defined in the supplied configuration, then it is left unmodified.- Parameters:
rc- configuration to read properties from.
-
toString
-