/** * Gets a default set of configuration values, in absence of any real configuration. * These configuration values are the default ones from all component configurations, except that it will * create only one container to host segments. */ public static ServiceBuilderConfig getDefaultConfig() { // All component configs should have defaults built-in, so no need to override them here. return new Builder() .include(ServiceConfig.builder().with(ServiceConfig.CONTAINER_COUNT, 1)) .build(); }
/** * Creates a ServiceBuilderConfig based on the given builder, by attaching the correct RocksDB file path based on the instance. * * @param configBuilder The ServiceBuilderConfig.Builder to base from (this builder will not be touched). * @param instanceId The instance id of the Service to build (for least interference, different instances should have * different Ids so that shared resources (i.e., RocksDB) can be setup appropriately). * @return A ServiceBuilderConfig instance. */ protected ServiceBuilderConfig getBuilderConfig(ServiceBuilderConfig.Builder configBuilder, int instanceId) { String id = Integer.toString(instanceId); return configBuilder .makeCopy() .include(ServiceConfig.builder().with(ServiceConfig.INSTANCE_ID, id)) .include(RocksDBConfig.builder().with(RocksDBConfig.DATABASE_DIR, Paths.get(getRocksDBDir().toString(), id).toString())) .build(); }
private static ServiceBuilderConfig getReadOnlyBuilderConfig() { val baseConfig = getBuilderConfig(); val props = new Properties(); baseConfig.forEach(props::put); return ServiceBuilderConfig.builder() .include(props) .include(ServiceConfig.builder() .with(ServiceConfig.READONLY_SEGMENT_STORE, true)) .build(); }
b.include(ServiceConfig.builder() .with(ServiceConfig.CONTAINER_COUNT, testConfig.getContainerCount())); b.include(BookKeeperConfig.builder()
private ServiceBuilder createReadOnlyBuilder(int instanceId) throws Exception { // Copy base config properties to a new object. val props = new Properties(); this.configBuilder.build().forEach(props::put); // Create a new config (so we don't alter the base one) and set the ReadOnlySegmentStore to true). val configBuilder = ServiceBuilderConfig.builder() .include(props) .include(ServiceConfig.builder() .with(ServiceConfig.READONLY_SEGMENT_STORE, true)); val builder = createBuilder(configBuilder, instanceId); builder.initialize(); return builder; }
private static ServiceBuilderConfig getBuilderConfig() { return ServiceBuilderConfig .builder() .include(ServiceConfig.builder() .with(ServiceConfig.CONTAINER_COUNT, 1) .with(ServiceConfig.THREAD_POOL_SIZE, 3) .with(ServiceConfig.LISTENING_PORT, TestUtils.getAvailableListenPort())) .build(); }
.include(System.getProperties()) .include(authProps) .include(ServiceConfig.builder() .with(ServiceConfig.CONTAINER_COUNT, containerCount) .with(ServiceConfig.THREAD_POOL_SIZE, THREADPOOL_SIZE)
@Test public void testListeningAndPublicIPAndPort() { ServiceConfig cfg1 = ServiceConfig.builder() .with(ServiceConfig.CONTAINER_COUNT, 1) .with(ServiceConfig.LISTENING_IP_ADDRESS, "myhost") && cfg1.getListeningPort() == cfg1.getPublishedPort()); ServiceConfig cfg2 = ServiceConfig.builder() .with(ServiceConfig.CONTAINER_COUNT, 1) .with(ServiceConfig.LISTENING_IP_ADDRESS, "myhost") && cfg2.getListeningPort() == cfg2.getPublishedPort()); ServiceConfig cfg3 = ServiceConfig.builder() .with(ServiceConfig.CONTAINER_COUNT, 1) .with(ServiceConfig.LISTENING_IP_ADDRESS, "myhost")
/** * Generates a new ServiceBuilderConfig.Builder with hardcoded defaults, in case these are not supplied via other means, * such as a config file or System Properties. */ private static ServiceBuilderConfig.Builder getDefaultServiceBuilderConfig() { return ServiceBuilderConfig .builder() .include(ServiceConfig.builder() .with(ServiceConfig.THREAD_POOL_SIZE, 80) .with(ServiceConfig.CACHE_POLICY_MAX_TIME, 600) .with(ServiceConfig.CACHE_POLICY_MAX_SIZE, 4 * 1024 * 1024 * 1024L) .with(ServiceConfig.CERT_FILE, "../config/cert.pem") .with(ServiceConfig.KEY_FILE, "../config/key.pem")) .include(DurableLogConfig.builder() .with(DurableLogConfig.CHECKPOINT_COMMIT_COUNT, 100) .with(DurableLogConfig.CHECKPOINT_MIN_COMMIT_COUNT, 100) .with(DurableLogConfig.CHECKPOINT_TOTAL_COMMIT_LENGTH, 100 * 1024 * 1024L)) .include(ReadIndexConfig.builder() .with(ReadIndexConfig.MEMORY_READ_MIN_LENGTH, 128 * 1024)) .include(ContainerConfig.builder() .with(ContainerConfig.SEGMENT_METADATA_EXPIRATION_SECONDS, ContainerConfig.MINIMUM_SEGMENT_METADATA_EXPIRATION_SECONDS) .with(ContainerConfig.MAX_ACTIVE_SEGMENT_COUNT, 500)) // This is for those tests that use BookKeeper for Tier1. .include(BookKeeperConfig.builder() .with(BookKeeperConfig.BK_LEDGER_MAX_SIZE, Integer.MAX_VALUE) .with(BookKeeperConfig.ZK_METADATA_PATH, "/pravega/selftest/segmentstore/containers") .with(BookKeeperConfig.BK_LEDGER_PATH, TestConfig.BK_LEDGER_PATH)); }
.builder() .include(ServiceConfig .builder() .with(ServiceConfig.CONTAINER_COUNT, 4) .with(ServiceConfig.THREAD_POOL_SIZE, THREADPOOL_SIZE_SEGMENT_STORE)