public class DfsBlockCacheConfig extends Object
DfsBlockCache
.Modifier and Type | Field and Description |
---|---|
static int |
KB
1024 (number of bytes in one kibibyte/kilobyte)
|
static int |
MB
1024
KB (number of bytes in one mebibyte/megabyte) |
Constructor and Description |
---|
DfsBlockCacheConfig()
Create a default configuration.
|
Modifier and Type | Method and Description |
---|---|
DfsBlockCacheConfig |
fromConfig(Config rc)
Update properties by setting fields from the configuration.
|
long |
getBlockLimit()
Get maximum number bytes of heap memory to dedicate to caching pack file
data.
|
int |
getBlockSize()
Get size in bytes of a single window mapped or read in from the pack
file.
|
int |
getConcurrencyLevel()
Get the estimated number of threads concurrently accessing the cache.
|
Consumer<Long> |
getRefLockWaitTimeConsumer()
Get the consumer of the object reference lock wait time in milliseconds.
|
double |
getStreamRatio()
Get highest percentage of
getBlockLimit() a single pack can
occupy while being copied by the pack reuse strategy. |
DfsBlockCacheConfig |
setBlockLimit(long newLimit)
Set maximum number bytes of heap memory to dedicate to caching pack file
data.
|
DfsBlockCacheConfig |
setBlockSize(int newSize)
Set size in bytes of a single window read in from the pack file.
|
DfsBlockCacheConfig |
setConcurrencyLevel(int newConcurrencyLevel)
Set the estimated number of threads concurrently accessing the cache.
|
DfsBlockCacheConfig |
setRefLockWaitTimeConsumer(Consumer<Long> c)
Set the consumer for lock wait time.
|
DfsBlockCacheConfig |
setStreamRatio(double ratio)
Set percentage of cache to occupy with a copied pack.
|
public static final int KB
public static final int MB
KB
(number of bytes in one mebibyte/megabyte)public long getBlockLimit()
public DfsBlockCacheConfig setBlockLimit(long newLimit)
It is strongly recommended to set the block limit to be an integer multiple
of the block size. This constraint is not enforced by this method (since
it may be called before setBlockSize(int)
), but it is enforced by
fromConfig(Config)
.
newLimit
- maximum number bytes of heap memory to dedicate to caching
pack file data; must be positive.this
public int getBlockSize()
public DfsBlockCacheConfig setBlockSize(int newSize)
newSize
- size in bytes of a single window read in from the pack file.
The value must be a power of 2.this
public int getConcurrencyLevel()
public DfsBlockCacheConfig setConcurrencyLevel(int newConcurrencyLevel)
newConcurrencyLevel
- the estimated number of threads concurrently accessing the
cache.this
public double getStreamRatio()
getBlockLimit()
a single pack can
occupy while being copied by the pack reuse strategy.getBlockLimit()
a single pack can
occupy while being copied by the pack reuse strategy. Default
is 0.30, or 30%.public DfsBlockCacheConfig setStreamRatio(double ratio)
ratio
- percentage of cache to occupy with a copied pack.this
public Consumer<Long> getRefLockWaitTimeConsumer()
public DfsBlockCacheConfig setRefLockWaitTimeConsumer(Consumer<Long> c)
c
- consumer of wait time in milliseconds.this
public DfsBlockCacheConfig fromConfig(Config rc)
If a property is not defined in the configuration, then it is left unmodified.
Enforces certain constraints on the combination of settings in the config, for example that the block limit is a multiple of the block size.
rc
- configuration to read properties from.this
Copyright © 2020 Eclipse JGit Project. All rights reserved.