From 1a13dd26295f758102b7ee48df20009f2c8f58a0 Mon Sep 17 00:00:00 2001 From: Irach Ramos Date: Fri, 27 Sep 2024 10:17:20 +0200 Subject: [PATCH] code review --- golem-common/src/config.rs | 1 + golem-test-framework/src/config/cli.rs | 1 + golem-test-framework/src/config/env.rs | 1 + golem-worker-executor-base/src/cassandra.rs | 29 +++++++++------------ 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/golem-common/src/config.rs b/golem-common/src/config.rs index d517c02fa..30022a6b6 100644 --- a/golem-common/src/config.rs +++ b/golem-common/src/config.rs @@ -479,6 +479,7 @@ pub struct CassandraConfig { pub username: Option, pub password: Option, } + fn default_cassandra_keyspace() -> String { String::from("__golem") } diff --git a/golem-test-framework/src/config/cli.rs b/golem-test-framework/src/config/cli.rs index 1a69ac6eb..b4344b998 100644 --- a/golem-test-framework/src/config/cli.rs +++ b/golem-test-framework/src/config/cli.rs @@ -1085,6 +1085,7 @@ impl TestDependencies for CliTestDependencies { fn worker_executor_cluster(&self) -> Arc { self.worker_executor_cluster.clone() } + fn cassandra( &self, ) -> Arc { diff --git a/golem-test-framework/src/config/env.rs b/golem-test-framework/src/config/env.rs index 6daec22d3..40f84f45c 100644 --- a/golem-test-framework/src/config/env.rs +++ b/golem-test-framework/src/config/env.rs @@ -525,6 +525,7 @@ impl TestDependencies for EnvBasedTestDependencies { fn worker_executor_cluster(&self) -> Arc { self.worker_executor_cluster.clone() } + fn cassandra(&self) -> Arc { self.cassandra.clone() } diff --git a/golem-worker-executor-base/src/cassandra.rs b/golem-worker-executor-base/src/cassandra.rs index 3ba0b3695..f6b219d7f 100644 --- a/golem-worker-executor-base/src/cassandra.rs +++ b/golem-worker-executor-base/src/cassandra.rs @@ -83,13 +83,12 @@ impl CassandraSession { .query_unpaged( Query::new(format!( r#" - CREATE TABLE IF NOT EXISTS {}.kv_store ( - namespace TEXT, - key TEXT, - value BLOB, - PRIMARY KEY (namespace, key) - ); - "#, + CREATE TABLE IF NOT EXISTS {}.kv_store ( + namespace TEXT, + key TEXT, + value BLOB, + PRIMARY KEY (namespace, key) + );"#, self.keyspace )), &[], @@ -101,13 +100,12 @@ impl CassandraSession { .query_unpaged( Query::new(format!( r#" - CREATE TABLE IF NOT EXISTS {}.kv_sets ( - namespace TEXT, - key TEXT, - value BLOB, - PRIMARY KEY ((namespace, key), value) - ); - "#, + CREATE TABLE IF NOT EXISTS {}.kv_sets ( + namespace TEXT, + key TEXT, + value BLOB, + PRIMARY KEY ((namespace, key), value) + );"#, self.keyspace )), &[], @@ -125,8 +123,7 @@ impl CassandraSession { score DOUBLE, value BLOB, PRIMARY KEY ((namespace, key), score, value) - ); - "#, + );"#, self.keyspace )), &[],