Skip to content

Commit

Permalink
Remove unused config for partitioning_scheme
Browse files Browse the repository at this point in the history
Since we only support consistent-hashing, let's not include configs that
are not used
  • Loading branch information
rcmgleite committed Jul 21, 2024
1 parent a96ceb6 commit b6c03d9
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 23 deletions.
2 changes: 0 additions & 2 deletions conf/node_1.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"port": 3001,
"storage_engine": "in_memory",
"quorum": {
"n": 3,
"r": 2,
"w": 2
},
"partitioning_scheme": "consistent_hashing",
"heartbeat": {
"fanout": 2,
"interval": 500
Expand Down
2 changes: 0 additions & 2 deletions conf/node_2.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"port": 3002,
"storage_engine": "in_memory",
"quorum": {
"n": 3,
"r": 2,
"w": 2
},
"partitioning_scheme": "consistent_hashing",
"heartbeat": {
"fanout": 2,
"interval": 500
Expand Down
2 changes: 0 additions & 2 deletions conf/node_3.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"port": 3003,
"storage_engine": "in_memory",
"quorum": {
"n": 3,
"r": 2,
"w": 2
},
"partitioning_scheme": "consistent_hashing",
"heartbeat": {
"fanout": 2,
"interval": 500
Expand Down
10 changes: 1 addition & 9 deletions src/server/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use serde::{Deserialize, Serialize};
#[serde(rename_all = "snake_case")]
pub struct Config {
pub port: u16,
pub partitioning_scheme: PartitioningScheme,
pub quorum: Quorum,
pub heartbeat: Heartbeat,
}
Expand Down Expand Up @@ -40,17 +39,11 @@ pub struct Heartbeat {
pub interval: usize,
}

#[derive(Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum PartitioningScheme {
ConsistentHashing,
}

#[cfg(test)]
mod tests {
use std::path::PathBuf;

use crate::server::config::{Heartbeat, PartitioningScheme, Quorum};
use crate::server::config::{Heartbeat, Quorum};

use super::Config;

Expand All @@ -67,7 +60,6 @@ mod tests {
config,
Config {
port: 3001,
partitioning_scheme: PartitioningScheme::ConsistentHashing,
quorum: Quorum {
replicas: 3,
reads: 2,
Expand Down
12 changes: 5 additions & 7 deletions src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,11 @@ impl Server {

// configure the partitioning_scheme. This step already
// includes the node itself to the ring.
let cluster_state = match config.partitioning_scheme {
config::PartitioningScheme::ConsistentHashing => Arc::new(State::new(
Box::<ConsistentHashing>::default(),
client_listener.local_addr().unwrap().to_string().into(),
config.quorum,
)?),
};
let cluster_state = Arc::new(State::new(
Box::<ConsistentHashing>::default(),
client_listener.local_addr().unwrap().to_string().into(),
config.quorum,
)?);

// FIXME: There's a big problem here - if this task exists how will
// the node know that it has to shutdown? Something to be fixed soon...
Expand Down
1 change: 0 additions & 1 deletion tests/conf/test_node_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"r": 2,
"w": 2
},
"partitioning_scheme": "consistent_hashing",
"heartbeat": {
"fanout": 10,
"interval": 200
Expand Down

0 comments on commit b6c03d9

Please sign in to comment.