From b490ebc7f6058719bd22c86fd0db95b09dc027d6 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 28 May 2021 12:36:22 +0200 Subject: Many improvements on ring/replication and its configuration: - Explicit "replication_mode" configuration parameters that takes either "none", "2" or "3" as values, instead of letting user configure replication factor themselves. These are presets whose corresponding replication/quorum values can be found in replication/mode.rs - Explicit support for single-node and two-node deployments (number of nodes must be at least "replication_mode", with "none" we can have only one node) - Ring is now stored much more compactly with 256*8 + n*32 bytes, instead of 256*32 bytes - Support for gateway-only nodes that do not store data (these nodes still need a metadata_directory to store the list of bucket and keys since those are stored on all nodes; it also technically needs a data_directory to start but it will stay empty unless we have bugs) --- src/util/config.rs | 46 ++++++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 28 deletions(-) (limited to 'src/util') diff --git a/src/util/config.rs b/src/util/config.rs index 093b3850..46b918a9 100644 --- a/src/util/config.rs +++ b/src/util/config.rs @@ -15,6 +15,17 @@ pub struct Config { /// Path where to store data. Can be slower, but need higher volume pub data_dir: PathBuf, + /// Size of data blocks to save to disk + #[serde(default = "default_block_size")] + pub block_size: usize, + + /// Replication mode. Supported values: + /// - none, 1 -> no replication + /// - 2 -> 2-way replication + /// - 3 -> 3-way replication + // (we can add more aliases for this later) + pub replication_mode: String, + /// Address to bind for RPC pub rpc_bind_addr: SocketAddr, @@ -26,6 +37,13 @@ pub struct Config { /// Consul service name to use pub consul_service_name: Option, + /// Configuration for RPC TLS + pub rpc_tls: Option, + + /// Max number of concurrent RPC request + #[serde(default = "default_max_concurrent_rpc_requests")] + pub max_concurrent_rpc_requests: usize, + /// Sled cache size, in bytes #[serde(default = "default_sled_cache_capacity")] pub sled_cache_capacity: u64, @@ -34,28 +52,6 @@ pub struct Config { #[serde(default = "default_sled_flush_every_ms")] pub sled_flush_every_ms: u64, - /// Max number of concurrent RPC request - #[serde(default = "default_max_concurrent_rpc_requests")] - pub max_concurrent_rpc_requests: usize, - - /// Size of data blocks to save to disk - #[serde(default = "default_block_size")] - pub block_size: usize, - - #[serde(default = "default_control_write_max_faults")] - pub control_write_max_faults: usize, - - /// How many nodes should hold a copy of meta data - #[serde(default = "default_replication_factor")] - pub meta_replication_factor: usize, - - /// How many nodes should hold a copy of data - #[serde(default = "default_replication_factor")] - pub data_replication_factor: usize, - - /// Configuration for RPC TLS - pub rpc_tls: Option, - /// Configuration for S3 api pub s3_api: ApiConfig, @@ -106,12 +102,6 @@ fn default_max_concurrent_rpc_requests() -> usize { fn default_block_size() -> usize { 1048576 } -fn default_replication_factor() -> usize { - 3 -} -fn default_control_write_max_faults() -> usize { - 1 -} /// Read and parse configuration pub fn read_config(config_file: PathBuf) -> Result { -- cgit v1.2.3