diff options
author | Alex Auvolat <alex@adnab.me> | 2023-01-26 16:46:40 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-01-26 16:46:40 +0100 |
commit | 590a0a84505c0bee8ddd8fcd8de6f340319da097 (patch) | |
tree | 14009c0feea6c27cdf36fe85a21dc22753da8653 /src/model/k2v/causality.rs | |
parent | dac254a6e7413498df0e3b626769c2d2be3a4cfb (diff) | |
parent | 611792ddcf86f0a728e22abaa6e172d3679d5ca6 (diff) | |
download | garage-590a0a84505c0bee8ddd8fcd8de6f340319da097.tar.gz garage-590a0a84505c0bee8ddd8fcd8de6f340319da097.zip |
Merge branch 'main' into k2v-watch-range-2
Diffstat (limited to 'src/model/k2v/causality.rs')
-rw-r--r-- | src/model/k2v/causality.rs | 5 |
1 files changed, 3 insertions, 2 deletions
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; } |