aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-06-06 14:02:02 +0200
committerAlex Auvolat <alex@adnab.me>2022-06-06 14:02:02 +0200
commita77efd7ca6a02b9c668607e67efcaeeafd36a8bd (patch)
treec6313bf6fdba527cddc8971d30917ceefda9d6d3 /src
parent7f2cf0b809f1fc5741990e2bfff94dc3ec41a04f (diff)
downloadgarage-a77efd7ca6a02b9c668607e67efcaeeafd36a8bd.tar.gz
garage-a77efd7ca6a02b9c668607e67efcaeeafd36a8bd.zip
Safe choice: revert "Update rmp-serde"
This reverts commit 16e0a655d0d01e3871aee81a0a9660102d6df74e.
Diffstat (limited to 'src')
-rw-r--r--src/block/Cargo.toml2
-rw-r--r--src/garage/Cargo.toml2
-rw-r--r--src/garage/repair.rs4
-rw-r--r--src/model/Cargo.toml2
-rw-r--r--src/model/index_counter.rs8
-rw-r--r--src/model/key_table.rs2
-rw-r--r--src/model/migrate.rs2
-rw-r--r--src/model/s3/object_table.rs2
-rw-r--r--src/model/s3/version_table.rs2
-rw-r--r--src/rpc/Cargo.toml2
-rw-r--r--src/table/Cargo.toml2
-rw-r--r--src/table/data.rs2
-rw-r--r--src/table/merkle.rs2
-rw-r--r--src/util/Cargo.toml2
-rw-r--r--src/util/data.rs2
-rw-r--r--src/util/persister.rs4
16 files changed, 22 insertions, 20 deletions
diff --git a/src/block/Cargo.toml b/src/block/Cargo.toml
index 1a49947c..80346aca 100644
--- a/src/block/Cargo.toml
+++ b/src/block/Cargo.toml
@@ -28,7 +28,7 @@ tracing = "0.1.30"
rand = "0.8"
zstd = { version = "0.9", default-features = false }
-rmp-serde = "1.1"
+rmp-serde = "0.15"
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
serde_bytes = "0.11"
diff --git a/src/garage/Cargo.toml b/src/garage/Cargo.toml
index d5299291..eb643160 100644
--- a/src/garage/Cargo.toml
+++ b/src/garage/Cargo.toml
@@ -37,7 +37,7 @@ rand = "0.8"
async-trait = "0.1.7"
sodiumoxide = { version = "0.2.5-0", package = "kuska-sodiumoxide" }
-rmp-serde = "1.1"
+rmp-serde = "0.15"
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
serde_bytes = "0.11"
structopt = { version = "0.3", default-features = false }
diff --git a/src/garage/repair.rs b/src/garage/repair.rs
index ae28f351..75828f24 100644
--- a/src/garage/repair.rs
+++ b/src/garage/repair.rs
@@ -81,7 +81,7 @@ impl Repair {
info!("repair_versions: {}", i);
}
- let version = rmp_serde::decode::from_slice::<Version>(&item_bytes)?;
+ let version = rmp_serde::decode::from_read_ref::<_, Version>(&item_bytes)?;
if version.deleted.get() {
continue;
}
@@ -133,7 +133,7 @@ impl Repair {
info!("repair_block_ref: {}", i);
}
- let block_ref = rmp_serde::decode::from_slice::<BlockRef>(&item_bytes)?;
+ let block_ref = rmp_serde::decode::from_read_ref::<_, BlockRef>(&item_bytes)?;
if block_ref.deleted.get() {
continue;
}
diff --git a/src/model/Cargo.toml b/src/model/Cargo.toml
index 322feee1..d908dc01 100644
--- a/src/model/Cargo.toml
+++ b/src/model/Cargo.toml
@@ -31,7 +31,7 @@ tracing = "0.1.30"
rand = "0.8"
zstd = { version = "0.9", default-features = false }
-rmp-serde = "1.1"
+rmp-serde = "0.15"
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
serde_bytes = "0.11"
diff --git a/src/model/index_counter.rs b/src/model/index_counter.rs
index d8c1229a..6f81be3e 100644
--- a/src/model/index_counter.rs
+++ b/src/model/index_counter.rs
@@ -181,9 +181,11 @@ impl<T: CounterSchema> IndexCounter<T> {
let new_entry = self.local_counter.db().transaction(|mut tx| {
let mut entry = match tx.get(&self.local_counter, &tree_key[..])? {
- Some(old_bytes) => rmp_serde::decode::from_slice::<LocalCounterEntry>(&old_bytes)
- .map_err(Error::RmpDecode)
- .map_err(db::TxError::Abort)?,
+ Some(old_bytes) => {
+ rmp_serde::decode::from_read_ref::<_, LocalCounterEntry>(&old_bytes)
+ .map_err(Error::RmpDecode)
+ .map_err(db::TxError::Abort)?
+ }
None => LocalCounterEntry {
values: BTreeMap::new(),
},
diff --git a/src/model/key_table.rs b/src/model/key_table.rs
index 852bf607..330e83f0 100644
--- a/src/model/key_table.rs
+++ b/src/model/key_table.rs
@@ -175,7 +175,7 @@ impl TableSchema for KeyTable {
}
fn try_migrate(bytes: &[u8]) -> Option<Self::E> {
- let old_k = rmp_serde::decode::from_slice::<old::Key>(bytes).ok()?;
+ let old_k = rmp_serde::decode::from_read_ref::<_, old::Key>(bytes).ok()?;
let name = crdt::Lww::raw(old_k.name.timestamp(), old_k.name.get().clone());
let state = if old_k.deleted.get() {
diff --git a/src/model/migrate.rs b/src/model/migrate.rs
index bfd9845b..25acb4b0 100644
--- a/src/model/migrate.rs
+++ b/src/model/migrate.rs
@@ -28,7 +28,7 @@ impl Migrate {
let mut old_buckets = vec![];
for res in tree.iter().map_err(GarageError::from)? {
let (_k, v) = res.map_err(GarageError::from)?;
- let bucket = rmp_serde::decode::from_slice::<old_bucket::Bucket>(&v[..])
+ let bucket = rmp_serde::decode::from_read_ref::<_, old_bucket::Bucket>(&v[..])
.map_err(GarageError::from)?;
old_buckets.push(bucket);
}
diff --git a/src/model/s3/object_table.rs b/src/model/s3/object_table.rs
index c242b325..3d9a89f7 100644
--- a/src/model/s3/object_table.rs
+++ b/src/model/s3/object_table.rs
@@ -270,7 +270,7 @@ impl TableSchema for ObjectTable {
}
fn try_migrate(bytes: &[u8]) -> Option<Self::E> {
- let old_obj = rmp_serde::decode::from_slice::<old::Object>(bytes).ok()?;
+ let old_obj = rmp_serde::decode::from_read_ref::<_, old::Object>(bytes).ok()?;
Some(migrate_object(old_obj))
}
}
diff --git a/src/model/s3/version_table.rs b/src/model/s3/version_table.rs
index f67f2ff1..ad096772 100644
--- a/src/model/s3/version_table.rs
+++ b/src/model/s3/version_table.rs
@@ -168,7 +168,7 @@ impl TableSchema for VersionTable {
}
fn try_migrate(bytes: &[u8]) -> Option<Self::E> {
- let old = rmp_serde::decode::from_slice::<old::Version>(bytes).ok()?;
+ let old = rmp_serde::decode::from_read_ref::<_, old::Version>(bytes).ok()?;
let blocks = old
.blocks
diff --git a/src/rpc/Cargo.toml b/src/rpc/Cargo.toml
index 93df02a4..73328993 100644
--- a/src/rpc/Cargo.toml
+++ b/src/rpc/Cargo.toml
@@ -26,7 +26,7 @@ rand = "0.8"
sodiumoxide = { version = "0.2.5-0", package = "kuska-sodiumoxide" }
async-trait = "0.1.7"
-rmp-serde = "1.1"
+rmp-serde = "0.15"
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
serde_bytes = "0.11"
serde_json = "1.0"
diff --git a/src/table/Cargo.toml b/src/table/Cargo.toml
index 690d5a71..6de37cda 100644
--- a/src/table/Cargo.toml
+++ b/src/table/Cargo.toml
@@ -26,7 +26,7 @@ hexdump = "0.1"
tracing = "0.1.30"
rand = "0.8"
-rmp-serde = "1.1"
+rmp-serde = "0.15"
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
serde_bytes = "0.11"
diff --git a/src/table/data.rs b/src/table/data.rs
index fe8c5dbc..64ca9f14 100644
--- a/src/table/data.rs
+++ b/src/table/data.rs
@@ -300,7 +300,7 @@ where
}
pub fn decode_entry(&self, bytes: &[u8]) -> Result<F::E, Error> {
- match rmp_serde::decode::from_slice::<F::E>(bytes) {
+ match rmp_serde::decode::from_read_ref::<_, F::E>(bytes) {
Ok(x) => Ok(x),
Err(e) => match F::try_migrate(bytes) {
Some(x) => Ok(x),
diff --git a/src/table/merkle.rs b/src/table/merkle.rs
index dc67e8b7..138f3ca3 100644
--- a/src/table/merkle.rs
+++ b/src/table/merkle.rs
@@ -354,7 +354,7 @@ impl MerkleNode {
fn decode_opt(ent: &Option<db::Value>) -> Result<Self, Error> {
match ent {
None => Ok(MerkleNode::Empty),
- Some(v) => Ok(rmp_serde::decode::from_slice::<MerkleNode>(&v[..])?),
+ Some(v) => Ok(rmp_serde::decode::from_read_ref::<_, MerkleNode>(&v[..])?),
}
}
diff --git a/src/util/Cargo.toml b/src/util/Cargo.toml
index e68704ad..5d073436 100644
--- a/src/util/Cargo.toml
+++ b/src/util/Cargo.toml
@@ -25,7 +25,7 @@ rand = "0.8"
sha2 = "0.9"
chrono = "0.4"
-rmp-serde = "1.1"
+rmp-serde = "0.15"
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
serde_json = "1.0"
toml = "0.5"
diff --git a/src/util/data.rs b/src/util/data.rs
index 2ef976a5..7715c2cc 100644
--- a/src/util/data.rs
+++ b/src/util/data.rs
@@ -151,7 +151,7 @@ where
let mut wr = Vec::with_capacity(128);
let mut se = rmp_serde::Serializer::new(&mut wr)
.with_struct_map()
- .with_binary();
+ .with_string_variants();
val.serialize(&mut se)?;
Ok(wr)
}
diff --git a/src/util/persister.rs b/src/util/persister.rs
index d0759db7..9e1a1910 100644
--- a/src/util/persister.rs
+++ b/src/util/persister.rs
@@ -33,7 +33,7 @@ where
let mut bytes = vec![];
file.read_to_end(&mut bytes)?;
- let value = rmp_serde::decode::from_slice(&bytes[..])?;
+ let value = rmp_serde::decode::from_read_ref(&bytes[..])?;
Ok(value)
}
@@ -57,7 +57,7 @@ where
let mut bytes = vec![];
file.read_to_end(&mut bytes).await?;
- let value = rmp_serde::decode::from_slice(&bytes[..])?;
+ let value = rmp_serde::decode::from_read_ref(&bytes[..])?;
Ok(value)
}