aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/api/Cargo.toml8
-rw-r--r--src/garage/Cargo.toml14
-rw-r--r--src/garage/cli.rs8
-rw-r--r--src/model/Cargo.toml8
-rw-r--r--src/rpc/Cargo.toml6
-rw-r--r--src/rpc/membership.rs20
-rw-r--r--src/rpc/ring.rs28
-rw-r--r--src/table/Cargo.toml6
-rw-r--r--src/util/Cargo.toml2
-rw-r--r--src/web/Cargo.toml10
10 files changed, 71 insertions, 39 deletions
diff --git a/src/api/Cargo.toml b/src/api/Cargo.toml
index b9fc4bfc..8b5118cd 100644
--- a/src/api/Cargo.toml
+++ b/src/api/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "garage_api"
-version = "0.2.1"
+version = "0.3.0"
authors = ["Alex Auvolat <alex@adnab.me>"]
edition = "2018"
license = "AGPL-3.0"
@@ -13,9 +13,9 @@ path = "lib.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-garage_model = { version = "0.2.1", path = "../model" }
-garage_table = { version = "0.2.1", path = "../table" }
-garage_util = { version = "0.2.1", path = "../util" }
+garage_model = { version = "0.3.0", path = "../model" }
+garage_table = { version = "0.3.0", path = "../table" }
+garage_util = { version = "0.3.0", path = "../util" }
base64 = "0.13"
bytes = "1.0"
diff --git a/src/garage/Cargo.toml b/src/garage/Cargo.toml
index b6fc139b..09ed3e1e 100644
--- a/src/garage/Cargo.toml
+++ b/src/garage/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "garage"
-version = "0.2.1"
+version = "0.3.0"
authors = ["Alex Auvolat <alex@adnab.me>"]
edition = "2018"
license = "AGPL-3.0"
@@ -14,12 +14,12 @@ path = "main.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-garage_api = { version = "0.2.1", path = "../api" }
-garage_model = { version = "0.2.1", path = "../model" }
-garage_rpc = { version = "0.2.1", path = "../rpc" }
-garage_table = { version = "0.2.1", path = "../table" }
-garage_util = { version = "0.2.1", path = "../util" }
-garage_web = { version = "0.2.1", path = "../web" }
+garage_api = { version = "0.3.0", path = "../api" }
+garage_model = { version = "0.3.0", path = "../model" }
+garage_rpc = { version = "0.3.0", path = "../rpc" }
+garage_table = { version = "0.3.0", path = "../table" }
+garage_util = { version = "0.3.0", path = "../util" }
+garage_web = { version = "0.3.0", path = "../web" }
bytes = "1.0"
git-version = "0.3.4"
diff --git a/src/garage/cli.rs b/src/garage/cli.rs
index 30d5726e..0ddb5a1c 100644
--- a/src/garage/cli.rs
+++ b/src/garage/cli.rs
@@ -467,9 +467,7 @@ pub async fn cmd_configure(
"Please specify a capacity with the -c flag, or set node explicitly as gateway with -g".into())),
};
NetworkConfigEntry {
- zone: args
- .zone
- .expect("Please specifiy a zone with the -z flag"),
+ zone: args.zone.expect("Please specifiy a zone with the -z flag"),
capacity,
tag: args.tag.unwrap_or_default(),
}
@@ -481,9 +479,7 @@ pub async fn cmd_configure(
_ => old.capacity,
};
NetworkConfigEntry {
- zone: args
- .zone
- .unwrap_or_else(|| old.zone.to_string()),
+ zone: args.zone.unwrap_or_else(|| old.zone.to_string()),
capacity,
tag: args.tag.unwrap_or_else(|| old.tag.to_string()),
}
diff --git a/src/model/Cargo.toml b/src/model/Cargo.toml
index 77084531..4d5d7f9d 100644
--- a/src/model/Cargo.toml
+++ b/src/model/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "garage_model"
-version = "0.2.1"
+version = "0.3.0"
authors = ["Alex Auvolat <alex@adnab.me>"]
edition = "2018"
license = "AGPL-3.0"
@@ -13,9 +13,9 @@ path = "lib.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-garage_rpc = { version = "0.2.1", path = "../rpc" }
-garage_table = { version = "0.2.1", path = "../table" }
-garage_util = { version = "0.2.1", path = "../util" }
+garage_rpc = { version = "0.3.0", path = "../rpc" }
+garage_table = { version = "0.3.0", path = "../table" }
+garage_util = { version = "0.3.0", path = "../util" }
arc-swap = "1.0"
hex = "0.4"
diff --git a/src/rpc/Cargo.toml b/src/rpc/Cargo.toml
index 622f8ebc..f1204cdf 100644
--- a/src/rpc/Cargo.toml
+++ b/src/rpc/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "garage_rpc"
-version = "0.2.1"
+version = "0.3.0"
authors = ["Alex Auvolat <alex@adnab.me>"]
edition = "2018"
license = "AGPL-3.0"
@@ -13,7 +13,9 @@ path = "lib.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-garage_util = { version = "0.2.1", path = "../util" }
+garage_util = { version = "0.3.0", path = "../util" }
+
+garage_rpc_021 = { package = "garage_rpc", version = "0.2.1" }
arc-swap = "1.0"
bytes = "1.0"
diff --git a/src/rpc/membership.rs b/src/rpc/membership.rs
index 37cf8105..72477539 100644
--- a/src/rpc/membership.rs
+++ b/src/rpc/membership.rs
@@ -240,11 +240,21 @@ impl System {
let net_config = match persist_config.load() {
Ok(x) => x,
Err(e) => {
- info!(
- "No valid previous network configuration stored ({}), starting fresh.",
- e
- );
- NetworkConfig::new()
+ match Persister::<garage_rpc_021::ring::NetworkConfig>::new(
+ &metadata_dir,
+ "network_config",
+ )
+ .load()
+ {
+ Ok(old_config) => NetworkConfig::migrate_from_021(old_config),
+ Err(e2) => {
+ info!(
+ "No valid previous network configuration stored ({}, {}), starting fresh.",
+ e, e2
+ );
+ NetworkConfig::new()
+ }
+ }
}
};
diff --git a/src/rpc/ring.rs b/src/rpc/ring.rs
index a5e5d4af..90db8fd2 100644
--- a/src/rpc/ring.rs
+++ b/src/rpc/ring.rs
@@ -38,6 +38,31 @@ impl NetworkConfig {
version: 0,
}
}
+
+ pub(crate) fn migrate_from_021(old: garage_rpc_021::ring::NetworkConfig) -> Self {
+ let members = old
+ .members
+ .into_iter()
+ .map(|(id, conf)| {
+ (
+ Hash::try_from(id.as_slice()).unwrap(),
+ NetworkConfigEntry {
+ zone: conf.datacenter,
+ capacity: if conf.capacity == 0 {
+ None
+ } else {
+ Some(conf.capacity)
+ },
+ tag: conf.tag,
+ },
+ )
+ })
+ .collect();
+ Self {
+ members,
+ version: old.version,
+ }
+ }
}
/// The overall configuration of one (possibly remote) node
@@ -178,8 +203,7 @@ impl Ring {
.iter()
.map(|(_id, info)| info.zone.as_str())
.collect::<HashSet<&str>>();
- if (p_zns.len() < n_zones
- && !p_zns.contains(&node_info.zone.as_str()))
+ if (p_zns.len() < n_zones && !p_zns.contains(&node_info.zone.as_str()))
|| (p_zns.len() == n_zones
&& !partitions[qv].iter().any(|(id, _i)| id == node_id))
{
diff --git a/src/table/Cargo.toml b/src/table/Cargo.toml
index 9b7e905c..ccbd1748 100644
--- a/src/table/Cargo.toml
+++ b/src/table/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "garage_table"
-version = "0.2.1"
+version = "0.3.0"
authors = ["Alex Auvolat <alex@adnab.me>"]
edition = "2018"
license = "AGPL-3.0"
@@ -13,8 +13,8 @@ path = "lib.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-garage_rpc = { version = "0.2.1", path = "../rpc" }
-garage_util = { version = "0.2.1", path = "../util" }
+garage_rpc = { version = "0.3.0", path = "../rpc" }
+garage_util = { version = "0.3.0", path = "../util" }
bytes = "1.0"
hexdump = "0.1"
diff --git a/src/util/Cargo.toml b/src/util/Cargo.toml
index 79611752..91e0b2b9 100644
--- a/src/util/Cargo.toml
+++ b/src/util/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "garage_util"
-version = "0.2.1"
+version = "0.3.0"
authors = ["Alex Auvolat <alex@adnab.me>"]
edition = "2018"
license = "AGPL-3.0"
diff --git a/src/web/Cargo.toml b/src/web/Cargo.toml
index 6c3b3a9a..dc31c1b4 100644
--- a/src/web/Cargo.toml
+++ b/src/web/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "garage_web"
-version = "0.2.1"
+version = "0.3.0"
authors = ["Alex Auvolat <alex@adnab.me>", "Quentin Dufour <quentin@dufour.io>"]
edition = "2018"
license = "AGPL-3.0"
@@ -13,10 +13,10 @@ path = "lib.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-garage_api = { version = "0.2.1", path = "../api" }
-garage_model = { version = "0.2.1", path = "../model" }
-garage_util = { version = "0.2.1", path = "../util" }
-garage_table = { version = "0.2.1", path = "../table" }
+garage_api = { version = "0.3.0", path = "../api" }
+garage_model = { version = "0.3.0", path = "../model" }
+garage_util = { version = "0.3.0", path = "../util" }
+garage_table = { version = "0.3.0", path = "../table" }
err-derive = "0.3"
idna = "0.2"