public class PackConfig extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BIG_FILE_THRESHOLD
Default big file threshold: 52428800
|
static 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: true
|
static boolean |
DEFAULT_DELTA_BASE_AS_OFFSET
Default value of delta base as offset option: false
|
static int |
DEFAULT_DELTA_CACHE_LIMIT
Default delta cache limit: 100
|
static long |
DEFAULT_DELTA_CACHE_SIZE
Default delta cache size: 52428800L
|
static boolean |
DEFAULT_DELTA_COMPRESS
Default value of delta compress option: true
|
static int |
DEFAULT_DELTA_SEARCH_WINDOW_SIZE
Default window size during packing: 10
|
static int |
DEFAULT_INDEX_VERSION
Default index version: 2
|
static int |
DEFAULT_MAX_DELTA_DEPTH
Default value of maximum delta chain depth: 50
|
static long |
DEFAULT_MINSIZE_PREVENT_RACY_PACK
Default if we wait before opening a newly written pack to prevent its
lastModified timestamp could be racy
|
static boolean |
DEFAULT_PRESERVE_OLD_PACKS
Default value of keep old packs option: false
|
static boolean |
DEFAULT_PRUNE_PRESERVED
Default value of prune old packs option: false
|
static boolean |
DEFAULT_REUSE_DELTAS
Default value of deltas reuse option: true
|
static boolean |
DEFAULT_REUSE_OBJECTS
Default value of objects reuse option: true
|
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 and Description |
---|
PackConfig()
Create a default configuration.
|
PackConfig(Config cfg)
Create a configuration honoring settings in a
Config . |
PackConfig(PackConfig cfg)
Copy an existing configuration to a new instance.
|
PackConfig(Repository db)
Create a configuration honoring the repository's settings.
|
Modifier and Type | Method and 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 at
getMaxDeltaDepth() . |
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 if
isWaitToPreventRacyPack is true . |
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: false
|
boolean |
isPrunePreserved()
Checks whether to remove preserved pack files in a preserved directory
Default setting: false
|
boolean |
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 racy
|
void |
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 at
getMaxDeltaDepth() . |
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 if
isWaitToPreventRacyPack is true . |
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 |
setSinglePack(boolean single)
If
true , 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 racy
|
String |
toString() |
public static final boolean DEFAULT_REUSE_DELTAS
setReuseDeltas(boolean)
,
Constant Field Valuespublic static final boolean DEFAULT_REUSE_OBJECTS
setReuseObjects(boolean)
,
Constant Field Valuespublic static final boolean DEFAULT_PRESERVE_OLD_PACKS
setPreserveOldPacks(boolean)
,
Constant Field Valuespublic static final boolean DEFAULT_PRUNE_PRESERVED
setPrunePreserved(boolean)
,
Constant Field Valuespublic static final boolean DEFAULT_DELTA_COMPRESS
setDeltaCompress(boolean)
,
Constant Field Valuespublic static final boolean DEFAULT_DELTA_BASE_AS_OFFSET
public static final int DEFAULT_MAX_DELTA_DEPTH
setMaxDeltaDepth(int)
,
Constant Field Valuespublic static final int DEFAULT_DELTA_SEARCH_WINDOW_SIZE
public static final int DEFAULT_BIG_FILE_THRESHOLD
setBigFileThreshold(int)
,
Constant Field Valuespublic static final boolean DEFAULT_WAIT_PREVENT_RACY_PACK
public static final long DEFAULT_MINSIZE_PREVENT_RACY_PACK
public static final long DEFAULT_DELTA_CACHE_SIZE
setDeltaCacheSize(long)
,
Constant Field Valuespublic static final int DEFAULT_DELTA_CACHE_LIMIT
setDeltaCacheLimit(int)
,
Constant Field Valuespublic static final int DEFAULT_INDEX_VERSION
setIndexVersion(int)
,
Constant Field Valuespublic static final boolean DEFAULT_BUILD_BITMAPS
setBuildBitmaps(boolean)
,
Constant Field Valuespublic static final int DEFAULT_BITMAP_CONTIGUOUS_COMMIT_COUNT
setBitmapContiguousCommitCount(int)
,
Constant Field Valuespublic static final int DEFAULT_BITMAP_RECENT_COMMIT_COUNT
setBitmapRecentCommitCount(int)
,
Constant Field Valuespublic static final int DEFAULT_BITMAP_RECENT_COMMIT_SPAN
setBitmapRecentCommitSpan(int)
,
Constant Field Valuespublic static final int DEFAULT_BITMAP_DISTANT_COMMIT_SPAN
setBitmapDistantCommitSpan(int)
,
Constant Field Valuespublic static final int DEFAULT_BITMAP_EXCESSIVE_BRANCH_COUNT
setBitmapExcessiveBranchCount(int)
,
Constant Field Valuespublic static final int DEFAULT_BITMAP_INACTIVE_BRANCH_AGE_IN_DAYS
setBitmapInactiveBranchAgeInDays(int)
,
Constant Field Valuespublic PackConfig()
public PackConfig(Repository db)
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(Config cfg)
Config
.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(PackConfig cfg)
cfg
- the source configuration to copy from.public boolean isReuseDeltas()
public void setReuseDeltas(boolean reuseDeltas)
reuseDeltas
- boolean indicating whether or not try to reuse deltas.public boolean isReuseObjects()
public void setReuseObjects(boolean reuseObjects)
reuseObjects
- boolean indicating whether or not writer should reuse existing
objects representation.public boolean isPreserveOldPacks()
public void setPreserveOldPacks(boolean preserveOldPacks)
preserveOldPacks
- boolean indicating whether or not preserve old pack filespublic boolean isPrunePreserved()
public void setPrunePreserved(boolean prunePreserved)
prunePreserved
- boolean indicating whether or not preserve old pack filespublic boolean isDeltaBaseAsOffset()
public void setDeltaBaseAsOffset(boolean deltaBaseAsOffset)
deltaBaseAsOffset
- boolean indicating whether delta base can be stored as an
offset.public boolean isDeltaCompress()
isReuseDeltas()
is false, or no suitable delta is
available for reuse.public void setDeltaCompress(boolean deltaCompress)
deltaCompress
- true to create deltas when isReuseDeltas()
is false,
or when a suitable delta isn't available for reuse. Set to
false to write whole objects instead.public int getMaxDeltaDepth()
public void setMaxDeltaDepth(int maxDeltaDepth)
maxDeltaDepth
- maximum delta chain depth.public boolean getCutDeltaChains()
getMaxDeltaDepth()
.getMaxDeltaDepth()
. Default is false, allowing existing
chains to be of any length.public void setCutDeltaChains(boolean cut)
getMaxDeltaDepth()
.
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.cut
- true to cut existing chains.public boolean getSinglePack()
public void setSinglePack(boolean single)
true
, 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.single
- true to pack a single GC pack rather than GC and GC_REST packspublic int getDeltaSearchWindowSize()
public void setDeltaSearchWindowSize(int objectCount)
objectCount
- number of objects to search at once. Must be at least 2.public long getDeltaSearchMemoryLimit()
getDeltaSearchWindowSize()
objects.
This limit is per thread, if 4 threads are used the actual memory limit
will be 4 times this value.public void setDeltaSearchMemoryLimit(long memoryLimit)
getDeltaSearchWindowSize()
the
window size is temporarily lowered.memoryLimit
- Maximum number of bytes to load at once, 0 for unlimited.public long getDeltaCacheSize()
public void setDeltaCacheSize(long size)
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.public int getDeltaCacheLimit()
public void setDeltaCacheLimit(int size)
getDeltaCacheSize()
maximum limit. This speeds up writing
by allowing these cached deltas to be output as-is.
Default setting: 100size
- maximum size (in bytes) of a delta to be cached.public int getBigFileThreshold()
public void setBigFileThreshold(int bigFileThreshold)
bigFileThreshold
- the limit, in bytes.public boolean isWaitPreventRacyPack()
public boolean doWaitPreventRacyPack(long packSize)
true
if
waitToPreventRacyPack = true
and
packSize > minSizePreventRacyPack
, false
otherwise.packSize
- size of the pack filepublic void setWaitPreventRacyPack(boolean waitPreventRacyPack)
waitPreventRacyPack
- whether we wait before opening a newly written pack to prevent
its lastModified timestamp could be racypublic long getMinSizePreventRacyPack()
isWaitToPreventRacyPack
is true
.public void setMinSizePreventRacyPack(long minSizePreventRacyPack)
isWaitToPreventRacyPack
is true
.minSizePreventRacyPack
- minimum packfile size, default is 100 MiBpublic int getCompressionLevel()
Deflater
.public void setCompressionLevel(int level)
level
- compression level, must be a valid level recognized by the
Deflater
class.public int getThreads()
public void setThreads(int threads)
setExecutor(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)threads
- number of threads to use. If <= 0 the number of available
processors for this JVM is used.public Executor getExecutor()
public void setExecutor(Executor executor)
setThreads(int)
to enable threaded
delta search.executor
- executor to use for threads. Set to null to create a temporary
executor just for the writer.public int getIndexVersion()
PackIndexWriter
public void setIndexVersion(int version)
version
- the version to write. The special version 0 designates the
oldest (most compatible) format available for the objects.PackIndexWriter
public boolean isBuildBitmaps()
public void setBuildBitmaps(boolean buildBitmaps)
buildBitmaps
- boolean indicating whether bitmaps may be included in the
index.public int getBitmapContiguousCommitCount()
public void setBitmapContiguousCommitCount(int count)
count
- the count of most recent commits for which to build bitmapspublic int getBitmapRecentCommitCount()
public void setBitmapRecentCommitCount(int count)
count
- the count for switching between recent and distant spanspublic int getBitmapRecentCommitSpan()
public void setBitmapRecentCommitSpan(int span)
span
- the span of commits when building bitmaps for recent historypublic int getBitmapDistantCommitSpan()
public void setBitmapDistantCommitSpan(int span)
span
- the span of commits when building bitmaps for distant historypublic int getBitmapExcessiveBranchCount()
public void setBitmapExcessiveBranchCount(int count)
count
- the count of branches deemed "excessive"public int getBitmapInactiveBranchAgeInDays()
public void setBitmapInactiveBranchAgeInDays(int ageInDays)
ageInDays
- the age in days that marks a branch as "inactive"public void fromConfig(Config rc)
rc
- configuration to read properties from.Copyright © 2020 Eclipse JGit Project. All rights reserved.