diff options
author | Alex Auvolat <alex@adnab.me> | 2022-03-28 16:20:15 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-03-28 16:26:04 +0200 |
commit | 0091002ef2fe5761cc6c325490be2f01b2090600 (patch) | |
tree | c99498ac7050d2267513336d4013f270656d874b /src/table/replication | |
parent | 8f9cf3a5d10dafc28b717e89c8c5944c2de1b2f7 (diff) | |
download | garage-0091002ef2fe5761cc6c325490be2f01b2090600.tar.gz garage-0091002ef2fe5761cc6c325490be2f01b2090600.zip |
New replication modes and their documentationfeature/documentation
Diffstat (limited to 'src/table/replication')
-rw-r--r-- | src/table/replication/mode.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/table/replication/mode.rs b/src/table/replication/mode.rs index 32687288..c6f84c45 100644 --- a/src/table/replication/mode.rs +++ b/src/table/replication/mode.rs @@ -1,7 +1,10 @@ pub enum ReplicationMode { None, TwoWay, + TwoWayDangerous, ThreeWay, + ThreeWayDegraded, + ThreeWayDangerous, } impl ReplicationMode { @@ -9,7 +12,10 @@ impl ReplicationMode { match v { "none" | "1" => Some(Self::None), "2" => Some(Self::TwoWay), + "2-dangerous" => Some(Self::TwoWayDangerous), "3" => Some(Self::ThreeWay), + "3-degraded" => Some(Self::ThreeWayDegraded), + "3-dangerous" => Some(Self::ThreeWayDangerous), _ => None, } } @@ -24,16 +30,17 @@ impl ReplicationMode { pub fn replication_factor(&self) -> usize { match self { Self::None => 1, - Self::TwoWay => 2, - Self::ThreeWay => 3, + Self::TwoWay | Self::TwoWayDangerous => 2, + Self::ThreeWay | Self::ThreeWayDegraded | Self::ThreeWayDangerous => 3, } } pub fn read_quorum(&self) -> usize { match self { Self::None => 1, - Self::TwoWay => 1, + Self::TwoWay | Self::TwoWayDangerous => 1, Self::ThreeWay => 2, + Self::ThreeWayDegraded | Self::ThreeWayDangerous => 1, } } @@ -41,7 +48,9 @@ impl ReplicationMode { match self { Self::None => 1, Self::TwoWay => 2, - Self::ThreeWay => 2, + Self::TwoWayDangerous => 1, + Self::ThreeWay | Self::ThreeWayDegraded => 2, + Self::ThreeWayDangerous => 1, } } } |