diff options
author | Heyang Zhou <zhy20000919@hotmail.com> | 2023-03-23 04:53:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-22 21:53:16 +0100 |
commit | 533e33131f1d697375f35fb6b7e1be5b9d84d4bf (patch) | |
tree | b4066eed05da5b4d9b244a600a7cb17d2694fb6d /ext/kv/codec.rs | |
parent | a117d3d91ed2d647ed53e79b0f900f0ec4d1b08d (diff) |
fix(ext/kv): reverse mapping between `AnyValue::Bool` and `KeyPart::Bool` (#18365)
Previously the mapping between `AnyValue::Bool` and `KeyPart::Bool` was
inverted.
This patch also allows using the empty key `[]` as range start/end to
`snapshot_read`.
Diffstat (limited to 'ext/kv/codec.rs')
-rw-r--r-- | ext/kv/codec.rs | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/ext/kv/codec.rs b/ext/kv/codec.rs index b2acfdbc2..522c2e9bc 100644 --- a/ext/kv/codec.rs +++ b/ext/kv/codec.rs @@ -34,14 +34,6 @@ pub fn canonicalize_f64(n: f64) -> f64 { } pub fn encode_key(key: &Key) -> std::io::Result<Vec<u8>> { - // Disallow empty key - if key.0.is_empty() { - return Err(std::io::Error::new( - std::io::ErrorKind::InvalidInput, - "key should not be empty", - )); - } - let mut output: Vec<u8> = vec![]; for part in &key.0 { match part { @@ -73,14 +65,6 @@ pub fn encode_key(key: &Key) -> std::io::Result<Vec<u8>> { } pub fn decode_key(mut bytes: &[u8]) -> std::io::Result<Key> { - // Disallow empty key - if bytes.is_empty() { - return Err(std::io::Error::new( - std::io::ErrorKind::InvalidInput, - "key should not be empty", - )); - } - let mut key = Key(vec![]); while !bytes.is_empty() { let tag = bytes[0]; |