Skip to content

Commit 55fe5f7

Browse files
committed
Refactor
1 parent ab72808 commit 55fe5f7

2 files changed

Lines changed: 5 additions & 47 deletions

File tree

rust/operator-binary/src/controller.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,11 @@ use crate::{
9393
crd::{
9494
APP_NAME, CORE_SITE_XML, Container, HIVE_PORT, HIVE_PORT_NAME, HIVE_SITE_XML,
9595
HiveClusterStatus, HiveRole, JVM_SECURITY_PROPERTIES_FILE, METRICS_PORT, METRICS_PORT_NAME,
96-
MetaStoreConfig, MetadataDatabaseConnection, STACKABLE_CONFIG_DIR,
97-
STACKABLE_CONFIG_DIR_NAME, STACKABLE_CONFIG_MOUNT_DIR, STACKABLE_CONFIG_MOUNT_DIR_NAME,
96+
MetaStoreConfig, STACKABLE_CONFIG_DIR, STACKABLE_CONFIG_DIR_NAME,
97+
STACKABLE_CONFIG_MOUNT_DIR, STACKABLE_CONFIG_MOUNT_DIR_NAME,
9898
STACKABLE_LOG_CONFIG_MOUNT_DIR, STACKABLE_LOG_CONFIG_MOUNT_DIR_NAME, STACKABLE_LOG_DIR,
9999
STACKABLE_LOG_DIR_NAME,
100+
databases::MetadataDatabaseConnection,
100101
v1alpha1::{self, HiveMetastoreRoleConfig},
101102
},
102103
discovery::{self},

rust/operator-binary/src/crd/mod.rs

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::{collections::BTreeMap, str::FromStr};
22

3+
use databases::MetadataDatabaseConnection;
34
use security::AuthenticationConfig;
45
use serde::{Deserialize, Serialize};
56
use snafu::{OptionExt, ResultExt, Snafu};
@@ -19,12 +20,6 @@ use stackable_operator::{
1920
merge::Merge,
2021
},
2122
crd::s3,
22-
databases::{
23-
databases::{
24-
derby::DerbyConnection, mysql::MysqlConnection, postgresql::PostgresqlConnection,
25-
},
26-
drivers::jdbc::JDBCDatabaseConnection,
27-
},
2823
deep_merger::ObjectOverrides,
2924
k8s_openapi::apimachinery::pkg::api::resource::Quantity,
3025
kube::{CustomResource, ResourceExt, runtime::reflector::ObjectRef},
@@ -43,6 +38,7 @@ use v1alpha1::HiveMetastoreRoleConfig;
4338
use crate::{crd::affinity::get_affinity, listener::metastore_default_listener_class};
4439

4540
pub mod affinity;
41+
pub mod databases;
4642
pub mod security;
4743

4844
pub const FIELD_MANAGER: &str = "hive-operator";
@@ -497,45 +493,6 @@ impl MetaStoreConfig {
497493
}
498494
}
499495

500-
#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)]
501-
#[serde(rename_all = "camelCase")]
502-
pub enum MetadataDatabaseConnection {
503-
/// TODO docs
504-
Postgresql(PostgresqlConnection),
505-
506-
/// TODO docs
507-
///
508-
/// Please note that - due to license issues - we don't ship the mysql driver, you need to add
509-
/// it it yourself.
510-
/// See <https://docs.stackable.tech/home/stable/hive/usage-guide/database-driver/> for details.
511-
Mysql(MysqlConnection),
512-
513-
/// TODO docs
514-
Derby(DerbyConnection),
515-
// We don't support generic (yet?), as we need to tell the metastore the `--dbtype` on startup,
516-
// which is not known for generic connection.
517-
// Generic(GenericJDBCDatabaseConnection),
518-
}
519-
520-
impl MetadataDatabaseConnection {
521-
pub fn as_jdbc_database_connection(&self) -> &dyn JDBCDatabaseConnection {
522-
match self {
523-
Self::Postgresql(p) => p,
524-
Self::Mysql(m) => m,
525-
Self::Derby(d) => d,
526-
}
527-
}
528-
529-
/// Name of the database as it should be passed using the `--db-type` CLI argument to Hive
530-
pub fn as_hive_db_type(&self) -> &str {
531-
match self {
532-
MetadataDatabaseConnection::Postgresql(_) => "postgres",
533-
MetadataDatabaseConnection::Mysql(_) => "mysql",
534-
MetadataDatabaseConnection::Derby(_) => "derby",
535-
}
536-
}
537-
}
538-
539496
impl Configuration for MetaStoreConfigFragment {
540497
type Configurable = v1alpha1::HiveCluster;
541498

0 commit comments

Comments
 (0)