Skip to content

Commit 357a288

Browse files
committed
JDBC -> Jdbc and SQLAlchemy -> SqlAlchemy
1 parent 0f81de5 commit 357a288

8 files changed

Lines changed: 49 additions & 49 deletions

File tree

crates/stackable-operator/crds/DummyCluster.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ spec:
9393
- required:
9494
- redis
9595
- required:
96-
- genericJDBC
96+
- genericJdbc
9797
- required:
98-
- genericSQLAlchemy
98+
- genericSqlAlchemy
9999
- required:
100100
- genericCelery
101101
properties:
@@ -133,7 +133,7 @@ spec:
133133
required:
134134
- uriSecret
135135
type: object
136-
genericJDBC:
136+
genericJdbc:
137137
description: |-
138138
A generic JDBC database connection for database types not covered by a dedicated variant.
139139
@@ -163,7 +163,7 @@ spec:
163163
- driver
164164
- uri
165165
type: object
166-
genericSQLAlchemy:
166+
genericSqlAlchemy:
167167
description: |-
168168
A generic SQLAlchemy database connection for database types not covered by a dedicated variant.
169169
@@ -196,7 +196,7 @@ spec:
196196
type: string
197197
default: {}
198198
description: |-
199-
Additional map of JDBC connection parameters to append to the connection URL. The given
199+
Additional map of connection parameters to append to the connection URL. The given
200200
`HashMap<String, String>` will be converted to query parameters in the form of
201201
`?param1=value1&param2=value2`.
202202
type: object

crates/stackable-operator/src/databases/databases/derby.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use snafu::{ResultExt, Snafu};
44

55
use crate::databases::{
66
TemplatingMechanism,
7-
drivers::jdbc::{JDBCDatabaseConnection, JDBCDatabaseConnectionDetails},
7+
drivers::jdbc::{JdbcDatabaseConnection, JdbcDatabaseConnectionDetails},
88
};
99

1010
#[derive(Debug, Snafu)]
@@ -30,20 +30,20 @@ pub struct DerbyConnection {
3030
pub location: Option<String>,
3131
}
3232

33-
impl JDBCDatabaseConnection for DerbyConnection {
33+
impl JdbcDatabaseConnection for DerbyConnection {
3434
fn jdbc_connection_details_with_templating(
3535
&self,
3636
unique_database_name: &str,
3737
_templating_mechanism: &TemplatingMechanism,
38-
) -> Result<JDBCDatabaseConnectionDetails, crate::databases::Error> {
38+
) -> Result<JdbcDatabaseConnectionDetails, crate::databases::Error> {
3939
let location = self
4040
.location
4141
.clone()
4242
.unwrap_or_else(|| format!("/tmp/derby/{unique_database_name}/derby.db"));
4343
let connection_uri = format!("jdbc:derby:{location};create=true",);
4444
let connection_uri = connection_uri.parse().context(ParseConnectionUrlSnafu)?;
4545

46-
Ok(JDBCDatabaseConnectionDetails {
46+
Ok(JdbcDatabaseConnectionDetails {
4747
// Sadly the Derby driver class name is a bit complicated, e.g. for HMS up to 4.1.x we used
4848
// "org.apache.derby.jdbc.EmbeddedDriver",
4949
// for HMS 4.2.x we used "org.apache.derby.iapi.jdbc.AutoloadedDriver".

crates/stackable-operator/src/databases/databases/mysql.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::{
88
commons::networking::HostName,
99
databases::{
1010
TemplatingMechanism,
11-
drivers::jdbc::{JDBCDatabaseConnection, JDBCDatabaseConnectionDetails},
11+
drivers::jdbc::{JdbcDatabaseConnection, JdbcDatabaseConnectionDetails},
1212
helpers::{connection_parameters_as_url_query_parameters, username_and_password_envs},
1313
},
1414
};
@@ -50,12 +50,12 @@ impl MysqlConnection {
5050
}
5151
}
5252

53-
impl JDBCDatabaseConnection for MysqlConnection {
53+
impl JdbcDatabaseConnection for MysqlConnection {
5454
fn jdbc_connection_details_with_templating(
5555
&self,
5656
unique_database_name: &str,
5757
_templating_mechanism: &TemplatingMechanism,
58-
) -> Result<JDBCDatabaseConnectionDetails, crate::databases::Error> {
58+
) -> Result<JdbcDatabaseConnectionDetails, crate::databases::Error> {
5959
let Self {
6060
host,
6161
port,
@@ -72,7 +72,7 @@ impl JDBCDatabaseConnection for MysqlConnection {
7272
);
7373
let connection_uri = connection_uri.parse().context(ParseConnectionUrlSnafu)?;
7474

75-
Ok(JDBCDatabaseConnectionDetails {
75+
Ok(JdbcDatabaseConnectionDetails {
7676
driver: "com.mysql.jdbc.Driver".to_owned(),
7777
connection_uri,
7878
username_env: Some(username_env),

crates/stackable-operator/src/databases/databases/postgresql.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use crate::{
1010
TemplatingMechanism,
1111
drivers::{
1212
celery::{CeleryDatabaseConnection, CeleryDatabaseConnectionDetails},
13-
jdbc::{JDBCDatabaseConnection, JDBCDatabaseConnectionDetails},
14-
sqlalchemy::{SQLAlchemyDatabaseConnection, SQLAlchemyDatabaseConnectionDetails},
13+
jdbc::{JdbcDatabaseConnection, JdbcDatabaseConnectionDetails},
14+
sqlalchemy::{SqlAlchemyDatabaseConnection, SqlAlchemyDatabaseConnectionDetails},
1515
},
1616
helpers::{connection_parameters_as_url_query_parameters, username_and_password_envs},
1717
},
@@ -54,12 +54,12 @@ impl PostgresqlConnection {
5454
}
5555
}
5656

57-
impl JDBCDatabaseConnection for PostgresqlConnection {
57+
impl JdbcDatabaseConnection for PostgresqlConnection {
5858
fn jdbc_connection_details_with_templating(
5959
&self,
6060
unique_database_name: &str,
6161
_templating_mechanism: &TemplatingMechanism,
62-
) -> Result<JDBCDatabaseConnectionDetails, crate::databases::Error> {
62+
) -> Result<JdbcDatabaseConnectionDetails, crate::databases::Error> {
6363
let Self {
6464
host,
6565
port,
@@ -76,7 +76,7 @@ impl JDBCDatabaseConnection for PostgresqlConnection {
7676
);
7777
let connection_uri = connection_uri.parse().context(ParseConnectionUrlSnafu)?;
7878

79-
Ok(JDBCDatabaseConnectionDetails {
79+
Ok(JdbcDatabaseConnectionDetails {
8080
driver: "org.postgresql.Driver".to_owned(),
8181
connection_uri,
8282
username_env: Some(username_env),
@@ -85,12 +85,12 @@ impl JDBCDatabaseConnection for PostgresqlConnection {
8585
}
8686
}
8787

88-
impl SQLAlchemyDatabaseConnection for PostgresqlConnection {
88+
impl SqlAlchemyDatabaseConnection for PostgresqlConnection {
8989
fn sqlalchemy_connection_details_with_templating(
9090
&self,
9191
unique_database_name: &str,
9292
templating_mechanism: &TemplatingMechanism,
93-
) -> SQLAlchemyDatabaseConnectionDetails {
93+
) -> SqlAlchemyDatabaseConnectionDetails {
9494
let Self {
9595
host,
9696
port,
@@ -112,7 +112,7 @@ impl SQLAlchemyDatabaseConnection for PostgresqlConnection {
112112
"postgresql+psycopg2://${{{username_env_name}}}:${{{password_env_name}}}@{host}:{port}/{database}{parameters}",
113113
),
114114
};
115-
SQLAlchemyDatabaseConnectionDetails {
115+
SqlAlchemyDatabaseConnectionDetails {
116116
uri_template,
117117
username_env: Some(username_env),
118118
password_env: Some(password_env),

crates/stackable-operator/src/databases/drivers/jdbc.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::{
1212
///
1313
/// Provides a standardized way to obtain JDBC connection details (driver class, URI, and
1414
/// credential env vars) regardless of the concrete database type.
15-
pub trait JDBCDatabaseConnection {
15+
pub trait JdbcDatabaseConnection {
1616
/// Returns the JDBC connection details for the given `unique_database_name` using the
1717
/// default [`TemplatingMechanism`].
1818
///
@@ -22,7 +22,7 @@ pub trait JDBCDatabaseConnection {
2222
fn jdbc_connection_details(
2323
&self,
2424
unique_database_name: &str,
25-
) -> Result<JDBCDatabaseConnectionDetails, crate::databases::Error> {
25+
) -> Result<JdbcDatabaseConnectionDetails, crate::databases::Error> {
2626
self.jdbc_connection_details_with_templating(
2727
unique_database_name,
2828
&TemplatingMechanism::default(),
@@ -36,10 +36,10 @@ pub trait JDBCDatabaseConnection {
3636
&self,
3737
unique_database_name: &str,
3838
templating_mechanism: &TemplatingMechanism,
39-
) -> Result<JDBCDatabaseConnectionDetails, crate::databases::Error>;
39+
) -> Result<JdbcDatabaseConnectionDetails, crate::databases::Error>;
4040
}
4141

42-
pub struct JDBCDatabaseConnectionDetails {
42+
pub struct JdbcDatabaseConnectionDetails {
4343
/// The Java class name of the driver, e.g. `org.postgresql.Driver`
4444
pub driver: String,
4545

@@ -54,7 +54,7 @@ pub struct JDBCDatabaseConnectionDetails {
5454
pub password_env: Option<EnvVar>,
5555
}
5656

57-
impl JDBCDatabaseConnectionDetails {
57+
impl JdbcDatabaseConnectionDetails {
5858
pub fn add_to_container(&self, cb: &mut ContainerBuilder) {
5959
let env_vars = self.username_env.iter().chain(self.password_env.iter());
6060
cb.add_env_vars(env_vars.cloned());
@@ -68,7 +68,7 @@ impl JDBCDatabaseConnectionDetails {
6868
/// and a fully-formed JDBC URI as well as providing the needed classes on the Java classpath.
6969
#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)]
7070
#[serde(rename_all = "camelCase")]
71-
pub struct GenericJDBCDatabaseConnection {
71+
pub struct GenericJdbcDatabaseConnection {
7272
/// Fully-qualified Java class name of the JDBC driver, e.g. `org.postgresql.Driver` or
7373
/// `com.mysql.jdbc.Driver`. The driver JAR must be provided by you on the classpath.
7474
pub driver: String,
@@ -83,16 +83,16 @@ pub struct GenericJDBCDatabaseConnection {
8383
pub credentials_secret: String,
8484
}
8585

86-
impl JDBCDatabaseConnection for GenericJDBCDatabaseConnection {
86+
impl JdbcDatabaseConnection for GenericJdbcDatabaseConnection {
8787
fn jdbc_connection_details_with_templating(
8888
&self,
8989
unique_database_name: &str,
9090
_templating_mechanism: &TemplatingMechanism,
91-
) -> Result<JDBCDatabaseConnectionDetails, crate::databases::Error> {
91+
) -> Result<JdbcDatabaseConnectionDetails, crate::databases::Error> {
9292
let (username_env, password_env) =
9393
username_and_password_envs(unique_database_name, &self.credentials_secret);
9494

95-
Ok(JDBCDatabaseConnectionDetails {
95+
Ok(JdbcDatabaseConnectionDetails {
9696
driver: self.driver.clone(),
9797
connection_uri: self.uri.clone(),
9898
username_env: Some(username_env),

crates/stackable-operator/src/databases/drivers/sqlalchemy.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::{
1212
///
1313
/// Provides a standardized way to obtain a SQLAlchemy connection URI template together with the
1414
/// necessary credential environment variables, regardless of the concrete database type.
15-
pub trait SQLAlchemyDatabaseConnection {
15+
pub trait SqlAlchemyDatabaseConnection {
1616
/// Returns the SQLAlchemy connection details for the given `unique_database_name` using the
1717
/// default [`TemplatingMechanism`].
1818
///
@@ -22,7 +22,7 @@ pub trait SQLAlchemyDatabaseConnection {
2222
fn sqlalchemy_connection_details(
2323
&self,
2424
unique_database_name: &str,
25-
) -> SQLAlchemyDatabaseConnectionDetails {
25+
) -> SqlAlchemyDatabaseConnectionDetails {
2626
self.sqlalchemy_connection_details_with_templating(
2727
unique_database_name,
2828
&TemplatingMechanism::default(),
@@ -36,10 +36,10 @@ pub trait SQLAlchemyDatabaseConnection {
3636
&self,
3737
unique_database_name: &str,
3838
templating_mechanism: &TemplatingMechanism,
39-
) -> SQLAlchemyDatabaseConnectionDetails;
39+
) -> SqlAlchemyDatabaseConnectionDetails;
4040
}
4141

42-
pub struct SQLAlchemyDatabaseConnectionDetails {
42+
pub struct SqlAlchemyDatabaseConnectionDetails {
4343
/// The connection URI, which can contain env variable templates, e.g.
4444
/// `postgresql+psycopg2://${env:METADATA_DATABASE_USERNAME}:${env:METADATA_DATABASE_PASSWORD}@airflow-postgresql:5432/airflow`
4545
/// or
@@ -56,7 +56,7 @@ pub struct SQLAlchemyDatabaseConnectionDetails {
5656
pub generic_uri_var: Option<EnvVar>,
5757
}
5858

59-
impl SQLAlchemyDatabaseConnectionDetails {
59+
impl SqlAlchemyDatabaseConnectionDetails {
6060
pub fn env_vars(&self) -> impl Iterator<Item = &EnvVar> {
6161
[
6262
&self.username_env,
@@ -79,17 +79,17 @@ impl SQLAlchemyDatabaseConnectionDetails {
7979
/// full control over the connection string including any driver-specific options.
8080
#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)]
8181
#[serde(rename_all = "camelCase")]
82-
pub struct GenericSQLAlchemyDatabaseConnection {
82+
pub struct GenericSqlAlchemyDatabaseConnection {
8383
/// The name of the Secret that contains an `uri` key with the complete SQLAlchemy URI.
8484
pub uri_secret: String,
8585
}
8686

87-
impl SQLAlchemyDatabaseConnection for GenericSQLAlchemyDatabaseConnection {
87+
impl SqlAlchemyDatabaseConnection for GenericSqlAlchemyDatabaseConnection {
8888
fn sqlalchemy_connection_details_with_templating(
8989
&self,
9090
unique_database_name: &str,
9191
templating_mechanism: &TemplatingMechanism,
92-
) -> SQLAlchemyDatabaseConnectionDetails {
92+
) -> SqlAlchemyDatabaseConnectionDetails {
9393
let uri_env_name = format!(
9494
"{upper}_DATABASE_URI",
9595
upper = unique_database_name.to_uppercase()
@@ -100,7 +100,7 @@ impl SQLAlchemyDatabaseConnection for GenericSQLAlchemyDatabaseConnection {
100100
TemplatingMechanism::BashEnvSubstitution => format!("${{{uri_env_name}}}"),
101101
};
102102

103-
SQLAlchemyDatabaseConnectionDetails {
103+
SqlAlchemyDatabaseConnectionDetails {
104104
uri_template,
105105
username_env: None,
106106
password_env: None,

crates/stackable-operator/src/databases/tests.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ use crate::{
1010
databases::{postgresql::PostgresqlConnection, redis::RedisConnection},
1111
drivers::{
1212
celery::{CeleryDatabaseConnection, GenericCeleryDatabaseConnection},
13-
jdbc::{GenericJDBCDatabaseConnection, JDBCDatabaseConnection},
13+
jdbc::{GenericJdbcDatabaseConnection, JdbcDatabaseConnection},
1414
},
1515
},
1616
};
1717

1818
#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)]
1919
#[serde(rename_all = "camelCase")]
20-
enum DummyJDBCConnection {
20+
enum DummyJdbcConnection {
2121
Postgresql(PostgresqlConnection),
2222
#[allow(unused)]
23-
Generic(GenericJDBCDatabaseConnection),
23+
Generic(GenericJdbcDatabaseConnection),
2424
}
2525

26-
impl DummyJDBCConnection {
27-
fn as_jdbc_database_connection(&self) -> &dyn JDBCDatabaseConnection {
26+
impl DummyJdbcConnection {
27+
fn as_jdbc_database_connection(&self) -> &dyn JdbcDatabaseConnection {
2828
match self {
2929
Self::Postgresql(p) => p,
3030
Self::Generic(g) => g,
@@ -54,7 +54,7 @@ impl DummyCeleryConnection {
5454
#[test]
5555
fn test_dummy_jdbc_database_usage() {
5656
// Set up test data
57-
let dummy_jdbc_connection = DummyJDBCConnection::Postgresql(PostgresqlConnection {
57+
let dummy_jdbc_connection = DummyJdbcConnection::Postgresql(PostgresqlConnection {
5858
host: "my-database".parse().expect("static host is always valid"),
5959
port: 1234,
6060
database: "my_schema".to_owned(),

crates/xtask/src/crd/dummy.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use stackable_operator::{
99
redis::RedisConnection,
1010
},
1111
drivers::{
12-
celery::GenericCeleryDatabaseConnection, jdbc::GenericJDBCDatabaseConnection,
13-
sqlalchemy::GenericSQLAlchemyDatabaseConnection,
12+
celery::GenericCeleryDatabaseConnection, jdbc::GenericJdbcDatabaseConnection,
13+
sqlalchemy::GenericSqlAlchemyDatabaseConnection,
1414
},
1515
},
1616
deep_merger::ObjectOverrides,
@@ -128,8 +128,8 @@ pub mod versioned {
128128
Mysql(MysqlConnection),
129129
Derby(DerbyConnection),
130130
Redis(RedisConnection),
131-
GenericJDBC(GenericJDBCDatabaseConnection),
132-
GenericSQLAlchemy(GenericSQLAlchemyDatabaseConnection),
131+
GenericJdbc(GenericJdbcDatabaseConnection),
132+
GenericSqlAlchemy(GenericSqlAlchemyDatabaseConnection),
133133
GenericCelery(GenericCeleryDatabaseConnection),
134134
}
135135

0 commit comments

Comments
 (0)