Skip to content

Commit

Permalink
refactor: replace kecab-case with snake_case
Browse files Browse the repository at this point in the history
  • Loading branch information
niebayes committed Dec 18, 2023
1 parent 4be162d commit c3efada
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions config/metasrv.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ first_heartbeat_estimate = "1000ms"

[wal]
# Available wal providers:
# - "raft-engine" (default)
# - "raft_engine" (default)
# - "kafka"
provider = "raft-engine"
provider = "raft_engine"

# There're none raft-engine wal config since meta srv only involves in remote wal currently.

Expand All @@ -58,8 +58,8 @@ broker_endpoints = ["127.0.0.1:9090"]
num_topics = 64
# Topic selector type.
# Available selector types:
# - "round-robin" (default)
selector_type = "round-robin"
# - "round_robin" (default)
selector_type = "round_robin"
# A Kafka topic is constructed by concatenating `topic_name_prefix` and `topic_id`.
topic_name_prefix = "greptimedb_kafka_wal"
# Number of partitions per topic.
Expand Down
12 changes: 6 additions & 6 deletions src/common/meta/src/wal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub const WAL_OPTIONS_KEY: &str = "wal_options";
#[serde(tag = "provider")]
pub enum WalConfig {
#[default]
#[serde(rename = "raft-engine")]
#[serde(rename = "raft_engine")]
RaftEngine,
#[serde(rename = "kafka")]
Kafka(KafkaConfig),
Expand All @@ -48,7 +48,7 @@ pub enum WalConfig {
#[serde(tag = "wal.provider")]
pub enum WalOptions {
#[default]
#[serde(rename = "raft-engine")]
#[serde(rename = "raft_engine")]
RaftEngine,
#[serde(rename = "kafka")]
#[serde(with = "prefix_wal_kafka")]
Expand All @@ -66,14 +66,14 @@ mod tests {
fn test_serde_wal_config() {
// Test serde raft-engine wal config with none other wal config.
let toml_str = r#"
provider = "raft-engine"
provider = "raft_engine"
"#;
let wal_config: WalConfig = toml::from_str(toml_str).unwrap();
assert_eq!(wal_config, WalConfig::RaftEngine);

// Test serde raft-engine wal config with extra other wal config.
let toml_str = r#"
provider = "raft-engine"
provider = "raft_engine"
broker_endpoints = ["127.0.0.1:9090"]
num_topics = 32
"#;
Expand All @@ -85,7 +85,7 @@ mod tests {
provider = "kafka"
broker_endpoints = ["127.0.0.1:9090"]
num_topics = 32
selector_type = "round-robin"
selector_type = "round_robin"
topic_name_prefix = "greptimedb_kafka_wal"
num_partitions = 1
replication_factor = 3
Expand All @@ -107,7 +107,7 @@ mod tests {
// Test serde raft-engine wal options.
let wal_options = WalOptions::RaftEngine;
let encoded = serde_json::to_string(&wal_options).unwrap();
let expected = r#"{"wal.provider":"raft-engine"}"#;
let expected = r#"{"wal.provider":"raft_engine"}"#;
assert_eq!(&encoded, expected);

let decoded: WalOptions = serde_json::from_str(&encoded).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/common/meta/src/wal/kafka/topic_selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::wal::kafka::topic::Topic;
#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
pub enum SelectorType {
#[default]
#[serde(rename = "round-robin")]
#[serde(rename = "round_robin")]
RoundRobin,
}

Expand Down

0 comments on commit c3efada

Please sign in to comment.