You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2024/01/16 18:38:52 UTC
(accumulo) branch main updated: centralizes definition of accumulo tables (#4163)
This is an automated email from the ASF dual-hosted git repository.
kturner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new 0d5a87cedd centralizes definition of accumulo tables (#4163)
0d5a87cedd is described below
commit 0d5a87cedddc83a17851c99efa79c642b9bbc4e3
Author: Keith Turner <kt...@apache.org>
AuthorDate: Tue Jan 16 13:38:21 2024 -0500
centralizes definition of accumulo tables (#4163)
---
.../{MetadataTable.java => AccumuloTable.java} | 25 +++++++++++++++++++---
.../accumulo/core/metadata/MetadataTable.java | 5 ++---
.../apache/accumulo/core/metadata/RootTable.java | 5 ++---
3 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/MetadataTable.java b/core/src/main/java/org/apache/accumulo/core/metadata/AccumuloTable.java
similarity index 67%
copy from core/src/main/java/org/apache/accumulo/core/metadata/MetadataTable.java
copy to core/src/main/java/org/apache/accumulo/core/metadata/AccumuloTable.java
index b2a9a5d3d4..14b8b0cf30 100644
--- a/core/src/main/java/org/apache/accumulo/core/metadata/MetadataTable.java
+++ b/core/src/main/java/org/apache/accumulo/core/metadata/AccumuloTable.java
@@ -21,7 +21,26 @@ package org.apache.accumulo.core.metadata;
import org.apache.accumulo.core.clientImpl.Namespace;
import org.apache.accumulo.core.data.TableId;
-public class MetadataTable {
- public static final TableId ID = TableId.of("!0");
- public static final String NAME = Namespace.ACCUMULO.name() + ".metadata";
+/**
+ * Defines the name and id of all tables in the accumulo table namespace.
+ */
+public enum AccumuloTable {
+
+ ROOT("root", "+r"), METADATA("metadata", "!0");
+
+ private final String name;
+ private final TableId tableId;
+
+ public String tableName() {
+ return name;
+ }
+
+ public TableId tableId() {
+ return tableId;
+ }
+
+ AccumuloTable(String name, String id) {
+ this.name = Namespace.ACCUMULO.name() + "." + name;
+ this.tableId = TableId.of(id);
+ }
}
diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/MetadataTable.java b/core/src/main/java/org/apache/accumulo/core/metadata/MetadataTable.java
index b2a9a5d3d4..564a3a0dde 100644
--- a/core/src/main/java/org/apache/accumulo/core/metadata/MetadataTable.java
+++ b/core/src/main/java/org/apache/accumulo/core/metadata/MetadataTable.java
@@ -18,10 +18,9 @@
*/
package org.apache.accumulo.core.metadata;
-import org.apache.accumulo.core.clientImpl.Namespace;
import org.apache.accumulo.core.data.TableId;
public class MetadataTable {
- public static final TableId ID = TableId.of("!0");
- public static final String NAME = Namespace.ACCUMULO.name() + ".metadata";
+ public static final TableId ID = AccumuloTable.METADATA.tableId();
+ public static final String NAME = AccumuloTable.METADATA.tableName();
}
diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java b/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java
index 7c00cc0e81..a3e6d9a515 100644
--- a/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java
+++ b/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java
@@ -18,16 +18,15 @@
*/
package org.apache.accumulo.core.metadata;
-import org.apache.accumulo.core.clientImpl.Namespace;
import org.apache.accumulo.core.data.TableId;
import org.apache.accumulo.core.dataImpl.KeyExtent;
import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
public class RootTable {
- public static final TableId ID = TableId.of("+r");
+ public static final TableId ID = AccumuloTable.ROOT.tableId();
- public static final String NAME = Namespace.ACCUMULO.name() + ".root";
+ public static final String NAME = AccumuloTable.ROOT.tableName();
/**
* DFS location relative to the Accumulo directory