diff options
author | Alex Auvolat <alex@adnab.me> | 2023-01-26 16:20:41 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-01-26 16:20:41 +0100 |
commit | 94d559ae00bdb899c4463667a9d950b27e5bb23c (patch) | |
tree | a734a4d05cbedfaaff4f3bf63a0b659499b797bb /src/model/k2v/causality.rs | |
parent | c7d0ad0aa0e492b913c5dda8ff1a7ad5a579fb3a (diff) | |
parent | 5fb383fe4c248181e27df12a57849886e50bacb7 (diff) | |
download | garage-94d559ae00bdb899c4463667a9d950b27e5bb23c.tar.gz garage-94d559ae00bdb899c4463667a9d950b27e5bb23c.zip |
Merge branch 'main' into report-disk-usage
Diffstat (limited to 'src/model/k2v/causality.rs')
-rw-r--r-- | src/model/k2v/causality.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/model/k2v/causality.rs b/src/model/k2v/causality.rs index 9a692870..62488d53 100644 --- a/src/model/k2v/causality.rs +++ b/src/model/k2v/causality.rs @@ -1,3 +1,5 @@ +use base64::prelude::*; + use std::collections::BTreeMap; use std::convert::TryInto; @@ -41,11 +43,12 @@ 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 pub fn parse(s: &str) -> Result<Self, String> { - let bytes = base64::decode_config(s, base64::URL_SAFE_NO_PAD) + let bytes = BASE64_URL_SAFE_NO_PAD + .decode(s) .map_err(|e| format!("bad causality token base64: {}", e))?; if bytes.len() % 16 != 8 || bytes.len() < 8 { return Err("bad causality token length".into()); |