gpt4 book ai didi

com.twitter.distributedlog.acl.ZKAccessControlManager类的使用及代码示例

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

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

ZKAccessControlManager介绍

[英]ZooKeeper Based com.twitter.distributedlog.acl.AccessControlManager
[中]基于ZooKeeper的com。啁啾分布式日志。国际计算语言学协会。访问控制管理器

代码示例

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

private Future<Void> fetchAccessControlEntries() {
  final Promise<Void> promise = new Promise<Void>();
  fetchAccessControlEntries(promise);
  return promise;
}

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

private Future<ZKAccessControl> fetchDefaultAccessControlEntry() {
  final Promise<ZKAccessControl> promise = new Promise<ZKAccessControl>();
  fetchDefaultAccessControlEntry(promise);
  return promise;
}

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

@Override
public boolean allowDelete(String stream) {
  return !getAccessControlEntry(stream).isDenyDelete();
}

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

String stream2 = "test-acm-2";
logger.info("Creating ACL Manager for {}", zkRootPath);
ZKAccessControlManager zkcm = new ZKAccessControlManager(conf, zkc, zkRootPath, executorService);
logger.info("Created ACL Manager for {}", zkRootPath);
try {
  setACL(accessControl1);
  logger.info("Create ACL for stream {} : {}", stream1, accessControl1);
  while (zkcm.allowDelete(stream1)) {
    Thread.sleep(100);
  setACL(accessControl2);
  logger.info("Create ACL for stream {} : {}", stream2, accessControl2);
  while (zkcm.allowWrite(stream1)) {
    Thread.sleep(100);
  while (zkcm.allowTruncate(stream2)) {
    Thread.sleep(100);
  while (!zkcm.allowTruncate(stream2)) {
    Thread.sleep(100);
  while (zkcm.allowRelease(stream1)) {
    Thread.sleep(100);
  while (zkcm.allowAcquire(stream2)) {
    Thread.sleep(100);
  verifyStreamPermissions(zkcm, stream2, true, true, true, true, false);

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

static void verifyStreamPermissions(ZKAccessControlManager zkcm,
                  String stream,
                  boolean allowWrite,
                  boolean allowTruncate,
                  boolean allowRelease,
                  boolean allowDelete,
                  boolean allowAcquire) throws Exception {
  assertEquals(allowWrite, zkcm.allowWrite(stream));
  assertEquals(allowTruncate, zkcm.allowTruncate(stream));
  assertEquals(allowRelease, zkcm.allowRelease(stream));
  assertEquals(allowDelete, zkcm.allowDelete(stream));
  assertEquals(allowAcquire, zkcm.allowAcquire(stream));
}

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

@Override
public synchronized AccessControlManager createAccessControlManager() throws IOException {
  if (null == accessControlManager) {
    String aclRootPath = bkdlConfig.getACLRootPath();
    // Build the access control manager
    if (aclRootPath == null) {
      accessControlManager = DefaultAccessControlManager.INSTANCE;
      LOG.info("Created default access control manager for {}", namespace);
    } else {
      if (!isReservedStreamName(aclRootPath)) {
        throw new IOException("Invalid Access Control List Root Path : " + aclRootPath);
      }
      String zkRootPath = namespace.getPath() + "/" + aclRootPath;
      LOG.info("Creating zk based access control manager @ {} for {}",
          zkRootPath, namespace);
      accessControlManager = new ZKAccessControlManager(conf, sharedReaderZKCForDL,
          zkRootPath, scheduler);
      LOG.info("Created zk based access control manager @ {} for {}",
          zkRootPath, namespace);
    }
  }
  return accessControlManager;
}

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

this.streamEntries = new ConcurrentHashMap<String, ZKAccessControl>();
try {
  Await.result(fetchDefaultAccessControlEntry());
} catch (Throwable t) {
  if (t instanceof InterruptedException) {
  Await.result(fetchAccessControlEntries());
} catch (Throwable t) {
  if (t instanceof InterruptedException) {

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

@Override
public boolean allowRelease(String stream) {
  return !getAccessControlEntry(stream).isDenyRelease();
}

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

@Override
public boolean allowTruncate(String stream) {
  return !getAccessControlEntry(stream).isDenyTruncate();
}

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

@Override
public boolean allowWrite(String stream) {
  return !getAccessControlEntry(stream).isDenyWrite();
}

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

@Override
public boolean allowAcquire(String stream) {
  return !getAccessControlEntry(stream).isDenyAcquire();
}

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