jmark99 commented on code in PR #3645:
URL: https://github.com/apache/accumulo/pull/3645#discussion_r1277709601
##########
core/src/main/java/org/apache/accumulo/core/client/admin/TabletInformation.java:
##########
@@ -18,142 +18,74 @@
*/
package org.apache.accumulo.core.client.admin;
-import java.util.Objects;
+import java.util.Optional;
import org.apache.accumulo.core.data.TableId;
-import org.apache.accumulo.core.util.NumUtil;
-
-public class TabletInformation {
-
- private final String tableName;
- private final String endRow;
- private final String prevEndRow;
- private final int numFiles;
- private final int numWalLogs;
- private final long numEntries;
- private final long size;
- private final String status;
- private final String location;
- private final String dir;
- private final TableId tableId;
- private final TabletHostingGoal goal;
-
- public TabletInformation(String tableName, TableId tableId, String endRow,
String prevEndRow,
- int numFiles, int numWalLogs, long numEntries, long size, String status,
String location,
- String dir, TabletHostingGoal goal) {
- this.tableName = tableName;
- this.tableId = tableId;
- this.endRow = endRow;
- this.prevEndRow = prevEndRow;
- this.numFiles = numFiles;
- this.numWalLogs = numWalLogs;
- this.numEntries = numEntries;
- this.size = size;
- this.status = status;
- this.location = location;
- this.dir = dir;
- this.goal = goal;
- }
-
- public String getEndRow() {
- return Objects.requireNonNullElse(this.endRow, "+INF");
- }
-
- public String getStartRow() {
- return Objects.requireNonNullElse(this.prevEndRow, "-INF");
- }
-
- public String getTableId() {
- return tableId.canonical();
- }
-
- public String getTablet() {
- return getStartRow() + " " + getEndRow();
- }
-
- public String getTableName() {
- return this.tableName;
- }
-
- public int getNumFiles() {
- return this.numFiles;
- }
-
- public int getNumWalLogs() {
- return this.numWalLogs;
- }
-
- public long getNumEntries() {
- return this.numEntries;
- }
-
- public String getNumEntries(final boolean humanReadable) {
- if (humanReadable) {
- return NumUtil.bigNumberForQuantity(numEntries);
- }
- return String.format("%,d", numEntries);
- }
-
- public long getSize() {
- return this.size;
- }
-
- public String getSize(final boolean humanReadable) {
- if (humanReadable) {
- return NumUtil.bigNumberForSize(size);
- }
- return String.format("%,d", size);
- }
-
- public String getStatus() {
- return this.status;
- }
-
- public String getLocation() {
- return this.location;
- }
-
- public String getTabletDir() {
- return this.dir;
- }
-
- public TabletHostingGoal getHostingGoal() {
- return this.goal;
- }
-
- @Override
- public String toString() {
- return "TabletInformation{tableName='" + tableName + '\'' + ", numFiles="
+ numFiles
- + ", numWalLogs=" + numWalLogs + ", numEntries=" + numEntries + ",
size=" + size
- + ", status='" + status + '\'' + ", location='" + location + '\'' + ",
dir='" + dir + '\''
- + ", tableId=" + tableId + ", tablet=" + getTablet() + ", goal=" +
goal + '}';
- }
-
- public static final String header =
- String.format("%-4s %-15s %-5s %-5s %-9s %-9s %-10s %-30s %-5s %-20s
%-20s %-10s", "NUM",
- "TABLET_DIR", "FILES", "WALS", "ENTRIES", "SIZE", "STATUS",
"LOCATION", "ID",
- "START (Exclusive)", "END", "GOAL");
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- TabletInformation that = (TabletInformation) o;
- return numFiles == that.numFiles && numWalLogs == that.numWalLogs
- && numEntries == that.numEntries && size == that.size
- && Objects.equals(tableName, that.tableName) && Objects.equals(endRow,
that.endRow)
- && Objects.equals(prevEndRow, that.prevEndRow) &&
Objects.equals(status, that.status)
- && Objects.equals(location, that.location) && Objects.equals(dir,
that.dir)
- && Objects.equals(tableId, that.tableId) && goal == that.goal;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(tableName, endRow, prevEndRow, numFiles, numWalLogs,
numEntries, size,
- status, location, dir, tableId, goal);
- }
+import org.apache.accumulo.core.data.TabletId;
+import org.apache.accumulo.core.metadata.schema.TabletMetadata.Location;
+import org.apache.hadoop.io.Text;
+
+public interface TabletInformation {
+
+ /**
+ * @return the TableId of the table containing this tablet.
+ */
+ TableId getTableId();
+
+ /**
+ * @return the TabletId for this tablet.
+ */
+ TabletId getTabletId();
+
+ /**
+ * @return the tablet end row.
+ */
+ Text getEndRow();
+
+ /**
+ * @return the previous end row.
+ */
+ Text getStartRow();
+
+ /**
+ * @return the number of files in the tablet directory.
+ */
+ int getNumFiles();
+
+ /**
+ * @return the number of write-ahead logs associated with the tablet.
+ */
+ int getNumWalLogs();
+
+ /**
+ * @return an estimated number of entries in the tablet.
+ */
+ long getEstimatedEntries();
+
+ /**
+ * @return an estimated size of the tablet data on disk, which is likely the
compressed size of
+ * the data.
+ */
+ long getEstimatedSize();
+
+ /**
+ * @return the tablet hosting state.
+ */
+ String getTabletState();
+
+ /**
+ * @return the Location of the tablet.
+ */
+ Optional<Location> getLocation();
Review Comment:
@keith-turner updated with your suggestions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]