use of com.yahoo.binaryprefix.BinaryScaledAmount in project vespa by vespa-engine.
the class SearchChains method setCacheSizeForHttpProviders.
private void setCacheSizeForHttpProviders(BinaryScaledAmount totalProviderCacheSize) {
double totalCacheWeight = 0;
for (HttpProvider provider : httpProviders()) {
totalCacheWeight += provider.getCacheWeight();
}
final BinaryScaledAmount cacheUnit = totalProviderCacheSize.divide(totalCacheWeight);
for (HttpProvider provider : httpProviders()) {
provider.setCacheSize(cacheUnit.multiply(provider.getCacheWeight()));
}
}
use of com.yahoo.binaryprefix.BinaryScaledAmount in project vespa by vespa-engine.
the class SearchChainsTestBase method setupSearchChains.
@Before
public void setupSearchChains() {
SearchChains searchChains = new DomSearchChainsBuilder().build(root, servicesXml());
searchChains.initialize(MockSearchClusters.twoMockClusterSpecsByName(root), new BinaryScaledAmount(100, BinaryPrefix.mega));
root.freezeModelTopology();
}
use of com.yahoo.binaryprefix.BinaryScaledAmount in project vespa by vespa-engine.
the class BinaryScaledAmountParser method parse.
public static BinaryScaledAmount parse(String valueString) {
Matcher matcher = pattern.matcher(valueString);
if (!matcher.matches()) {
throw new RuntimeException("Pattern and schema is out of sync.");
}
double amount = Double.valueOf(matcher.group(1));
String binaryPrefixString = matcher.group(3);
return new BinaryScaledAmount(amount, asBinaryPrefix(binaryPrefixString));
}
Aggregations