Package org.eclipse.jgit.storage.pack
Class PackConfig
- java.lang.Object
-
- org.eclipse.jgit.storage.pack.PackConfig
-
public class PackConfig extends Object
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
Fields Modifier and Type Field Description static int
DEFAULT_BIG_FILE_THRESHOLD
Default big file threshold: 52428800static int
DEFAULT_BITMAP_CONTIGUOUS_COMMIT_COUNT
Default count of most recent commits to select for bitmaps.static int
DEFAULT_BITMAP_DISTANT_COMMIT_SPAN
Default spacing between commits in distant history when selecting commits for bitmaps.static int
DEFAULT_BITMAP_EXCESSIVE_BRANCH_COUNT
Default count of branches required to activate inactive branch commit selection.static int
DEFAULT_BITMAP_INACTIVE_BRANCH_AGE_IN_DAYS
Default age at which a branch is considered inactive.static int
DEFAULT_BITMAP_RECENT_COMMIT_COUNT
Count at which the span between selected commits changes from "bitmapRecentCommitSpan" to "bitmapDistantCommitSpan".static int
DEFAULT_BITMAP_RECENT_COMMIT_SPAN
Default spacing between commits in recent history when selecting commits for bitmaps.static boolean
DEFAULT_BUILD_BITMAPS
Default value of the build bitmaps option: truestatic boolean
DEFAULT_DELTA_BASE_AS_OFFSET
Default value of delta base as offset option: falsestatic int
DEFAULT_DELTA_CACHE_LIMIT
Default delta cache limit: 100static long
DEFAULT_DELTA_CACHE_SIZE
Default delta cache size: 52428800Lstatic boolean
DEFAULT_DELTA_COMPRESS
Default value of delta compress option: truestatic int
DEFAULT_DELTA_SEARCH_WINDOW_SIZE
Default window size during packing: 10static int
DEFAULT_INDEX_VERSION
Default index version: 2static int
DEFAULT_MAX_DELTA_DEPTH
Default value of maximum delta chain depth: 50static long
DEFAULT_MINSIZE_PREVENT_RACY_PACK
Default if we wait before opening a newly written pack to prevent its lastModified timestamp could be racystatic boolean
DEFAULT_PRESERVE_OLD_PACKS
Default value of keep old packs option: falsestatic boolean
DEFAULT_PRUNE_PRESERVED
Default value of prune old packs option: falsestatic boolean
DEFAULT_REUSE_DELTAS
Default value of deltas reuse option: truestatic boolean
DEFAULT_REUSE_OBJECTS
Default value of objects reuse option: truestatic Duration
DEFAULT_SEARCH_FOR_REUSE_TIMEOUT
Default max time to spend during the search for reuse phase.static boolean
DEFAULT_WAIT_PREVENT_RACY_PACK
Default if we wait before opening a newly written pack to prevent its lastModified timestamp could be racy
-
Constructor Summary
Constructors Constructor Description PackConfig()
Create 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
doWaitPreventRacyPack(long packSize)
Get whether we wait before opening a newly written pack to prevent its lastModified timestamp could be racy.void
fromConfig(Config rc)
Update properties by setting fields from the configuration.int
getBigFileThreshold()
Get the maximum file size that will be delta compressed.int
getBitmapContiguousCommitCount()
Get the count of most recent commits for which to build bitmaps.int
getBitmapDistantCommitSpan()
Get the span of commits when building bitmaps for distant history.int
getBitmapExcessiveBranchCount()
Get the count of branches deemed "excessive".int
getBitmapInactiveBranchAgeInDays()
Get the age in days that marks a branch as "inactive".int
getBitmapRecentCommitCount()
Get the count at which to switch from "bitmapRecentCommitSpan" to "bitmapDistantCommitSpan".int
getBitmapRecentCommitSpan()
Get the span of commits when building bitmaps for recent history.int
getCompressionLevel()
Get the compression level applied to objects in the pack.boolean
getCutDeltaChains()
Whether existing delta chains should be cut atgetMaxDeltaDepth()
.int
getDeltaCacheLimit()
Maximum size in bytes of a delta to cache.long
getDeltaCacheSize()
Get the size of the in-memory delta cache.long
getDeltaSearchMemoryLimit()
Get maximum number of bytes to put into the delta search window.int
getDeltaSearchWindowSize()
Get the number of objects to try when looking for a delta base.Executor
getExecutor()
Get the preferred thread pool to execute delta search on.int
getIndexVersion()
Get the pack index file format version this instance creates.int
getMaxDeltaDepth()
Get maximum depth of delta chain set up for the writer.long
getMinSizePreventRacyPack()
Get minimum packfile size for which we wait before opening a newly written pack to prevent its lastModified timestamp could be racy ifisWaitToPreventRacyPack
istrue
.Duration
getSearchForReuseTimeout()
Get the max time to spend during the search for reuse phase.boolean
getSinglePack()
Whether all of refs/* should be packed in a single pack.int
getThreads()
Get the number of threads used during delta compression.boolean
isBuildBitmaps()
True if writer is allowed to build bitmaps for indexes.boolean
isDeltaBaseAsOffset()
True if writer can use offsets to point to a delta base.boolean
isDeltaCompress()
Check whether the writer will create new deltas on the fly.boolean
isPreserveOldPacks()
Checks whether to preserve old packs in a preserved directory Default setting: falseboolean
isPrunePreserved()
Checks whether to remove preserved pack files in a preserved directory Default setting: falseboolean
isReuseDeltas()
Check whether to reuse deltas existing in repository.boolean
isReuseObjects()
Checks whether to reuse existing objects representation in repository.boolean
isWaitPreventRacyPack()
Get whether we wait before opening a newly written pack to prevent its lastModified timestamp could be racyvoid
setBigFileThreshold(int bigFileThreshold)
Set the maximum file size that should be considered for deltas.void
setBitmapContiguousCommitCount(int count)
Set the count of most recent commits for which to build bitmaps.void
setBitmapDistantCommitSpan(int span)
Set the span of commits when building bitmaps for distant history.void
setBitmapExcessiveBranchCount(int count)
Set the count of branches deemed "excessive".void
setBitmapInactiveBranchAgeInDays(int ageInDays)
Set the age in days that marks a branch as "inactive".void
setBitmapRecentCommitCount(int count)
Set the count at which to switch from "bitmapRecentCommitSpan" to "bitmapDistantCommitSpan".void
setBitmapRecentCommitSpan(int span)
Set the span of commits when building bitmaps for recent history.void
setBuildBitmaps(boolean buildBitmaps)
Set writer to allow building bitmaps for supported pack files.void
setCompressionLevel(int level)
Set the compression level applied to objects in the pack.void
setCutDeltaChains(boolean cut)
Enable cutting existing delta chains atgetMaxDeltaDepth()
.void
setDeltaBaseAsOffset(boolean deltaBaseAsOffset)
Set writer delta base format.void
setDeltaCacheLimit(int size)
Set the maximum size of a delta that should be cached.void
setDeltaCacheSize(long size)
Set the maximum number of bytes of delta data to cache.void
setDeltaCompress(boolean deltaCompress)
Set whether or not the writer will create new deltas on the fly.void
setDeltaSearchMemoryLimit(long memoryLimit)
Set the maximum number of bytes to put into the delta search window.void
setDeltaSearchWindowSize(int objectCount)
Set the number of objects considered when searching for a delta base.void
setExecutor(Executor executor)
Set the executor to use when using threads.void
setIndexVersion(int version)
Set the pack index file format version this instance will create.void
setMaxDeltaDepth(int maxDeltaDepth)
Set up maximum depth of delta chain for the writer.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 ifisWaitToPreventRacyPack
istrue
.void
setPreserveOldPacks(boolean preserveOldPacks)
Set preserve old packs configuration option for repacking.void
setPrunePreserved(boolean prunePreserved)
Set prune preserved configuration option for repacking.void
setReuseDeltas(boolean reuseDeltas)
Set reuse deltas configuration option for the writer.void
setReuseObjects(boolean reuseObjects)
Set reuse objects configuration option for the writer.void
setSearchForReuseTimeout(Duration timeout)
Set the max time to spend during the search for reuse phase.void
setSinglePack(boolean single)
Iftrue
, packs a single GC pack for all objects reachable from refs/*.void
setThreads(int threads)
Set the number of threads to use for delta compression.void
setWaitPreventRacyPack(boolean waitPreventRacyPack)
Set whether we wait before opening a newly written pack to prevent its lastModified timestamp could be racyString
toString()
-
-
-
Field Detail
-
DEFAULT_REUSE_DELTAS
public static final boolean DEFAULT_REUSE_DELTAS
Default value of deltas reuse option: true- See Also:
setReuseDeltas(boolean)
, Constant Field Values
-
DEFAULT_REUSE_OBJECTS
public static final boolean DEFAULT_REUSE_OBJECTS
Default value of objects reuse option: true- See Also:
setReuseObjects(boolean)
, Constant Field Values
-
DEFAULT_PRESERVE_OLD_PACKS
public static final boolean DEFAULT_PRESERVE_OLD_PACKS
Default value of keep old packs option: false- Since:
- 4.7
- See Also:
setPreserveOldPacks(boolean)
, Constant Field Values
-
DEFAULT_PRUNE_PRESERVED
public static final boolean DEFAULT_PRUNE_PRESERVED
Default value of prune old packs option: false- Since:
- 4.7
- See Also:
setPrunePreserved(boolean)
, Constant Field Values
-
DEFAULT_DELTA_COMPRESS
public static final boolean DEFAULT_DELTA_COMPRESS
Default value of delta compress option: true- See Also:
setDeltaCompress(boolean)
, Constant Field Values
-
DEFAULT_DELTA_BASE_AS_OFFSET
public static final boolean DEFAULT_DELTA_BASE_AS_OFFSET
Default value of delta base as offset option: false
-
DEFAULT_MAX_DELTA_DEPTH
public static final int DEFAULT_MAX_DELTA_DEPTH
Default value of maximum delta chain depth: 50- See Also:
setMaxDeltaDepth(int)
, Constant Field Values
-
DEFAULT_DELTA_SEARCH_WINDOW_SIZE
public static final int DEFAULT_DELTA_SEARCH_WINDOW_SIZE
Default window size during packing: 10
-
DEFAULT_BIG_FILE_THRESHOLD
public static final int DEFAULT_BIG_FILE_THRESHOLD
Default big file threshold: 52428800- See Also:
setBigFileThreshold(int)
, Constant Field Values
-
DEFAULT_WAIT_PREVENT_RACY_PACK
public static final boolean DEFAULT_WAIT_PREVENT_RACY_PACK
Default if we wait before opening a newly written pack to prevent its lastModified timestamp could be racy- Since:
- 5.1.8
- See Also:
- Constant Field Values
-
DEFAULT_MINSIZE_PREVENT_RACY_PACK
public static final long DEFAULT_MINSIZE_PREVENT_RACY_PACK
Default if we wait before opening a newly written pack to prevent its lastModified timestamp could be racy- Since:
- 5.1.8
- See Also:
- Constant Field Values
-
DEFAULT_DELTA_CACHE_SIZE
public static final long DEFAULT_DELTA_CACHE_SIZE
Default delta cache size: 52428800L- See Also:
setDeltaCacheSize(long)
, Constant Field Values
-
DEFAULT_DELTA_CACHE_LIMIT
public static final int DEFAULT_DELTA_CACHE_LIMIT
Default delta cache limit: 100- See Also:
setDeltaCacheLimit(int)
, Constant Field Values
-
DEFAULT_INDEX_VERSION
public static final int DEFAULT_INDEX_VERSION
Default index version: 2- See Also:
setIndexVersion(int)
, Constant Field Values
-
DEFAULT_BUILD_BITMAPS
public static final boolean DEFAULT_BUILD_BITMAPS
Default value of the build bitmaps option: true- Since:
- 3.0
- See Also:
setBuildBitmaps(boolean)
, Constant Field Values
-
DEFAULT_BITMAP_CONTIGUOUS_COMMIT_COUNT
public static final int DEFAULT_BITMAP_CONTIGUOUS_COMMIT_COUNT
Default count of most recent commits to select for bitmaps. Only applies when bitmaps are enabled: 100- Since:
- 4.2
- See Also:
setBitmapContiguousCommitCount(int)
, Constant Field Values
-
DEFAULT_BITMAP_RECENT_COMMIT_COUNT
public static final int DEFAULT_BITMAP_RECENT_COMMIT_COUNT
Count at which the span between selected commits changes from "bitmapRecentCommitSpan" to "bitmapDistantCommitSpan". Only applies when bitmaps are enabled: 20000- Since:
- 4.2
- See Also:
setBitmapRecentCommitCount(int)
, Constant Field Values
-
DEFAULT_BITMAP_RECENT_COMMIT_SPAN
public static final int DEFAULT_BITMAP_RECENT_COMMIT_SPAN
Default spacing between commits in recent history when selecting commits for bitmaps. Only applies when bitmaps are enabled: 100- Since:
- 4.2
- See Also:
setBitmapRecentCommitSpan(int)
, Constant Field Values
-
DEFAULT_BITMAP_DISTANT_COMMIT_SPAN
public static final int DEFAULT_BITMAP_DISTANT_COMMIT_SPAN
Default spacing between commits in distant history when selecting commits for bitmaps. Only applies when bitmaps are enabled: 5000- Since:
- 4.2
- See Also:
setBitmapDistantCommitSpan(int)
, Constant Field Values
-
DEFAULT_BITMAP_EXCESSIVE_BRANCH_COUNT
public static final int DEFAULT_BITMAP_EXCESSIVE_BRANCH_COUNT
Default 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:
setBitmapExcessiveBranchCount(int)
, Constant Field Values
-
DEFAULT_BITMAP_INACTIVE_BRANCH_AGE_IN_DAYS
public static final int DEFAULT_BITMAP_INACTIVE_BRANCH_AGE_IN_DAYS
Default 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:
setBitmapInactiveBranchAgeInDays(int)
, Constant Field Values
-
DEFAULT_SEARCH_FOR_REUSE_TIMEOUT
public static final Duration 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:
setSearchForReuseTimeout(Duration)
-
-
Constructor Detail
-
PackConfig
public PackConfig()
Create a default configuration.
-
PackConfig
public PackConfig(Repository db)
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
public PackConfig(Config cfg)
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
public PackConfig(PackConfig cfg)
Copy an existing configuration to a new instance.- Parameters:
cfg
- the source configuration to copy from.
-
-
Method Detail
-
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. Returnstrue
ifwaitToPreventRacyPack = true
andpackSize > minSizePreventRacyPack
,false
otherwise.- 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 ifisWaitToPreventRacyPack
istrue
.- 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 ifisWaitToPreventRacyPack
istrue
.- 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 theDeflater
class.
-
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
public Executor getExecutor()
Get the preferred thread pool to execute delta search on.- Returns:
- the preferred thread pool to execute delta search on.
-
setExecutor
public void setExecutor(Executor executor)
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:
PackIndexWriter
-
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:
PackIndexWriter
-
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
public Duration 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
public void setSearchForReuseTimeout(Duration timeout)
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
public void fromConfig(Config rc)
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.
-
-