@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
- IOException
public static VisibilityLabelsCache get()
IllegalStateException
- when this is called before calling
createAndGet(ZooKeeperWatcher, Configuration)
public void refreshLabelsCache(byte[] data) throws IOException
IOException
public void refreshUserAuthsCache(byte[] data) throws IOException
IOException
public int getLabelOrdinal(String label)
getLabelOrdinal
in interface VisibilityLabelOrdinalProvider
label
- Not null label stringpublic String getLabel(int ordinal)
VisibilityLabelOrdinalProvider
getLabel
in interface VisibilityLabelOrdinalProvider
ordinal
- 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
IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.