aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/model')
-rw-r--r--src/model/Cargo.toml8
-rw-r--r--src/model/k2v/causality.rs5
-rw-r--r--src/model/k2v/item_table.rs4
-rw-r--r--src/model/k2v/seen.rs5
4 files changed, 12 insertions, 10 deletions
diff --git a/src/model/Cargo.toml b/src/model/Cargo.toml
index 323c2d64..d1c7cd29 100644
--- a/src/model/Cargo.toml
+++ b/src/model/Cargo.toml
@@ -22,13 +22,13 @@ garage_util = { version = "0.8.1", path = "../util" }
async-trait = "0.1.7"
arc-swap = "1.0"
-blake2 = "0.9"
+blake2 = "0.10"
err-derive = "0.3"
hex = "0.4"
-base64 = "0.13"
-tracing = "0.1.30"
+base64 = "0.21"
+tracing = "0.1"
rand = "0.8"
-zstd = { version = "0.9", default-features = false }
+zstd = { version = "0.12", default-features = false }
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
serde_bytes = "0.11"
diff --git a/src/model/k2v/causality.rs b/src/model/k2v/causality.rs
index b1ec8035..c80ebd39 100644
--- a/src/model/k2v/causality.rs
+++ b/src/model/k2v/causality.rs
@@ -7,6 +7,7 @@
//! "causality token", is used in the API and must be sent along with
//! each write or delete operation to indicate the previously seen
//! versions that we want to overwrite or delete.
+use base64::prelude::*;
use std::collections::BTreeMap;
use std::convert::TryInto;
@@ -67,13 +68,13 @@ impl CausalContext {
bytes.extend(u64::to_be_bytes(i));
}
- base64::encode_config(bytes, base64::URL_SAFE_NO_PAD)
+ BASE64_URL_SAFE_NO_PAD.encode(bytes)
}
/// Parse from base64-encoded binary representation.
/// Returns None on error.
pub fn parse(s: &str) -> Option<Self> {
- let bytes = base64::decode_config(s, base64::URL_SAFE_NO_PAD).ok()?;
+ let bytes = BASE64_URL_SAFE_NO_PAD.decode(s).ok()?;
if bytes.len() % 16 != 8 || bytes.len() < 8 {
return None;
}
diff --git a/src/model/k2v/item_table.rs b/src/model/k2v/item_table.rs
index bc2b1aef..28646f37 100644
--- a/src/model/k2v/item_table.rs
+++ b/src/model/k2v/item_table.rs
@@ -176,9 +176,9 @@ impl Crdt for DvvsEntry {
impl PartitionKey for K2VItemPartition {
fn hash(&self) -> Hash {
- use blake2::{Blake2b, Digest};
+ use blake2::{Blake2b512, Digest};
- let mut hasher = Blake2b::new();
+ let mut hasher = Blake2b512::new();
hasher.update(self.bucket_id.as_slice());
hasher.update(self.partition_key.as_bytes());
let mut hash = [0u8; 32];
diff --git a/src/model/k2v/seen.rs b/src/model/k2v/seen.rs
index 314d0f9e..51098710 100644
--- a/src/model/k2v/seen.rs
+++ b/src/model/k2v/seen.rs
@@ -9,6 +9,7 @@
use std::collections::BTreeMap;
+use base64::prelude::*;
use serde::{Deserialize, Serialize};
use garage_util::data::Uuid;
@@ -78,12 +79,12 @@ impl RangeSeenMarker {
let bytes = nonversioned_encode(&self)?;
let bytes = zstd::stream::encode_all(&mut &bytes[..], zstd::DEFAULT_COMPRESSION_LEVEL)?;
- Ok(base64::encode(&bytes))
+ Ok(BASE64_STANDARD.encode(&bytes))
}
/// Decode from msgpack+zstd+b64 representation, returns None on error.
pub fn decode(s: &str) -> Option<Self> {
- let bytes = base64::decode(&s).ok()?;
+ let bytes = BASE64_STANDARD.decode(&s).ok()?;
let bytes = zstd::stream::decode_all(&mut &bytes[..]).ok()?;
nonversioned_decode(&bytes).ok()
}