/** {@inheritDoc} */ @Override public int getInt(Config config, String section, String subsection, String name, int defaultValue) { long val = config.getLong(section, subsection, name, defaultValue); if (Integer.MIN_VALUE <= val && val <= Integer.MAX_VALUE) { return (int) val; } throw new IllegalArgumentException(MessageFormat .format(JGitText.get().integerValueOutOfRange, section, name)); }
ReceiveConfig(Config config) { allowCreates = true; allowDeletes = !config.getBoolean("receive", "denydeletes", false); //$NON-NLS-1$ //$NON-NLS-2$ allowNonFastForwards = !config.getBoolean("receive", //$NON-NLS-1$ "denynonfastforwards", false); //$NON-NLS-1$ allowOfsDelta = config.getBoolean("repack", "usedeltabaseoffset", //$NON-NLS-1$ //$NON-NLS-2$ true); allowPushOptions = config.getBoolean("receive", "pushoptions", //$NON-NLS-1$ //$NON-NLS-2$ false); maxCommandBytes = config.getLong("receive", //$NON-NLS-1$ "maxCommandBytes", //$NON-NLS-1$ 3 << 20); maxDiscardBytes = config.getLong("receive", //$NON-NLS-1$ "maxCommandDiscardBytes", //$NON-NLS-1$ -1); signedPush = SignedPushConfig.KEY.parse(config); } }
long sft = rc.getLong( CONFIG_CORE_SECTION, CONFIG_DFS_SECTION,
/** * Update properties by setting fields from the configuration. * <p> * If a property is not defined in the configuration, then it is left * unmodified. * * @param rc * configuration to read properties from. * @return {@code this}. * @since 3.0 */ public WindowCacheConfig fromConfig(Config rc) { setPackedGitOpenFiles(rc.getInt( "core", null, "packedgitopenfiles", getPackedGitOpenFiles())); //$NON-NLS-1$ //$NON-NLS-2$ setPackedGitLimit(rc.getLong( "core", null, "packedgitlimit", getPackedGitLimit())); //$NON-NLS-1$ //$NON-NLS-2$ setPackedGitWindowSize(rc.getInt( "core", null, "packedgitwindowsize", getPackedGitWindowSize())); //$NON-NLS-1$ //$NON-NLS-2$ setPackedGitMMAP(rc.getBoolean( "core", null, "packedgitmmap", isPackedGitMMAP())); //$NON-NLS-1$ //$NON-NLS-2$ setDeltaBaseCacheLimit(rc.getInt( "core", null, "deltabasecachelimit", getDeltaBaseCacheLimit())); //$NON-NLS-1$ //$NON-NLS-2$ long maxMem = Runtime.getRuntime().maxMemory(); long sft = rc.getLong( "core", null, "streamfilethreshold", getStreamFileThreshold()); //$NON-NLS-1$ //$NON-NLS-2$ sft = Math.min(sft, maxMem / 4); // don't use more than 1/4 of the heap sft = Math.min(sft, Integer.MAX_VALUE); // cannot exceed array length setStreamFileThreshold((int) sft); return this; }
long cfgBlockLimit = rc.getLong( CONFIG_CORE_SECTION, CONFIG_DFS_SECTION,
/** * Obtain an integer value from the configuration. * * @param section * section the key is grouped within. * @param name * name of the key to get. * @param defaultValue * default value to return if no value was present. * @return an integer value from the configuration, or defaultValue. */ public long getLong(String section, String name, long defaultValue) { return getLong(section, null, name, defaultValue); }
/** {@inheritDoc} */ @Override public int getInt(Config config, String section, String subsection, String name, int defaultValue) { long val = config.getLong(section, subsection, name, defaultValue); if (Integer.MIN_VALUE <= val && val <= Integer.MAX_VALUE) { return (int) val; } throw new IllegalArgumentException(MessageFormat .format(JGitText.get().integerValueOutOfRange, section, name)); }
/** * Obtain an integer value from the configuration. * * @param section * section the key is grouped within. * @param subsection * subsection name, such a remote or branch name. * @param name * name of the key to get. * @param defaultValue * default value to return if no value was present. * @return an integer value from the configuration, or defaultValue. */ public int getInt(final String section, String subsection, final String name, final int defaultValue) { final long val = getLong(section, subsection, name, defaultValue); if (Integer.MIN_VALUE <= val && val <= Integer.MAX_VALUE) return (int) val; throw new IllegalArgumentException(MessageFormat.format(JGitText.get().integerValueOutOfRange , section, name)); }
ReceiveConfig(Config config) { allowCreates = true; allowDeletes = !config.getBoolean("receive", "denydeletes", false); //$NON-NLS-1$ //$NON-NLS-2$ allowNonFastForwards = !config.getBoolean("receive", //$NON-NLS-1$ "denynonfastforwards", false); //$NON-NLS-1$ allowOfsDelta = config.getBoolean("repack", "usedeltabaseoffset", //$NON-NLS-1$ //$NON-NLS-2$ true); allowPushOptions = config.getBoolean("receive", "pushoptions", //$NON-NLS-1$ //$NON-NLS-2$ false); maxCommandBytes = config.getLong("receive", //$NON-NLS-1$ "maxCommandBytes", //$NON-NLS-1$ 3 << 20); maxDiscardBytes = config.getLong("receive", //$NON-NLS-1$ "maxCommandDiscardBytes", //$NON-NLS-1$ -1); signedPush = SignedPushConfig.KEY.parse(config); } }
setDeltaSearchWindowSize(rc.getInt( "pack", "window", getDeltaSearchWindowSize())); //$NON-NLS-1$ //$NON-NLS-2$ setDeltaSearchMemoryLimit(rc.getLong( "pack", "windowmemory", getDeltaSearchMemoryLimit())); //$NON-NLS-1$ //$NON-NLS-2$ setDeltaCacheSize(rc.getLong( "pack", "deltacachesize", getDeltaCacheSize())); //$NON-NLS-1$ //$NON-NLS-2$ setDeltaCacheLimit(rc.getInt(
long sft = rc.getLong( CONFIG_CORE_SECTION, CONFIG_DFS_SECTION,
long sft = rc.getLong( CONFIG_CORE_SECTION, CONFIG_DFS_SECTION,
setBlockLimit(rc.getLong( CONFIG_CORE_SECTION, CONFIG_DFS_SECTION,
/** * Update properties by setting fields from the configuration. * <p> * If a property is not defined in the configuration, then it is left * unmodified. * * @param rc * configuration to read properties from. * @return {@code this}. * @since 3.0 */ public WindowCacheConfig fromConfig(Config rc) { setPackedGitOpenFiles(rc.getInt( "core", null, "packedgitopenfiles", getPackedGitOpenFiles())); //$NON-NLS-1$ //$NON-NLS-2$ setPackedGitLimit(rc.getLong( "core", null, "packedgitlimit", getPackedGitLimit())); //$NON-NLS-1$ //$NON-NLS-2$ setPackedGitWindowSize(rc.getInt( "core", null, "packedgitwindowsize", getPackedGitWindowSize())); //$NON-NLS-1$ //$NON-NLS-2$ setPackedGitMMAP(rc.getBoolean( "core", null, "packedgitmmap", isPackedGitMMAP())); //$NON-NLS-1$ //$NON-NLS-2$ setDeltaBaseCacheLimit(rc.getInt( "core", null, "deltabasecachelimit", getDeltaBaseCacheLimit())); //$NON-NLS-1$ //$NON-NLS-2$ long maxMem = Runtime.getRuntime().maxMemory(); long sft = rc.getLong( "core", null, "streamfilethreshold", getStreamFileThreshold()); //$NON-NLS-1$ //$NON-NLS-2$ sft = Math.min(sft, maxMem / 4); // don't use more than 1/4 of the heap sft = Math.min(sft, Integer.MAX_VALUE); // cannot exceed array length setStreamFileThreshold((int) sft); return this; }
long cfgBlockLimit = rc.getLong( CONFIG_CORE_SECTION, CONFIG_DFS_SECTION,
/** * Update properties by setting fields from the configuration. * <p> * If a property is not defined in the configuration, then it is left * unmodified. * * @param rc * configuration to read properties from. * @return {@code this}. * @since 3.0 */ public WindowCacheConfig fromConfig(final Config rc) { setPackedGitOpenFiles(rc.getInt( "core", null, "packedgitopenfiles", getPackedGitOpenFiles())); //$NON-NLS-1$ //$NON-NLS-2$ setPackedGitLimit(rc.getLong( "core", null, "packedgitlimit", getPackedGitLimit())); //$NON-NLS-1$ //$NON-NLS-2$ setPackedGitWindowSize(rc.getInt( "core", null, "packedgitwindowsize", getPackedGitWindowSize())); //$NON-NLS-1$ //$NON-NLS-2$ setPackedGitMMAP(rc.getBoolean( "core", null, "packedgitmmap", isPackedGitMMAP())); //$NON-NLS-1$ //$NON-NLS-2$ setDeltaBaseCacheLimit(rc.getInt( "core", null, "deltabasecachelimit", getDeltaBaseCacheLimit())); //$NON-NLS-1$ //$NON-NLS-2$ long maxMem = Runtime.getRuntime().maxMemory(); long sft = rc.getLong( "core", null, "streamfilethreshold", getStreamFileThreshold()); //$NON-NLS-1$ //$NON-NLS-2$ sft = Math.min(sft, maxMem / 4); // don't use more than 1/4 of the heap sft = Math.min(sft, Integer.MAX_VALUE); // cannot exceed array length setStreamFileThreshold((int) sft); return this; }
/** * Update properties by setting fields from the configuration. * <p> * If a property is not defined in the configuration, then it is left * unmodified. * * @param rc * configuration to read properties from. * @return {@code this} */ public DhtInserterOptions fromConfig(Config rc) { setChunkSize(rc.getInt("core", "dht", "chunkSize", getChunkSize())); setWriteBufferSize(rc.getInt("core", "dht", "writeBufferSize", getWriteBufferSize())); setCompression(rc.get(CoreConfig.KEY).getCompression()); setPrefetchDepth(rc.getInt("core", "dht", "packParserPrefetchDepth", getPrefetchDepth())); setParserCacheLimit(rc.getLong("core", "dht", "packParserCacheLimit", getParserCacheLimit())); return this; } }
/** * Update properties by setting fields from the configuration. * <p> * If a property is not defined in the configuration, then it is left * unmodified. * * @param rc * configuration to read properties from. * @return {@code this} */ public DhtInserterOptions fromConfig(Config rc) { setChunkSize(rc.getInt("core", "dht", "chunkSize", getChunkSize())); setWriteBufferSize(rc.getInt("core", "dht", "writeBufferSize", getWriteBufferSize())); setCompression(rc.get(CoreConfig.KEY).getCompression()); setPrefetchDepth(rc.getInt("core", "dht", "packParserPrefetchDepth", getPrefetchDepth())); setParserCacheLimit(rc.getLong("core", "dht", "packParserCacheLimit", getParserCacheLimit())); return this; } }
setDeltaSearchWindowSize(rc.getInt( "pack", "window", getDeltaSearchWindowSize())); //$NON-NLS-1$ //$NON-NLS-2$ setDeltaSearchMemoryLimit(rc.getLong( "pack", "windowmemory", getDeltaSearchMemoryLimit())); //$NON-NLS-1$ //$NON-NLS-2$ setDeltaCacheSize(rc.getLong( "pack", "deltacachesize", getDeltaCacheSize())); //$NON-NLS-1$ //$NON-NLS-2$ setDeltaCacheLimit(rc.getInt(
setDeltaSearchWindowSize(rc.getInt( "pack", "window", getDeltaSearchWindowSize())); //$NON-NLS-1$ //$NON-NLS-2$ setDeltaSearchMemoryLimit(rc.getLong( "pack", "windowmemory", getDeltaSearchMemoryLimit())); //$NON-NLS-1$ //$NON-NLS-2$ setDeltaCacheSize(rc.getLong( "pack", "deltacachesize", getDeltaCacheSize())); //$NON-NLS-1$ //$NON-NLS-2$ setDeltaCacheLimit(rc.getInt(