@InterfaceAudience.Private public class VisibilityLabelsCache extends Object implements VisibilityLabelOrdinalProvider
| Modifier and Type | Method and Description |
|---|---|
static VisibilityLabelsCache |
createAndGet(ZooKeeperWatcher watcher,
org.apache.hadoop.conf.Configuration conf)
Creates the singleton instance, if not yet present, and returns the same.
|
static VisibilityLabelsCache |
get() |
List<String> |
getGroupAuths(String[] groups) |
Set<Integer> |
getGroupAuthsAsOrdinals(String[] groups)
Returns the list of ordinals of labels associated with the groups
|
String |
getLabel(int ordinal)
Returns the string associated with the ordinal.
|
int |
getLabelOrdinal(String label) |
int |
getLabelsCount() |
List<String> |
getUserAuths(String user) |
Set<Integer> |
getUserAuthsAsOrdinals(String user)
Returns the list of ordinals of labels associated with the user
|
void |
refreshLabelsCache(byte[] data) |
void |
refreshUserAuthsCache(byte[] data) |
void |
writeToZookeeper(byte[] data,
boolean labelsOrUserAuths) |
public static VisibilityLabelsCache createAndGet(ZooKeeperWatcher watcher, org.apache.hadoop.conf.Configuration conf) throws IOException
watcher - conf - IOExceptionpublic static VisibilityLabelsCache get()
IllegalStateException - when this is called before calling
createAndGet(ZooKeeperWatcher, Configuration)public void refreshLabelsCache(byte[] data)
throws IOException
IOExceptionpublic void refreshUserAuthsCache(byte[] data)
throws IOException
IOExceptionpublic int getLabelOrdinal(String label)
getLabelOrdinal in interface VisibilityLabelOrdinalProviderlabel - Not null label stringpublic String getLabel(int ordinal)
VisibilityLabelOrdinalProvidergetLabel in interface VisibilityLabelOrdinalProviderordinal - The ordinal of label which we are looking for.null when no label exist in
the system with given ordinalpublic int getLabelsCount()
public Set<Integer> getUserAuthsAsOrdinals(String user)
user - Not null value.public Set<Integer> getGroupAuthsAsOrdinals(String[] groups)
groups - public void writeToZookeeper(byte[] data,
boolean labelsOrUserAuths)
throws IOException
IOExceptionCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.