@InterfaceAudience.Private public class ZKPermissionWatcher extends ZKListener implements Closeable
AccessController
instance
on the _acl_
table regions, creates a znode for each table as
/hbase/acl/tablename
, with the znode data containing a serialized
list of the permissions granted for the table. The AccessController
instances on all other cluster hosts watch the znodes for updates, which
trigger updates in the AuthManager
permission cache.Modifier and Type | Field and Description |
---|---|
(package private) static String |
ACL_NODE |
private String |
aclZNode |
private AuthManager |
authManager |
private Future<?> |
childrenChangedFuture |
private ExecutorService |
executor |
private CountDownLatch |
initialized |
private static org.slf4j.Logger |
LOG |
watcher
Constructor and Description |
---|
ZKPermissionWatcher(ZKWatcher watcher,
AuthManager authManager,
org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
private Future<?> |
asyncProcessNodeUpdate(Runnable runnable) |
void |
close() |
void |
deleteNamespaceACLNode(String namespace)
Delete the acl notify node of namespace
|
void |
deleteTableACLNode(TableName tableName)
Delete the acl notify node of table
|
void |
nodeChildrenChanged(String path)
Called when an existing node has a child node added or removed.
|
void |
nodeCreated(String path)
Called when a new node has been created.
|
void |
nodeDataChanged(String path)
Called when an existing node has changed data.
|
void |
nodeDeleted(String path)
Called when a node has been deleted
|
private void |
refreshAuthManager(String entry,
byte[] nodeData) |
private void |
refreshNodes(List<ZKUtil.NodeAndData> nodes) |
void |
start() |
private void |
waitUntilStarted() |
void |
writeToZookeeper(byte[] entry,
byte[] permsData)
Write a table's access controls to the permissions mirror in zookeeper
|
getWatcher
private static final org.slf4j.Logger LOG
static final String ACL_NODE
private final AuthManager authManager
private final CountDownLatch initialized
private final ExecutorService executor
private Future<?> childrenChangedFuture
public ZKPermissionWatcher(ZKWatcher watcher, AuthManager authManager, org.apache.hadoop.conf.Configuration conf)
public void start() throws org.apache.zookeeper.KeeperException
org.apache.zookeeper.KeeperException
public void close()
close
in interface Closeable
close
in interface AutoCloseable
private void waitUntilStarted()
public void nodeCreated(String path)
ZKListener
nodeCreated
in class ZKListener
path
- full path of the new nodepublic void nodeDeleted(String path)
ZKListener
nodeDeleted
in class ZKListener
path
- full path of the deleted nodepublic void nodeDataChanged(String path)
ZKListener
nodeDataChanged
in class ZKListener
path
- full path of the updated nodepublic void nodeChildrenChanged(String path)
ZKListener
nodeChildrenChanged
in class ZKListener
path
- full path of the node whose children have changedprivate Future<?> asyncProcessNodeUpdate(Runnable runnable)
private void refreshNodes(List<ZKUtil.NodeAndData> nodes)
private void refreshAuthManager(String entry, byte[] nodeData) throws IOException
IOException
public void writeToZookeeper(byte[] entry, byte[] permsData)
entry
- permsData
- public void deleteTableACLNode(TableName tableName)
tableName
- public void deleteNamespaceACLNode(String namespace)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.