Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#2912] improve(core): Using class not interface for `Configs` (#3404)

Kirat Kumaraa00b604bd88
diff --git a/core/src/main/java/com/datastrato/gravitino/Configs.java b/core/src/main/java/com/datastrato/gravitino/Configs.java
index 894542ce90..e78d886033 100644
--- a/core/src/main/java/com/datastrato/gravitino/Configs.java
+++ b/core/src/main/java/com/datastrato/gravitino/Configs.java
@@ -12,73 +12,82 @@ import java.io.File;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
-public interface Configs {
+public class Configs {
- String DEFAULT_ENTITY_STORE = "kv";
- String RELATIONAL_ENTITY_STORE = "relational";
- String ENTITY_STORE_KEY = "gravitino.entity.store";
+ private Configs() {}
- String DEFAULT_ENTITY_KV_STORE = "RocksDBKvBackend";
- String ENTITY_KV_STORE_KEY = "gravitino.entity.store.kv";
+ public static final String DEFAULT_ENTITY_STORE = "kv";
+ public static final String RELATIONAL_ENTITY_STORE = "relational";
+ public static final String ENTITY_STORE_KEY = "gravitino.entity.store";
- String DEFAULT_ENTITY_RELATIONAL_STORE = "JDBCBackend";
- String ENTITY_RELATIONAL_STORE_KEY = "gravitino.entity.store.relational";
+ public static final String DEFAULT_ENTITY_KV_STORE = "RocksDBKvBackend";
+ public static final String ENTITY_KV_STORE_KEY = "gravitino.entity.store.kv";
- String ENTITY_RELATIONAL_JDBC_BACKEND_URL_KEY = "gravitino.entity.store.relational.jdbcUrl";
- String ENTITY_RELATIONAL_JDBC_BACKEND_DRIVER_KEY = "gravitino.entity.store.relational.jdbcDriver";
- String ENTITY_RELATIONAL_JDBC_BACKEND_USER_KEY = "gravitino.entity.store.relational.jdbcUser";
- String ENTITY_RELATIONAL_JDBC_BACKEND_PASSWORD_KEY =
+ public static final String DEFAULT_ENTITY_RELATIONAL_STORE = "JDBCBackend";
+ public static final String ENTITY_RELATIONAL_STORE_KEY = "gravitino.entity.store.relational";
+
+ public static final String ENTITY_RELATIONAL_JDBC_BACKEND_URL_KEY =
+ "gravitino.entity.store.relational.jdbcUrl";
+ public static final String ENTITY_RELATIONAL_JDBC_BACKEND_DRIVER_KEY =
+ "gravitino.entity.store.relational.jdbcDriver";
+ public static final String ENTITY_RELATIONAL_JDBC_BACKEND_USER_KEY =
+ "gravitino.entity.store.relational.jdbcUser";
+ public static final String ENTITY_RELATIONAL_JDBC_BACKEND_PASSWORD_KEY =
"gravitino.entity.store.relational.jdbcPassword";
- String ENTITY_KV_ROCKSDB_BACKEND_PATH_KEY = "gravitino.entity.store.kv.rocksdbPath";
+ public static final String ENTITY_KV_ROCKSDB_BACKEND_PATH_KEY =
+ "gravitino.entity.store.kv.rocksdbPath";
- Long DEFAULT_KV_DELETE_AFTER_TIME = 604800000L; // 7 days
- String KV_DELETE_AFTER_TIME_KEY = "gravitino.entity.store.kv.deleteAfterTimeMs";
+ public static final Long DEFAULT_KV_DELETE_AFTER_TIME = 604800000L; // 7 days
+ public static final String KV_DELETE_AFTER_TIME_KEY =
+ "gravitino.entity.store.kv.deleteAfterTimeMs";
// Config for data keep time after soft deletion, in milliseconds.
- String STORE_DELETE_AFTER_TIME_KEY = "gravitino.entity.store.deleteAfterTimeMs";
+ public static final String STORE_DELETE_AFTER_TIME_KEY =
+ "gravitino.entity.store.deleteAfterTimeMs";
// using the fallback default value
- Long DEFAULT_STORE_DELETE_AFTER_TIME = DEFAULT_KV_DELETE_AFTER_TIME;
+ public static final Long DEFAULT_STORE_DELETE_AFTER_TIME = DEFAULT_KV_DELETE_AFTER_TIME;
// The maximum allowed keep time for data deletion, in milliseconds. Equivalent to 30 days.
- Long MAX_DELETE_TIME_ALLOW = 1000 * 60 * 60 * 24 * 30L;
+ public static final Long MAX_DELETE_TIME_ALLOW = 1000 * 60 * 60 * 24 * 30L;
// The minimum allowed keep time for data deletion, in milliseconds. Equivalent to 10 minutes.
- Long MIN_DELETE_TIME_ALLOW = 1000 * 60 * 10L;
+ public static final Long MIN_DELETE_TIME_ALLOW = 1000 * 60 * 10L;
// Count of versions allowed to be retained, including the current version, used to delete old
// versions data.
- String VERSION_RETENTION_COUNT_KEY = "gravitino.entity.store.versionRetentionCount";
- Long DEFAULT_VERSION_RETENTION_COUNT = 1L;
+ public static final String VERSION_RETENTION_COUNT_KEY =
+ "gravitino.entity.store.versionRetentionCount";
+ public static final Long DEFAULT_VERSION_RETENTION_COUNT = 1L;
// The maximum allowed count of versions to be retained
- Long MAX_VERSION_RETENTION_COUNT = 10L;
+ public static final Long MAX_VERSION_RETENTION_COUNT = 10L;
// The minimum allowed count of versions to be retained
- Long MIN_VERSION_RETENTION_COUNT = 1L;
+ public static final Long MIN_VERSION_RETENTION_COUNT = 1L;
// Default path for RocksDB backend is "${GRAVITINO_HOME}/data/rocksdb"
- String DEFAULT_KV_ROCKSDB_BACKEND_PATH =
+ public static final String DEFAULT_KV_ROCKSDB_BACKEND_PATH =
String.join(File.separator, System.getenv("GRAVITINO_HOME"), "data", "rocksdb");
- int GARBAGE_COLLECTOR_SINGLE_DELETION_LIMIT = 100;
- long MAX_NODE_IN_MEMORY = 100000L;
+ public static final int GARBAGE_COLLECTOR_SINGLE_DELETION_LIMIT = 100;
+ public static final long MAX_NODE_IN_MEMORY = 100000L;
- long MIN_NODE_IN_MEMORY = 1000L;
+ public static final long MIN_NODE_IN_MEMORY = 1000L;
- long CLEAN_INTERVAL_IN_SECS = 60L;
+ public static final long CLEAN_INTERVAL_IN_SECS = 60L;
- ConfigEntry<String> ENTITY_STORE =
+ public static final ConfigEntry<String> ENTITY_STORE =
new ConfigBuilder(ENTITY_STORE_KEY)
.doc("Which storage implementation to use")
.version(ConfigConstants.VERSION_0_1_0)
.stringConf()
.createWithDefault(DEFAULT_ENTITY_STORE);
- ConfigEntry<String> ENTITY_KV_STORE =
+ public static final ConfigEntry<String> ENTITY_KV_STORE =
new ConfigBuilder(ENTITY_KV_STORE_KEY)
.doc("Detailed implementation of Kv storage")
.version(ConfigConstants.VERSION_0_1_0)
.stringConf()
.createWithDefault(DEFAULT_ENTITY_KV_STORE);
- ConfigEntry<String> ENTITY_RELATIONAL_STORE =
+ public static final ConfigEntry<String> ENTITY_RELATIONAL_STORE =
new ConfigBuilder(ENTITY_RELATIONAL_STORE_KEY)
.doc("Detailed implementation of relational storage")
.version(ConfigConstants.VERSION_0_5_0)
@@ -86,7 +95,7 @@ public interface Configs {
.checkValue(StringUtils::isNotBlank, ConfigConstants.NOT_BLANK_ERROR_MSG)
.createWithDefault(DEFAULT_ENTITY_RELATIONAL_STORE);
- ConfigEntry<String> ENTITY_RELATIONAL_JDBC_BACKEND_URL =
+ public static final ConfigEntry<String> ENTITY_RELATIONAL_JDBC_BACKEND_URL =
new ConfigBuilder(ENTITY_RELATIONAL_JDBC_BACKEND_URL_KEY)
.doc("Connection URL of `JDBCBackend`")
.version(ConfigConstants.VERSION_0_5_0)
@@ -94,7 +103,7 @@ public interface Configs {
.checkValue(StringUtils::isNotBlank, ConfigConstants.NOT_BLANK_ERROR_MSG)
.create();
- ConfigEntry<String> ENTITY_RELATIONAL_JDBC_BACKEND_DRIVER =
+ public static final ConfigEntry<String> ENTITY_RELATIONAL_JDBC_BACKEND_DRIVER =
new ConfigBuilder(ENTITY_RELATIONAL_JDBC_BACKEND_DRIVER_KEY)
.doc("Driver Name of `JDBCBackend`")
.version(ConfigConstants.VERSION_0_5_0)
@@ -102,7 +111,7 @@ public interface Configs {
.checkValue(StringUtils::isNotBlank, ConfigConstants.NOT_BLANK_ERROR_MSG)
.create();
- ConfigEntry<String> ENTITY_RELATIONAL_JDBC_BACKEND_USER =
+ public static final ConfigEntry<String> ENTITY_RELATIONAL_JDBC_BACKEND_USER =
new ConfigBuilder(ENTITY_RELATIONAL_JDBC_BACKEND_USER_KEY)
.doc("Username of `JDBCBackend`")
.version(ConfigConstants.VERSION_0_5_0)
@@ -110,7 +119,7 @@ public interface Configs {
.checkValue(StringUtils::isNotBlank, ConfigConstants.NOT_BLANK_ERROR_MSG)
.create();
- ConfigEntry<String> ENTITY_RELATIONAL_JDBC_BACKEND_PASSWORD =
+ public static final ConfigEntry<String> ENTITY_RELATIONAL_JDBC_BACKEND_PASSWORD =
new ConfigBuilder(ENTITY_RELATIONAL_JDBC_BACKEND_PASSWORD_KEY)
.doc("Password of `JDBCBackend`")
.version(ConfigConstants.VERSION_0_5_0)
@@ -118,7 +127,7 @@ public interface Configs {
.checkValue(StringUtils::isNotBlank, ConfigConstants.NOT_BLANK_ERROR_MSG)
.create();
- ConfigEntry<String> ENTRY_KV_ROCKSDB_BACKEND_PATH =
+ public static final ConfigEntry<String> ENTRY_KV_ROCKSDB_BACKEND_PATH =
new ConfigBuilder(ENTITY_KV_ROCKSDB_BACKEND_PATH_KEY)
.doc(
"The storage path for RocksDB storage implementation. It supports both absolute and"
@@ -129,42 +138,42 @@ public interface Configs {
.stringConf()
.createWithDefault(DEFAULT_KV_ROCKSDB_BACKEND_PATH);
- ConfigEntry<String> ENTITY_SERDE =
+ public static final ConfigEntry<String> ENTITY_SERDE =
new ConfigBuilder("gravitino.entity.serde")
.doc("The entity SerDe to use")
.version(ConfigConstants.VERSION_0_1_0)
.stringConf()
.createWithDefault("proto");
- ConfigEntry<Long> CATALOG_CACHE_EVICTION_INTERVAL_MS =
+ public static final ConfigEntry<Long> CATALOG_CACHE_EVICTION_INTERVAL_MS =
new ConfigBuilder("gravitino.catalog.cache.evictionIntervalMs")
.doc("The interval in milliseconds to evict the catalog cache")
.version(ConfigConstants.VERSION_0_1_0)
.longConf()
.createWithDefault(60 * 60 * 1000L);
- ConfigEntry<Boolean> CATALOG_LOAD_ISOLATED =
+ public static final ConfigEntry<Boolean> CATALOG_LOAD_ISOLATED =
new ConfigBuilder("gravitino.catalog.classloader.isolated")
.doc("Whether to load the catalog in an isolated classloader")
.version(ConfigConstants.VERSION_0_1_0)
.booleanConf()
.createWithDefault(true);
- ConfigEntry<String> AUTHENTICATOR =
+ public static final ConfigEntry<String> AUTHENTICATOR =
new ConfigBuilder("gravitino.authenticator")
.doc("The authenticator which Gravitino uses")
.version(ConfigConstants.VERSION_0_3_0)
.stringConf()
.createWithDefault("simple");
- ConfigEntry<Long> STORE_TRANSACTION_MAX_SKEW_TIME =
+ public static final ConfigEntry<Long> STORE_TRANSACTION_MAX_SKEW_TIME =
new ConfigBuilder("gravitino.entity.store.maxTransactionSkewTimeMs")
.doc("The maximum skew time of transactions in milliseconds")
.version(ConfigConstants.VERSION_0_3_0)
.longConf()
.createWithDefault(2000L);
- ConfigEntry<Long> KV_DELETE_AFTER_TIME =
+ public static final ConfigEntry<Long> KV_DELETE_AFTER_TIME =
new ConfigBuilder(KV_DELETE_AFTER_TIME_KEY)
.doc(
String.format(
@@ -182,7 +191,7 @@ public interface Configs {
KV_DELETE_AFTER_TIME_KEY, MIN_DELETE_TIME_ALLOW, MAX_DELETE_TIME_ALLOW))
.createWithDefault(DEFAULT_KV_DELETE_AFTER_TIME);
- ConfigEntry<Long> STORE_DELETE_AFTER_TIME =
+ public static final ConfigEntry<Long> STORE_DELETE_AFTER_TIME =
new ConfigBuilder(STORE_DELETE_AFTER_TIME_KEY)
.doc(
String.format(
@@ -200,7 +209,7 @@ public interface Configs {
STORE_DELETE_AFTER_TIME_KEY, MIN_DELETE_TIME_ALLOW, MAX_DELETE_TIME_ALLOW))
.createWithDefault(DEFAULT_STORE_DELETE_AFTER_TIME);
- ConfigEntry<Long> VERSION_RETENTION_COUNT =
+ public static final ConfigEntry<Long> VERSION_RETENTION_COUNT =
new ConfigBuilder(VERSION_RETENTION_COUNT_KEY)
.doc(
String.format(
@@ -221,35 +230,35 @@ public interface Configs {
// The followings are configurations for tree lock
- ConfigEntry<Long> TREE_LOCK_MAX_NODE_IN_MEMORY =
+ public static final ConfigEntry<Long> TREE_LOCK_MAX_NODE_IN_MEMORY =
new ConfigBuilder("gravitino.lock.maxNodes")
.doc("The maximum number of tree lock nodes to keep in memory")
.version(ConfigConstants.VERSION_0_4_0)
.longConf()
.createWithDefault(MAX_NODE_IN_MEMORY);
- ConfigEntry<Long> TREE_LOCK_MIN_NODE_IN_MEMORY =
+ public static final ConfigEntry<Long> TREE_LOCK_MIN_NODE_IN_MEMORY =
new ConfigBuilder("gravitino.lock.minNodes")
.doc("The minimum number of tree lock nodes to keep in memory")
.version(ConfigConstants.VERSION_0_4_0)
.longConf()
.createWithDefault(MIN_NODE_IN_MEMORY);
- ConfigEntry<Long> TREE_LOCK_CLEAN_INTERVAL =
+ public static final ConfigEntry<Long> TREE_LOCK_CLEAN_INTERVAL =
new ConfigBuilder("gravitino.lock.cleanIntervalInSecs")
.doc("The interval in seconds to clean up the stale tree lock nodes")
.version(ConfigConstants.VERSION_0_4_0)
.longConf()
.createWithDefault(CLEAN_INTERVAL_IN_SECS);
- ConfigEntry<Boolean> ENABLE_AUTHORIZATION =
+ public static final ConfigEntry<Boolean> ENABLE_AUTHORIZATION =
new ConfigBuilder("gravitino.authorization.enable")
.doc("Enable the authorization")
.version(ConfigConstants.VERSION_0_5_0)
.booleanConf()
.createWithDefault(false);
- ConfigEntry<List<String>> SERVICE_ADMINS =
+ public static final ConfigEntry<List<String>> SERVICE_ADMINS =
new ConfigBuilder("gravitino.authorization.serviceAdmins")
.doc("The admins of Gravitino service")
.version(ConfigConstants.VERSION_0_5_0)
@@ -261,7 +270,7 @@ public interface Configs {
ConfigConstants.NOT_BLANK_ERROR_MSG)
.create();
- ConfigEntry<Long> ROLE_CACHE_EVICTION_INTERVAL_MS =
+ public static final ConfigEntry<Long> ROLE_CACHE_EVICTION_INTERVAL_MS =
new ConfigBuilder("gravitino.authorization.roleCacheEvictionIntervalMs")
.doc("The interval in milliseconds to evict the role cache")
.version(ConfigConstants.VERSION_0_5_0)