Fix range queries and flaky tests (#4597)

This commit is contained in:
Tobie Morgan Hitchcock 2024-08-23 16:34:06 +01:00 committed by GitHub
parent 4c0e9aeef5
commit 6d4176549d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 55 additions and 55 deletions

View file

@ -24,13 +24,13 @@ pub fn new<'a>(ns: &'a str, db: &'a str, ac: &'a str) -> Ac<'a> {
pub fn prefix(ns: &str, db: &str) -> Vec<u8> { pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
let mut k = crate::key::database::all::new(ns, db).encode().unwrap(); let mut k = crate::key::database::all::new(ns, db).encode().unwrap();
k.extend_from_slice(&[b'!', b'a', b'c', 0x00]); k.extend_from_slice(b"!ac\x00");
k k
} }
pub fn suffix(ns: &str, db: &str) -> Vec<u8> { pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
let mut k = crate::key::database::all::new(ns, db).encode().unwrap(); let mut k = crate::key::database::all::new(ns, db).encode().unwrap();
k.extend_from_slice(&[b'!', b'a', b'c', 0xff]); k.extend_from_slice(b"!ac\xff");
k k
} }

View file

@ -26,13 +26,13 @@ pub fn new<'a>(ns: &'a str, db: &'a str, ac: &'a str, gr: &'a str) -> Gr<'a> {
pub fn prefix(ns: &str, db: &str, ac: &str) -> Vec<u8> { pub fn prefix(ns: &str, db: &str, ac: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db, ac).encode().unwrap(); let mut k = super::all::new(ns, db, ac).encode().unwrap();
k.extend_from_slice(&[b'!', b'g', b'r', 0x00]); k.extend_from_slice(b"!gr\x00");
k k
} }
pub fn suffix(ns: &str, db: &str, ac: &str) -> Vec<u8> { pub fn suffix(ns: &str, db: &str, ac: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db, ac).encode().unwrap(); let mut k = super::all::new(ns, db, ac).encode().unwrap();
k.extend_from_slice(&[b'!', b'g', b'r', 0xff]); k.extend_from_slice(b"!gr\xff");
k k
} }

View file

@ -24,13 +24,13 @@ pub fn new<'a>(ns: &'a str, db: &'a str, tb: &'a str) -> Az<'a> {
pub fn prefix(ns: &str, db: &str) -> Vec<u8> { pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db).encode().unwrap(); let mut k = super::all::new(ns, db).encode().unwrap();
k.extend_from_slice(&[b'!', b'a', b'z', 0x00]); k.extend_from_slice(b"!az\x00");
k k
} }
pub fn suffix(ns: &str, db: &str) -> Vec<u8> { pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db).encode().unwrap(); let mut k = super::all::new(ns, db).encode().unwrap();
k.extend_from_slice(&[b'!', b'a', b'z', 0xff]); k.extend_from_slice(b"!az\xff");
k k
} }

View file

@ -24,13 +24,13 @@ pub fn new<'a>(ns: &'a str, db: &'a str, fc: &'a str) -> Fc<'a> {
pub fn prefix(ns: &str, db: &str) -> Vec<u8> { pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db).encode().unwrap(); let mut k = super::all::new(ns, db).encode().unwrap();
k.extend_from_slice(&[b'!', b'f', b'n', 0x00]); k.extend_from_slice(b"!fn\x00");
k k
} }
pub fn suffix(ns: &str, db: &str) -> Vec<u8> { pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db).encode().unwrap(); let mut k = super::all::new(ns, db).encode().unwrap();
k.extend_from_slice(&[b'!', b'f', b'n', 0xff]); k.extend_from_slice(b"!fn\xff");
k k
} }

View file

@ -25,13 +25,13 @@ pub fn new<'a>(ns: &'a str, db: &'a str, ml: &'a str, vn: &'a str) -> Ml<'a> {
pub fn prefix(ns: &str, db: &str) -> Vec<u8> { pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db).encode().unwrap(); let mut k = super::all::new(ns, db).encode().unwrap();
k.extend_from_slice(&[b'!', b'm', b'l', 0x00]); k.extend_from_slice(b"!ml\x00");
k k
} }
pub fn suffix(ns: &str, db: &str) -> Vec<u8> { pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db).encode().unwrap(); let mut k = super::all::new(ns, db).encode().unwrap();
k.extend_from_slice(&[b'!', b'm', b'l', 0xff]); k.extend_from_slice(b"!ml\xff");
k k
} }

View file

@ -24,13 +24,13 @@ pub fn new<'a>(ns: &'a str, db: &'a str, pa: &'a str) -> Pa<'a> {
pub fn prefix(ns: &str, db: &str) -> Vec<u8> { pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db).encode().unwrap(); let mut k = super::all::new(ns, db).encode().unwrap();
k.extend_from_slice(&[b'!', b'p', b'a', 0x00]); k.extend_from_slice(b"!pa\x00");
k k
} }
pub fn suffix(ns: &str, db: &str) -> Vec<u8> { pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db).encode().unwrap(); let mut k = super::all::new(ns, db).encode().unwrap();
k.extend_from_slice(&[b'!', b'p', b'a', 0xff]); k.extend_from_slice(b"!pa\xff");
k k
} }

View file

@ -24,13 +24,13 @@ pub fn new<'a>(ns: &'a str, db: &'a str, tb: &'a str) -> Tb<'a> {
pub fn prefix(ns: &str, db: &str) -> Vec<u8> { pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db).encode().unwrap(); let mut k = super::all::new(ns, db).encode().unwrap();
k.extend_from_slice(&[b'!', b't', b'b', 0x00]); k.extend_from_slice(b"!tb\x00");
k k
} }
pub fn suffix(ns: &str, db: &str) -> Vec<u8> { pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db).encode().unwrap(); let mut k = super::all::new(ns, db).encode().unwrap();
k.extend_from_slice(&[b'!', b't', b'b', 0xff]); k.extend_from_slice(b"!tb\xff");
k k
} }

View file

@ -27,15 +27,15 @@ pub fn new<'a>(ns: &'a str, db: &'a str, ts: u64) -> Ts<'a> {
/// Returns the prefix for the whole database timestamps /// Returns the prefix for the whole database timestamps
pub fn prefix(ns: &str, db: &str) -> Vec<u8> { pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
let mut k = crate::key::database::all::new(ns, db).encode().unwrap(); let mut k = super::all::new(ns, db).encode().unwrap();
k.extend_from_slice(b"!ts"); k.extend_from_slice(b"!ts\x00");
k k
} }
/// Returns the prefix for the whole database timestamps /// Returns the prefix for the whole database timestamps
pub fn suffix(ns: &str, db: &str) -> Vec<u8> { pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
let mut k = prefix(ns, db); let mut k = super::all::new(ns, db).encode().unwrap();
k.extend_from_slice(&[0xff]); k.extend_from_slice(b"!ts\xff");
k k
} }

View file

@ -24,13 +24,13 @@ pub fn new<'a>(ns: &'a str, db: &'a str, user: &'a str) -> Us<'a> {
pub fn prefix(ns: &str, db: &str) -> Vec<u8> { pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db).encode().unwrap(); let mut k = super::all::new(ns, db).encode().unwrap();
k.extend_from_slice(&[b'!', b'u', b's', 0x00]); k.extend_from_slice(b"!us\x00");
k k
} }
pub fn suffix(ns: &str, db: &str) -> Vec<u8> { pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db).encode().unwrap(); let mut k = super::all::new(ns, db).encode().unwrap();
k.extend_from_slice(&[b'!', b'u', b's', 0xff]); k.extend_from_slice(b"!us\xff");
k k
} }

View file

@ -22,13 +22,13 @@ pub fn new<'a>(ns: &'a str, ac: &'a str) -> Ac<'a> {
pub fn prefix(ns: &str) -> Vec<u8> { pub fn prefix(ns: &str) -> Vec<u8> {
let mut k = crate::key::namespace::all::new(ns).encode().unwrap(); let mut k = crate::key::namespace::all::new(ns).encode().unwrap();
k.extend_from_slice(&[b'!', b'a', b'c', 0x00]); k.extend_from_slice(b"!ac\x00");
k k
} }
pub fn suffix(ns: &str) -> Vec<u8> { pub fn suffix(ns: &str) -> Vec<u8> {
let mut k = crate::key::namespace::all::new(ns).encode().unwrap(); let mut k = crate::key::namespace::all::new(ns).encode().unwrap();
k.extend_from_slice(&[b'!', b'a', b'c', 0xff]); k.extend_from_slice(b"!ac\xff");
k k
} }

View file

@ -24,13 +24,13 @@ pub fn new<'a>(ns: &'a str, ac: &'a str, gr: &'a str) -> Gr<'a> {
pub fn prefix(ns: &str, ac: &str) -> Vec<u8> { pub fn prefix(ns: &str, ac: &str) -> Vec<u8> {
let mut k = super::all::new(ns, ac).encode().unwrap(); let mut k = super::all::new(ns, ac).encode().unwrap();
k.extend_from_slice(&[b'!', b'g', b'r', 0x00]); k.extend_from_slice(b"!gr\x00");
k k
} }
pub fn suffix(ns: &str, ac: &str) -> Vec<u8> { pub fn suffix(ns: &str, ac: &str) -> Vec<u8> {
let mut k = super::all::new(ns, ac).encode().unwrap(); let mut k = super::all::new(ns, ac).encode().unwrap();
k.extend_from_slice(&[b'!', b'g', b'r', 0xff]); k.extend_from_slice(b"!gr\xff");
k k
} }

View file

@ -22,13 +22,13 @@ pub fn new<'a>(ns: &'a str, db: &'a str) -> Db<'a> {
pub fn prefix(ns: &str) -> Vec<u8> { pub fn prefix(ns: &str) -> Vec<u8> {
let mut k = super::all::new(ns).encode().unwrap(); let mut k = super::all::new(ns).encode().unwrap();
k.extend_from_slice(&[b'!', b'd', b'b', 0x00]); k.extend_from_slice(b"!db\x00");
k k
} }
pub fn suffix(ns: &str) -> Vec<u8> { pub fn suffix(ns: &str) -> Vec<u8> {
let mut k = super::all::new(ns).encode().unwrap(); let mut k = super::all::new(ns).encode().unwrap();
k.extend_from_slice(&[b'!', b'd', b'b', 0xff]); k.extend_from_slice(b"!db\xff");
k k
} }

View file

@ -22,13 +22,13 @@ pub fn new<'a>(ns: &'a str, user: &'a str) -> Us<'a> {
pub fn prefix(ns: &str) -> Vec<u8> { pub fn prefix(ns: &str) -> Vec<u8> {
let mut k = super::all::new(ns).encode().unwrap(); let mut k = super::all::new(ns).encode().unwrap();
k.extend_from_slice(&[b'!', b'u', b's', 0x00]); k.extend_from_slice(b"!us\x00");
k k
} }
pub fn suffix(ns: &str) -> Vec<u8> { pub fn suffix(ns: &str) -> Vec<u8> {
let mut k = super::all::new(ns).encode().unwrap(); let mut k = super::all::new(ns).encode().unwrap();
k.extend_from_slice(&[b'!', b'u', b's', 0xff]); k.extend_from_slice(b"!us\xff");
k k
} }

View file

@ -30,13 +30,13 @@ pub fn new(nd: Uuid, lq: Uuid) -> Lq {
pub fn prefix(nd: Uuid) -> Vec<u8> { pub fn prefix(nd: Uuid) -> Vec<u8> {
let mut k = super::all::new(nd).encode().unwrap(); let mut k = super::all::new(nd).encode().unwrap();
k.extend_from_slice(&[b'!', b'l', b'q', 0x00]); k.extend_from_slice(b"!lq\x00");
k k
} }
pub fn suffix(nd: Uuid) -> Vec<u8> { pub fn suffix(nd: Uuid) -> Vec<u8> {
let mut k = super::all::new(nd).encode().unwrap(); let mut k = super::all::new(nd).encode().unwrap();
k.extend_from_slice(&[b'!', b'l', b'q', 0xff]); k.extend_from_slice(b"!lq\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00");
k k
} }
@ -103,7 +103,7 @@ mod tests {
assert_eq!( assert_eq!(
val, val,
b"/$\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\ b"/$\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\
!lq\xff" !lq\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00"
); );
} }
} }

View file

@ -20,13 +20,13 @@ pub fn new(ac: &str) -> Ac<'_> {
pub fn prefix() -> Vec<u8> { pub fn prefix() -> Vec<u8> {
let mut k = crate::key::root::all::new().encode().unwrap(); let mut k = crate::key::root::all::new().encode().unwrap();
k.extend_from_slice(&[b'!', b'a', b'c', 0x00]); k.extend_from_slice(b"!ac\x00");
k k
} }
pub fn suffix() -> Vec<u8> { pub fn suffix() -> Vec<u8> {
let mut k = crate::key::root::all::new().encode().unwrap(); let mut k = crate::key::root::all::new().encode().unwrap();
k.extend_from_slice(&[b'!', b'a', b'c', 0xff]); k.extend_from_slice(b"!ac\xff");
k k
} }

View file

@ -22,13 +22,13 @@ pub fn new<'a>(ac: &'a str, gr: &'a str) -> Gr<'a> {
pub fn prefix(ac: &str) -> Vec<u8> { pub fn prefix(ac: &str) -> Vec<u8> {
let mut k = super::all::new(ac).encode().unwrap(); let mut k = super::all::new(ac).encode().unwrap();
k.extend_from_slice(&[b'!', b'g', b'r', 0x00]); k.extend_from_slice(b"!gr\x00");
k k
} }
pub fn suffix(ac: &str) -> Vec<u8> { pub fn suffix(ac: &str) -> Vec<u8> {
let mut k = super::all::new(ac).encode().unwrap(); let mut k = super::all::new(ac).encode().unwrap();
k.extend_from_slice(&[b'!', b'g', b'r', 0xff]); k.extend_from_slice(b"!gr\xff");
k k
} }

View file

@ -24,13 +24,13 @@ pub fn new(nd: Uuid) -> Nd {
pub fn prefix() -> Vec<u8> { pub fn prefix() -> Vec<u8> {
let mut k = crate::key::root::all::new().encode().unwrap(); let mut k = crate::key::root::all::new().encode().unwrap();
k.extend_from_slice(&[b'!', b'n', b'd', 0x00]); k.extend_from_slice(b"!nd\x00");
k k
} }
pub fn suffix() -> Vec<u8> { pub fn suffix() -> Vec<u8> {
let mut k = crate::key::root::all::new().encode().unwrap(); let mut k = crate::key::root::all::new().encode().unwrap();
k.extend_from_slice(&[b'!', b'n', b'd', 0xff]); k.extend_from_slice(b"!nd\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00");
k k
} }
@ -72,6 +72,6 @@ mod tests {
#[test] #[test]
fn test_suffix() { fn test_suffix() {
let val = super::suffix(); let val = super::suffix();
assert_eq!(val, b"/!nd\xff") assert_eq!(val, b"/!nd\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00")
} }
} }

View file

@ -20,13 +20,13 @@ pub fn new(ns: &str) -> Ns<'_> {
pub fn prefix() -> Vec<u8> { pub fn prefix() -> Vec<u8> {
let mut k = super::all::new().encode().unwrap(); let mut k = super::all::new().encode().unwrap();
k.extend_from_slice(&[b'!', b'n', b's', 0x00]); k.extend_from_slice(b"!ns\x00");
k k
} }
pub fn suffix() -> Vec<u8> { pub fn suffix() -> Vec<u8> {
let mut k = super::all::new().encode().unwrap(); let mut k = super::all::new().encode().unwrap();
k.extend_from_slice(&[b'!', b'n', b's', 0xff]); k.extend_from_slice(b"!ns\xff");
k k
} }

View file

@ -20,13 +20,13 @@ pub fn new(user: &str) -> Us<'_> {
pub fn prefix() -> Vec<u8> { pub fn prefix() -> Vec<u8> {
let mut k = super::all::new().encode().unwrap(); let mut k = super::all::new().encode().unwrap();
k.extend_from_slice(&[b'!', b'u', b's', 0x00]); k.extend_from_slice(b"!us\x00");
k k
} }
pub fn suffix() -> Vec<u8> { pub fn suffix() -> Vec<u8> {
let mut k = super::all::new().encode().unwrap(); let mut k = super::all::new().encode().unwrap();
k.extend_from_slice(&[b'!', b'u', b's', 0xff]); k.extend_from_slice(b"!us\xff");
k k
} }

View file

@ -26,13 +26,13 @@ pub fn new<'a>(ns: &'a str, db: &'a str, tb: &'a str, ev: &'a str) -> Ev<'a> {
pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> { pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db, tb).encode().unwrap(); let mut k = super::all::new(ns, db, tb).encode().unwrap();
k.extend_from_slice(&[b'!', b'e', b'v', 0x00]); k.extend_from_slice(b"!ev\x00");
k k
} }
pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> { pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db, tb).encode().unwrap(); let mut k = super::all::new(ns, db, tb).encode().unwrap();
k.extend_from_slice(&[b'!', b'e', b'v', 0xff]); k.extend_from_slice(b"!ev\xff");
k k
} }

View file

@ -26,13 +26,13 @@ pub fn new<'a>(ns: &'a str, db: &'a str, tb: &'a str, fd: &'a str) -> Fd<'a> {
pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> { pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db, tb).encode().unwrap(); let mut k = super::all::new(ns, db, tb).encode().unwrap();
k.extend_from_slice(&[b'!', b'f', b'd', 0x00]); k.extend_from_slice(b"!fd\x00");
k k
} }
pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> { pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db, tb).encode().unwrap(); let mut k = super::all::new(ns, db, tb).encode().unwrap();
k.extend_from_slice(&[b'!', b'f', b'd', 0xff]); k.extend_from_slice(b"!fd\xff");
k k
} }

View file

@ -26,13 +26,13 @@ pub fn new<'a>(ns: &'a str, db: &'a str, tb: &'a str, ft: &'a str) -> Ft<'a> {
pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> { pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db, tb).encode().unwrap(); let mut k = super::all::new(ns, db, tb).encode().unwrap();
k.extend_from_slice(&[b'!', b'f', b't', 0x00]); k.extend_from_slice(b"!ft\x00");
k k
} }
pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> { pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db, tb).encode().unwrap(); let mut k = super::all::new(ns, db, tb).encode().unwrap();
k.extend_from_slice(&[b'!', b'f', b't', 0xff]); k.extend_from_slice(b"!ft\xff");
k k
} }

View file

@ -26,13 +26,13 @@ pub fn new<'a>(ns: &'a str, db: &'a str, tb: &'a str, ix: &'a str) -> Ix<'a> {
pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> { pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db, tb).encode().unwrap(); let mut k = super::all::new(ns, db, tb).encode().unwrap();
k.extend_from_slice(&[b'!', b'i', b'x', 0x00]); k.extend_from_slice(b"!ix\x00");
k k
} }
pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> { pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db, tb).encode().unwrap(); let mut k = super::all::new(ns, db, tb).encode().unwrap();
k.extend_from_slice(&[b'!', b'i', b'x', 0xff]); k.extend_from_slice(b"!ix\xff");
k k
} }

View file

@ -32,13 +32,13 @@ pub fn new<'a>(ns: &'a str, db: &'a str, tb: &'a str, lq: Uuid) -> Lq<'a> {
pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> { pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db, tb).encode().unwrap(); let mut k = super::all::new(ns, db, tb).encode().unwrap();
k.extend_from_slice(b"!lq\0"); k.extend_from_slice(b"!lq\x00");
k k
} }
pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> { pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
let mut k = super::all::new(ns, db, tb).encode().unwrap(); let mut k = super::all::new(ns, db, tb).encode().unwrap();
k.extend_from_slice(b"!lq\xff"); k.extend_from_slice(b"!lq\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00");
k k
} }
@ -93,6 +93,6 @@ mod tests {
#[test] #[test]
fn suffix() { fn suffix() {
let val = super::suffix("testns", "testdb", "testtb"); let val = super::suffix("testns", "testdb", "testtb");
assert_eq!(val, b"/*testns\x00*testdb\x00*testtb\x00!lq\xff") assert_eq!(val, b"/*testns\x00*testdb\x00*testtb\x00!lq\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00")
} }
} }

View file

@ -25,13 +25,13 @@ pub fn new<'a>(ns: &'a str, db: &'a str, tb: &'a str, id: &Id) -> Thing<'a> {
pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> { pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
let mut k = crate::key::table::all::new(ns, db, tb).encode().unwrap(); let mut k = crate::key::table::all::new(ns, db, tb).encode().unwrap();
k.extend_from_slice(&[b'*', 0x00]); k.extend_from_slice(b"*\x00");
k k
} }
pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> { pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
let mut k = crate::key::table::all::new(ns, db, tb).encode().unwrap(); let mut k = crate::key::table::all::new(ns, db, tb).encode().unwrap();
k.extend_from_slice(&[b'*', 0xff]); k.extend_from_slice(b"*\xff");
k k
} }