@InterfaceAudience.Private public class VisibilityLabelsCache extends java.lang.Object implements VisibilityLabelOrdinalProvider
| Modifier and Type | Method and Description |
|---|---|
static VisibilityLabelsCache |
createAndGet(ZooKeeperWatcher watcher,
Configuration conf)
Creates the singleton instance, if not yet present, and returns the same.
|
static VisibilityLabelsCache |
get() |
java.util.List<java.lang.String> |
getGroupAuths(java.lang.String[] groups) |
java.util.Set<java.lang.Integer> |
getGroupAuthsAsOrdinals(java.lang.String[] groups)
Returns the list of ordinals of labels associated with the groups
|
java.lang.String |
getLabel(int ordinal)
Returns the string associated with the ordinal.
|
int |
getLabelOrdinal(java.lang.String label) |
int |
getLabelsCount() |
java.util.List<java.lang.String> |
getUserAuths(java.lang.String user) |
java.util.Set<java.lang.Integer> |
getUserAuthsAsOrdinals(java.lang.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, Configuration conf) throws java.io.IOException
watcher - conf - java.io.IOExceptionpublic static VisibilityLabelsCache get()
java.lang.IllegalStateException - when this is called before calling
createAndGet(ZooKeeperWatcher, Configuration)public void refreshLabelsCache(byte[] data)
throws java.io.IOException
java.io.IOExceptionpublic void refreshUserAuthsCache(byte[] data)
throws java.io.IOException
java.io.IOExceptionpublic int getLabelOrdinal(java.lang.String label)
getLabelOrdinal in interface VisibilityLabelOrdinalProviderlabel - Not null label stringpublic java.lang.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 java.util.List<java.lang.String> getUserAuths(java.lang.String user)
public java.util.List<java.lang.String> getGroupAuths(java.lang.String[] groups)
public java.util.Set<java.lang.Integer> getUserAuthsAsOrdinals(java.lang.String user)
user - Not null value.public java.util.Set<java.lang.Integer> getGroupAuthsAsOrdinals(java.lang.String[] groups)
groups - public void writeToZookeeper(byte[] data,
boolean labelsOrUserAuths)
throws java.io.IOException
java.io.IOException