Tabnine Logo
BookKeeperConfig.builder
Code IndexAdd Tabnine to your IDE (free)

How to use
builder
method
in
io.pravega.segmentstore.storage.impl.bookkeeper.BookKeeperConfig

Best Java code snippets using io.pravega.segmentstore.storage.impl.bookkeeper.BookKeeperConfig.builder (Showing top 11 results out of 315)

origin: pravega/pravega

  @Test
  public void testZkHierarchyDepth() {
    AssertExtensions.assertThrows("BookKeeperConfig did not throw InvalidPropertyValueException",
        () -> BookKeeperConfig.builder()
            .with(BookKeeperConfig.ZK_HIERARCHY_DEPTH, -1)
            .build(),
        ex -> ex instanceof InvalidPropertyValueException);
  }
}
origin: pravega/pravega

.builder()
.with(BookKeeperConfig.ZK_ADDRESS, "localhost:" + BK_PORT.get())
.with(BookKeeperConfig.MAX_WRITE_ATTEMPTS, MAX_WRITE_ATTEMPTS)
origin: pravega/pravega

@Test
public void testQuorumSize() {
  AssertExtensions.assertThrows("BookKeeperConfig did not throw InvalidPropertyValueException",
      () -> BookKeeperConfig.builder()
          .with(BookKeeperConfig.BK_ACK_QUORUM_SIZE, 3)
          .with(BookKeeperConfig.BK_WRITE_QUORUM_SIZE, 2)
          .build(),
      ex -> ex instanceof InvalidPropertyValueException);
}
origin: pravega/pravega

/**
 * Tests the BookKeeperLogFactory and its initialization.
 */
@Test
public void testFactoryInitialize() {
  BookKeeperConfig bkConfig = BookKeeperConfig
      .builder()
      .with(BookKeeperConfig.ZK_ADDRESS, "localhost:" + BK_PORT.get())
      .with(BookKeeperConfig.BK_LEDGER_MAX_SIZE, WRITE_MAX_LENGTH * 10) // Very frequent rollovers.
      .with(BookKeeperConfig.ZK_METADATA_PATH, this.zkClient.get().getNamespace())
      .build();
  @Cleanup
  val factory = new BookKeeperLogFactory(bkConfig, this.zkClient.get(), executorService());
  AssertExtensions.assertThrows("",
      factory::initialize,
      ex -> ex instanceof DataLogNotAvailableException &&
          ex.getCause() instanceof BKException.ZKException
  );
}
origin: pravega/pravega

@Test
public void testZkServers() {
  // When multiple servers are specified and separated by comma, it should replace it by semicolon
  BookKeeperConfig cfg1 = BookKeeperConfig.builder()
      .with(BookKeeperConfig.ZK_ADDRESS, "foo:12345,bar:54321")
      .build();
  Assert.assertEquals("foo:12345;bar:54321", cfg1.getZkAddress());
  // No changes should be made to the following configs
  BookKeeperConfig cfg2 = BookKeeperConfig.builder()
      .with(BookKeeperConfig.ZK_ADDRESS, "foo:12345")
      .build();
  Assert.assertEquals("foo:12345", cfg2.getZkAddress());
  BookKeeperConfig cfg3 = BookKeeperConfig.builder()
      .with(BookKeeperConfig.ZK_ADDRESS, "10.20.30.40:12345;bar:2181")
      .build();
  Assert.assertEquals("10.20.30.40:12345;bar:2181", cfg3.getZkAddress());
}
origin: pravega/pravega

b.include(ServiceConfig.builder()
            .with(ServiceConfig.CONTAINER_COUNT, testConfig.getContainerCount()));
b.include(BookKeeperConfig.builder()
             .with(BookKeeperConfig.ZK_ADDRESS, TestConfig.LOCALHOST + ":" + testConfig.getZkPort())
             .with(BookKeeperConfig.BK_ACK_QUORUM_SIZE, bkWriteQuorum)
origin: pravega/pravega

.builder()
.with(BookKeeperConfig.ZK_ADDRESS, "localhost:" + zkPort)
.with(BookKeeperConfig.ZK_METADATA_PATH, logMetaNamespace)
origin: pravega/pravega

/**
 * Creates a new Context to be used by the BookKeeper command.
 *
 * @return A new Context.
 * @throws DurableDataLogException If the BookKeeperLogFactory could not be initialized.
 */
protected Context createContext() throws DurableDataLogException {
  val serviceConfig = getServiceConfig();
  val bkConfig = getCommandArgs().getState().getConfigBuilder()
                  .include(BookKeeperConfig.builder().with(BookKeeperConfig.ZK_ADDRESS, serviceConfig.getZkURL()))
                  .build().getConfig(BookKeeperConfig::builder);
  val zkClient = createZKClient();
  val factory = new BookKeeperLogFactory(bkConfig, zkClient, getCommandArgs().getState().getExecutor());
  try {
    factory.initialize();
  } catch (DurableDataLogException ex) {
    zkClient.close();
    throw ex;
  }
  val bkAdmin = new BookKeeperAdmin(factory.getBookKeeperClient());
  return new Context(serviceConfig, bkConfig, zkClient, factory, bkAdmin);
}
origin: pravega/pravega

/**
 * Creates a new Context to be used by the BookKeeper command.
 *
 * @return A new Context.
 * @throws DurableDataLogException If the BookKeeperLogFactory could not be initialized.
 */
@Override
protected Context createContext() throws DurableDataLogException {
  val serviceConfig = getServiceConfig();
  val containerConfig = getCommandArgs().getState().getConfigBuilder().build().getConfig(ContainerConfig::builder);
  val bkConfig = getCommandArgs().getState().getConfigBuilder()
                  .include(BookKeeperConfig.builder().with(BookKeeperConfig.ZK_ADDRESS, serviceConfig.getZkURL()))
                  .build().getConfig(BookKeeperConfig::builder);
  val zkClient = createZKClient();
  val factory = new BookKeeperLogFactory(bkConfig, zkClient, getCommandArgs().getState().getExecutor());
  try {
    factory.initialize();
  } catch (DurableDataLogException ex) {
    zkClient.close();
    throw ex;
  }
  val bkAdmin = new BookKeeperAdmin(factory.getBookKeeperClient());
  return new Context(serviceConfig, containerConfig, bkConfig, zkClient, factory, bkAdmin);
}
origin: pravega/pravega

/**
 * 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));
}
origin: pravega/pravega

@Test
public void testDefaultValues() {
  BookKeeperConfig cfg = BookKeeperConfig.builder()
      .build();
  Assert.assertEquals("localhost:2181", cfg.getZkAddress());
  Assert.assertEquals(Duration.ofMillis(10000), cfg.getZkSessionTimeout());
  Assert.assertEquals(Duration.ofMillis(10000), cfg.getZkConnectionTimeout());
  Assert.assertEquals("/segmentstore/containers", cfg.getZkMetadataPath());
  Assert.assertEquals(2, cfg.getZkHierarchyDepth());
  Assert.assertEquals(5, cfg.getMaxWriteAttempts());
  Assert.assertEquals(3, cfg.getBkEnsembleSize());
  Assert.assertEquals(2, cfg.getBkAckQuorumSize());
  Assert.assertEquals(3, cfg.getBkWriteQuorumSize());
  Assert.assertEquals(5000, cfg.getBkWriteTimeoutMillis());
  Assert.assertEquals(5000, cfg.getBkReadTimeoutMillis());
  Assert.assertEquals(1024 * 1024 * 1024, cfg.getBkLedgerMaxSize());
  Assert.assertEquals(0, cfg.getBKPassword().length);
  Assert.assertEquals("", cfg.getBkLedgerPath());
  Assert.assertEquals(false, cfg.isTLSEnabled());
  Assert.assertEquals("config/client.truststore.jks", cfg.getTlsTrustStore());
  Assert.assertEquals("", cfg.getTlsTrustStorePasswordPath());
}
io.pravega.segmentstore.storage.impl.bookkeeperBookKeeperConfigbuilder

Javadoc

Creates a new ConfigBuilder that can be used to create instances of this class.

Popular methods of BookKeeperConfig

  • getBKPassword
    Gets a value representing the Password to use for the creation and access of each BK Ledger.
  • getBkAckQuorumSize
  • getBkEnsembleSize
  • getBkLedgerMaxSize
  • getBkLedgerPath
  • getBkReadTimeoutMillis
  • getBkWriteQuorumSize
  • getBkWriteTimeoutMillis
  • getMaxWriteAttempts
  • getTlsTrustStore
  • getTlsTrustStorePasswordPath
  • getZkAddress
  • getTlsTrustStorePasswordPath,
  • getZkAddress,
  • getZkConnectionTimeout,
  • getZkHierarchyDepth,
  • getZkMetadataPath,
  • isTLSEnabled,
  • getZkSessionTimeout

Popular in Java

  • Making http post requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • getResourceAsStream (ClassLoader)
  • notifyDataSetChanged (ArrayAdapter)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • BoxLayout (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now