ZooKeeper Zookeeper::getAcl
(PECL zookeeper >= 0.1.0)
Zookeeper::getAcl — 노드와 연결된 acl을 동기적으로 가져옵니다.
설명
public Zookeeper::getAcl(string $path
): array
매개변수
path
- 노드의 이름입니다. 노드의 상위 항목을 구분하는 슬래시가 있는 파일 이름으로 표현됩니다.
반환 값
성공하면 acl 배열을 반환하고 실패하면 false를 반환합니다.
오류/예외
이 메소드는 매개변수 개수 또는 유형이 잘못되었거나 노드의 ACL을 가져오지 못한 경우 PHP 오류/경고를 표시합니다.
주의 버전 0.3.0부터 이 메소드는 ZookeeperException과 파생 상품을 내보냅니다.
Examples
예제 #1 Zookeeper::getAcl() example 예제
노드의 ACL을 가져옵니다.
<?php
$zookeeper = new Zookeeper('locahost:2181');
$aclArray = array(
array(
'perms' => Zookeeper::PERM_ALL,
'scheme' => 'world',
'id' => 'anyone',
)
);
$path = '/path/to/newnode';
$zookeeper->setAcl($path, $aclArray);
$r = $zookeeper->getAcl($path);
if ($r)
var_dump($r);
else
echo 'ERR';
?>
위의 예는 다음을 출력합니다.
array(1) { [0]=> array(3) { ["perms"]=> int(31) ["scheme"]=> string(5) "world" ["id"]=> string(6) "anyone" } }
기타
- Zookeeper::create() - 동기식으로 노드 생성
- Zookeeper::setAcl() - 노드와 연결된 acl을 동기적으로 설정합니다.
- ZooKeeper Permissions
- ZookeeperException