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.hbtop.field;
019
020import java.util.Objects;
021import org.apache.yetus.audience.InterfaceAudience;
022
023
024/**
025 * Represents fields that are displayed in the top screen.
026 */
027@InterfaceAudience.Private
028public enum Field {
029  REGION_NAME("RNAME", "Region Name", true, true, FieldValueType.STRING),
030  NAMESPACE("NAMESPACE", "Namespace Name", true, true, FieldValueType.STRING),
031  TABLE("TABLE", "Table Name", true, true, FieldValueType.STRING),
032  START_CODE("SCODE", "Start Code", false, true, FieldValueType.STRING),
033  REPLICA_ID("REPID", "Replica ID", false, false, FieldValueType.STRING),
034  REGION("REGION", "Encoded Region Name", false, true, FieldValueType.STRING),
035  REGION_SERVER("RS", "Short Region Server Name", true, true, FieldValueType.STRING),
036  LONG_REGION_SERVER("LRS", "Long Region Server Name", true, true, FieldValueType.STRING),
037  REQUEST_COUNT_PER_SECOND("#REQ/S", "Request Count per second", false, false,
038    FieldValueType.LONG),
039  READ_REQUEST_COUNT_PER_SECOND("#READ/S", "Read Request Count per second", false, false,
040    FieldValueType.LONG),
041  FILTERED_READ_REQUEST_COUNT_PER_SECOND("#FREAD/S", "Filtered Read Request Count per second",
042    false, false, FieldValueType.LONG),
043  WRITE_REQUEST_COUNT_PER_SECOND("#WRITE/S", "Write Request Count per second", false, false,
044    FieldValueType.LONG),
045  STORE_FILE_SIZE("SF", "StoreFile Size", false, false, FieldValueType.SIZE),
046  UNCOMPRESSED_STORE_FILE_SIZE("USF", "Uncompressed StoreFile Size", false, false,
047    FieldValueType.SIZE),
048  NUM_STORE_FILES("#SF", "Number of StoreFiles", false, false, FieldValueType.INTEGER),
049  MEM_STORE_SIZE("MEMSTORE", "MemStore Size", false, false, FieldValueType.SIZE),
050  LOCALITY("LOCALITY", "Block Locality", false, false, FieldValueType.FLOAT),
051  START_KEY("SKEY", "Start Key", true, true, FieldValueType.STRING),
052  COMPACTING_CELL_COUNT("#COMPingCELL", "Compacting Cell Count", false, false,
053    FieldValueType.LONG),
054  COMPACTED_CELL_COUNT("#COMPedCELL", "Compacted Cell Count", false, false, FieldValueType.LONG),
055  COMPACTION_PROGRESS("%COMP", "Compaction Progress", false, false, FieldValueType.PERCENT),
056  LAST_MAJOR_COMPACTION_TIME("LASTMCOMP", "Last Major Compaction Time", false, true,
057    FieldValueType.STRING),
058  REGION_COUNT("#REGION", "Region Count", false, false, FieldValueType.INTEGER),
059  USED_HEAP_SIZE("UHEAP", "Used Heap Size", false, false, FieldValueType.SIZE),
060  MAX_HEAP_SIZE("MHEAP", "Max Heap Size", false, false, FieldValueType.SIZE);
061
062  private final String header;
063  private final String description;
064  private final boolean autoAdjust;
065  private final boolean leftJustify;
066  private final FieldValueType fieldValueType;
067
068  Field(String header, String description, boolean autoAdjust, boolean leftJustify,
069    FieldValueType fieldValueType) {
070    this.header = Objects.requireNonNull(header);
071    this.description = Objects.requireNonNull(description);
072    this.autoAdjust = autoAdjust;
073    this.leftJustify = leftJustify;
074    this.fieldValueType = Objects.requireNonNull(fieldValueType);
075  }
076
077  public FieldValue newValue(Object value) {
078    return new FieldValue(value, fieldValueType);
079  }
080
081  public String getHeader() {
082    return header;
083  }
084
085  public String getDescription() {
086    return description;
087  }
088
089  public boolean isAutoAdjust() {
090    return autoAdjust;
091  }
092
093  public boolean isLeftJustify() {
094    return leftJustify;
095  }
096
097  public FieldValueType getFieldValueType() {
098    return fieldValueType;
099  }
100}