001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase.security.visibility;
019
020import org.apache.hadoop.hbase.NamespaceDescriptor;
021import org.apache.hadoop.hbase.TableName;
022import org.apache.hadoop.hbase.util.Bytes;
023import org.apache.yetus.audience.InterfaceAudience;
024
025@InterfaceAudience.Private
026public final class VisibilityConstants {
027
028  /**
029   * The string that is used as key in setting the Operation attributes for visibility labels
030   */
031  public static final String VISIBILITY_LABELS_ATTR_KEY = "VISIBILITY";
032
033  /** Internal storage table for visibility labels */
034  public static final TableName LABELS_TABLE_NAME =
035    TableName.valueOf(NamespaceDescriptor.SYSTEM_NAMESPACE_NAME_STR, "labels");
036
037  /** Family for the internal storage table for visibility labels */
038  public static final byte[] LABELS_TABLE_FAMILY = Bytes.toBytes("f");
039
040  /** Qualifier for the internal storage table for visibility labels */
041  public static final byte[] LABEL_QUALIFIER = new byte[1];
042
043  /**
044   * Visibility serialization version format. It indicates the visibility labels are sorted based on
045   * ordinal
046   **/
047  public static final byte SORTED_ORDINAL_SERIALIZATION_FORMAT = 1;
048  /** Byte representation of the visibility_serialization_version **/
049  public static final byte[] SORTED_ORDINAL_SERIALIZATION_FORMAT_TAG_VAL =
050    new byte[] { SORTED_ORDINAL_SERIALIZATION_FORMAT };
051
052  public static final String CHECK_AUTHS_FOR_MUTATION =
053    "hbase.security.visibility.mutations.checkauths";
054
055  public static final String NOT_OPERATOR = "!";
056  public static final String AND_OPERATOR = "&";
057  public static final String OR_OPERATOR = "|";
058  public static final String OPEN_PARAN = "(";
059  public static final String CLOSED_PARAN = ")";
060
061  /** Label ordinal value for invalid labels */
062  public static final int NON_EXIST_LABEL_ORDINAL = 0;
063
064}