com.twitter.distributedlog.impl.ZKLogMetadataStore类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中com.twitter.distributedlog.impl.ZKLogMetadataStore类的一些代码示例,展示了ZKLogMetadataStore类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKLogMetadataStore类的具体详情如下:
包路径:com.twitter.distributedlog.impl.ZKLogMetadataStore
类名称:ZKLogMetadataStore

ZKLogMetadataStore介绍

[英]ZooKeeper based log metadata store
[中]基于ZooKeeper的日志元数据存储

代码示例

代码示例来源:origin: twitter/distributedlog

static interface ZooKeeperClientHandler<T> {
  T handle(ZooKeeperClient zkc) throws IOException;
}

代码示例来源:origin: twitter/distributedlog

@Test(timeout = 60000)
public void testCreateLog() throws Exception {
  assertEquals(uri, FutureUtils.result(metadataStore.createLog("test")));
}

代码示例来源:origin: twitter/distributedlog

@Test(timeout = 60000)
public void testGetLogLocation() throws Exception {
  Optional<URI> uriOptional = FutureUtils.result(metadataStore.getLogLocation("test"));
  assertTrue(uriOptional.isPresent());
  assertEquals(uri, uriOptional.get());
}

代码示例来源:origin: twitter/distributedlog

@Test(timeout = 60000)
  public void testGetLogs() throws Exception {
    Set<String> logs = Sets.newHashSet();
    for (int i = 0; i < 10; i++) {
      String logName = "test-" + i;
      logs.add(logName);
      createLogInNamespace(uri, logName);
    }
    Set<String> result = Sets.newHashSet(FutureUtils.result(metadataStore.getLogs()));
    assertEquals(10, result.size());
    assertTrue(Sets.difference(logs, result).isEmpty());
  }
}

代码示例来源:origin: twitter/distributedlog

@Before
public void setup() throws Exception {
  zkc = TestZooKeeperClientBuilder.newBuilder()
      .uri(createDLMURI("/"))
      .sessionTimeoutMs(zkSessionTimeoutMs)
      .build();
  scheduler = OrderedScheduler.newBuilder()
      .name("test-zk-logmetadata-store")
      .corePoolSize(1)
      .build();
  DistributedLogConfiguration conf = new DistributedLogConfiguration();
  conf.addConfiguration(baseConf);
  this.uri = createDLMURI("/" + runtime.getMethodName());
  metadataStore = new ZKLogMetadataStore(conf, uri, zkc, scheduler);
}

相关文章

ZKLogMetadataStore类方法