aboutsummaryrefslogtreecommitdiff
path: root/src/util/config.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-05-28 12:36:22 +0200
committerAlex Auvolat <alex@adnab.me>2021-05-28 14:07:36 +0200
commitb490ebc7f6058719bd22c86fd0db95b09dc027d6 (patch)
treee1c59ce1c348c2c63e1b2604369997216ef554d1 /src/util/config.rs
parentc8aa1eb481c18b1a35ef45d37071ab1af804a382 (diff)
downloadgarage-b490ebc7f6058719bd22c86fd0db95b09dc027d6.tar.gz
garage-b490ebc7f6058719bd22c86fd0db95b09dc027d6.zip
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)
Diffstat (limited to 'src/util/config.rs')
-rw-r--r--src/util/config.rs46
1 files changed, 18 insertions, 28 deletions
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<String>,
+ /// Configuration for RPC TLS
+ pub rpc_tls: Option<TlsConfig>,
+
+ /// 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<TlsConfig>,
-
/// 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<Config, Error> {