View Javadoc

1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.hadoop.hbase.hbtop.field;
19  
20  import java.util.Objects;
21  
22  import org.apache.hadoop.hbase.classification.InterfaceAudience;
23  
24  /**
25   * Represents fields that are displayed in the top screen.
26   */
27  @InterfaceAudience.Private
28  public enum Field {
29    REGION_NAME("RNAME", "Region Name", true, true, FieldValueType.STRING),
30    NAMESPACE("NAMESPACE", "Namespace Name", true, true, FieldValueType.STRING),
31    TABLE("TABLE", "Table Name", true, true, FieldValueType.STRING),
32    START_CODE("SCODE", "Start Code", false, true, FieldValueType.STRING),
33    REPLICA_ID("REPID", "Replica ID", false, false, FieldValueType.STRING),
34    REGION("REGION", "Encoded Region Name", false, true, FieldValueType.STRING),
35    REGION_SERVER("RS", "Short Region Server Name", true, true, FieldValueType.STRING),
36    LONG_REGION_SERVER("LRS", "Long Region Server Name", true, true, FieldValueType.STRING),
37    REQUEST_COUNT_PER_SECOND("#REQ/S", "Request Count per second", false, false,
38      FieldValueType.LONG),
39    READ_REQUEST_COUNT_PER_SECOND("#READ/S", "Read Request Count per second", false, false,
40      FieldValueType.LONG),
41    WRITE_REQUEST_COUNT_PER_SECOND("#WRITE/S", "Write Request Count per second", false, false,
42      FieldValueType.LONG),
43    STORE_FILE_SIZE("SF", "StoreFile Size", false, false, FieldValueType.SIZE),
44    UNCOMPRESSED_STORE_FILE_SIZE("USF", "Uncompressed StoreFile Size", false, false,
45      FieldValueType.SIZE),
46    NUM_STORE_FILES("#SF", "Number of StoreFiles", false, false, FieldValueType.INTEGER),
47    MEM_STORE_SIZE("MEMSTORE", "MemStore Size", false, false, FieldValueType.SIZE),
48    LOCALITY("LOCALITY", "Block Locality", false, false, FieldValueType.FLOAT),
49    START_KEY("SKEY", "Start Key", true, true, FieldValueType.STRING),
50    COMPACTING_CELL_COUNT("#COMPingCELL", "Compacting Cell Count", false, false,
51      FieldValueType.LONG),
52    COMPACTED_CELL_COUNT("#COMPedCELL", "Compacted Cell Count", false, false, FieldValueType.LONG),
53    COMPACTION_PROGRESS("%COMP", "Compaction Progress", false, false, FieldValueType.PERCENT),
54    LAST_MAJOR_COMPACTION_TIME("LASTMCOMP", "Last Major Compaction Time", false, true,
55      FieldValueType.STRING),
56    REGION_COUNT("#REGION", "Region Count", false, false, FieldValueType.INTEGER),
57    USED_HEAP_SIZE("UHEAP", "Used Heap Size", false, false, FieldValueType.SIZE),
58    MAX_HEAP_SIZE("MHEAP", "Max Heap Size", false, false, FieldValueType.SIZE);
59  
60    private final String header;
61    private final String description;
62    private final boolean autoAdjust;
63    private final boolean leftJustify;
64    private final FieldValueType fieldValueType;
65  
66    Field(String header, String description, boolean autoAdjust, boolean leftJustify,
67      FieldValueType fieldValueType) {
68      this.header = Objects.requireNonNull(header);
69      this.description = Objects.requireNonNull(description);
70      this.autoAdjust = autoAdjust;
71      this.leftJustify = leftJustify;
72      this.fieldValueType = Objects.requireNonNull(fieldValueType);
73    }
74  
75    public FieldValue newValue(Object value) {
76      return new FieldValue(value, fieldValueType);
77    }
78  
79    public String getHeader() {
80      return header;
81    }
82  
83    public String getDescription() {
84      return description;
85    }
86  
87    public boolean isAutoAdjust() {
88      return autoAdjust;
89    }
90  
91    public boolean isLeftJustify() {
92      return leftJustify;
93    }
94  
95    public FieldValueType getFieldValueType() {
96      return fieldValueType;
97    }
98  }