refactor: Rename field to not contain the type

pull/24376/head
Carol (Nichols || Goulding) 2021-06-17 16:53:32 -04:00
parent 3a329d3705
commit 83e50cfba4
7 changed files with 12 additions and 14 deletions

View File

@ -55,7 +55,7 @@ pub struct DatabaseRules {
pub worker_cleanup_avg_sleep: Duration,
/// An optional connection string to a write buffer.
pub write_buffer_connection_string: Option<String>,
pub write_buffer_connection: Option<String>,
}
#[derive(Debug, Eq, PartialEq, Clone)]
@ -86,7 +86,7 @@ impl DatabaseRules {
lifecycle_rules: Default::default(),
routing_rules: None,
worker_cleanup_avg_sleep: Duration::from_secs(500),
write_buffer_connection_string: None,
write_buffer_connection: None,
}
}

View File

@ -106,7 +106,7 @@ message DatabaseRules {
google.protobuf.Duration worker_cleanup_avg_sleep = 10;
// Optionally, the address of the write buffer
string write_buffer_connection_string = 11;
string write_buffer_connection = 11;
}
message RoutingConfig {

View File

@ -21,9 +21,7 @@ impl From<DatabaseRules> for management::DatabaseRules {
lifecycle_rules: Some(rules.lifecycle_rules.into()),
routing_rules: rules.routing_rules.map(Into::into),
worker_cleanup_avg_sleep: Some(rules.worker_cleanup_avg_sleep.into()),
write_buffer_connection_string: rules
.write_buffer_connection_string
.unwrap_or_default(),
write_buffer_connection: rules.write_buffer_connection.unwrap_or_default(),
}
}
}
@ -54,7 +52,7 @@ impl TryFrom<management::DatabaseRules> for DatabaseRules {
None => Duration::from_secs(500),
};
let write_buffer_connection_string = proto.write_buffer_connection_string.optional();
let write_buffer_connection = proto.write_buffer_connection.optional();
Ok(Self {
name,
@ -62,7 +60,7 @@ impl TryFrom<management::DatabaseRules> for DatabaseRules {
lifecycle_rules,
routing_rules,
worker_cleanup_avg_sleep,
write_buffer_connection_string,
write_buffer_connection,
})
}
}

View File

@ -1220,7 +1220,7 @@ mod tests {
},
routing_rules: None,
worker_cleanup_avg_sleep: Duration::from_secs(2),
write_buffer_connection_string: None,
write_buffer_connection: None,
};
// Create a database
@ -1312,7 +1312,7 @@ mod tests {
lifecycle_rules: Default::default(),
routing_rules: None,
worker_cleanup_avg_sleep: Duration::from_secs(2),
write_buffer_connection_string: None,
write_buffer_connection: None,
};
// Create a database

View File

@ -17,7 +17,7 @@ pub fn new(rules: &DatabaseRules) -> Result<Option<Arc<dyn WriteBuffer>>, WriteB
// trait, so always use `KafkaBuffer` when there is a write buffer connection string
// specified. If/when there are other kinds of write buffers, additional configuration will
// be needed to determine what kind of write buffer to use here.
match rules.write_buffer_connection_string.as_ref() {
match rules.write_buffer_connection.as_ref() {
Some(conn) => {
let kafka_buffer = KafkaBuffer::new(conn, name)?;

View File

@ -225,7 +225,7 @@ async fn test_create_get_update_database() {
seconds: 2,
nanos: 0,
}),
write_buffer_connection_string: "".into(),
write_buffer_connection: "".into(),
};
client

View File

@ -60,9 +60,9 @@ async fn writes_go_to_kafka() {
// set up a database with a write buffer pointing at kafka
let server = ServerFixture::create_shared().await;
let db_name = rand_name();
let write_buffer_connection_string = kafka_connection.to_string();
let write_buffer_connection = kafka_connection.to_string();
create_readable_database_plus(&db_name, server.grpc_channel(), |mut rules| {
rules.write_buffer_connection_string = write_buffer_connection_string;
rules.write_buffer_connection = write_buffer_connection;
rules
})
.await;