gpt4 book ai didi

com.twitter.distributedlog.impl.metadata.ZKLogMetadataForWriter.getAllocationData()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 11:06:00 27 4
gpt4 key购买 nike

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

ZKLogMetadataForWriter.getAllocationData介绍

暂无

代码示例

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

LedgerAllocator createLedgerAllocator(ZKLogMetadataForWriter logMetadata) throws IOException {
  LedgerAllocator ledgerAllocatorDelegator;
  if (!dynConf.getEnableLedgerAllocatorPool()) {
    QuorumConfigProvider quorumConfigProvider =
        new DynamicQuorumConfigProvider(dynConf);
    LedgerAllocator allocator = new SimpleLedgerAllocator(
        logMetadata.getAllocationPath(),
        logMetadata.getAllocationData(),
        quorumConfigProvider,
        writerZKC,
        writerBKC);
    ledgerAllocatorDelegator = new LedgerAllocatorDelegator(allocator, true);
  } else {
    ledgerAllocatorDelegator = ledgerAllocator;
  }
  return ledgerAllocatorDelegator;
}

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

@SuppressWarnings("unchecked")
@Test(timeout = 60000)
public void testProcessLogMetadatasNoAllocatorPath() throws Exception {
  String rootPath = "/test-missing-version";
  URI uri = DLMTestUtil.createDLMURI(2181, rootPath);
  String logName = "test-log";
  String logIdentifier = "<default>";
  Versioned<byte[]> maxTxnIdData =
      new Versioned<byte[]>(DLUtils.serializeTransactionId(1L), new ZkVersion(1));
  Versioned<byte[]> logSegmentsData =
      new Versioned<byte[]>(DLUtils.serializeLogSegmentSequenceNumber(1L), new ZkVersion(1));
  List<Versioned<byte[]>> metadatas = Lists.newArrayList(
      new Versioned<byte[]>(null, null),
      new Versioned<byte[]>(null, null),
      maxTxnIdData,
      new Versioned<byte[]>(ZKLogMetadataForWriter.intToBytes(ZKLogMetadata.LAYOUT_VERSION), null),
      new Versioned<byte[]>(new byte[0], new ZkVersion(1)),
      new Versioned<byte[]>(new byte[0], new ZkVersion(1)),
      logSegmentsData);
  ZKLogMetadataForWriter metadata =
      ZKLogMetadataForWriter.processLogMetadatas(uri, logName, logIdentifier, metadatas, false);
  assertTrue(maxTxnIdData == metadata.getMaxTxIdData());
  assertTrue(logSegmentsData == metadata.getMaxLSSNData());
  assertNull(metadata.getAllocationData().getValue());
  assertNull(metadata.getAllocationData().getVersion());
}

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

Versioned<byte[]> allocationData = logMetadata.getAllocationData();
assertEquals(0, allocationData.getValue().length);

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

@SuppressWarnings("unchecked")
  @Test(timeout = 60000)
  public void testProcessLogMetadatasAllocatorPath() throws Exception {
    String rootPath = "/test-missing-version";
    URI uri = DLMTestUtil.createDLMURI(2181, rootPath);
    String logName = "test-log";
    String logIdentifier = "<default>";
    Versioned<byte[]> maxTxnIdData =
        new Versioned<byte[]>(DLUtils.serializeTransactionId(1L), new ZkVersion(1));
    Versioned<byte[]> logSegmentsData =
        new Versioned<byte[]>(DLUtils.serializeLogSegmentSequenceNumber(1L), new ZkVersion(1));
    Versioned<byte[]> allocationData =
        new Versioned<byte[]>(DLUtils.ledgerId2Bytes(1L), new ZkVersion(1));
    List<Versioned<byte[]>> metadatas = Lists.newArrayList(
        new Versioned<byte[]>(null, null),
        new Versioned<byte[]>(null, null),
        maxTxnIdData,
        new Versioned<byte[]>(ZKLogMetadataForWriter.intToBytes(ZKLogMetadata.LAYOUT_VERSION), null),
        new Versioned<byte[]>(new byte[0], new ZkVersion(1)),
        new Versioned<byte[]>(new byte[0], new ZkVersion(1)),
        logSegmentsData,
        allocationData);
    ZKLogMetadataForWriter metadata =
        ZKLogMetadataForWriter.processLogMetadatas(uri, logName, logIdentifier, metadatas, true);
    assertTrue(maxTxnIdData == metadata.getMaxTxIdData());
    assertTrue(logSegmentsData == metadata.getMaxLSSNData());
    assertTrue(allocationData == metadata.getAllocationData());
  }
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com