use crate::key_composer::{KeyComposer, KeyTag, SmallKey};
#[inline]
pub fn meta(kc: &KeyComposer<'_>, key: &[u8]) -> SmallKey {
kc.compose_meta_key_stack(KeyTag::SortedIntMeta.as_slice(), key)
}
#[inline]
pub fn prefix(kc: &KeyComposer<'_>, key: &[u8]) -> Vec<u8> {
kc.compose_prefix(KeyTag::SortedIntData.as_slice(), key)
}
#[inline]
pub fn prefix_stack(kc: &KeyComposer<'_>, key: &[u8]) -> SmallKey {
kc.compose_prefix_stack(KeyTag::SortedIntData.as_slice(), key)
}
#[inline]
pub fn item(prefix: &[u8], id: u64) -> SmallKey {
let mut sk = SmallKey::from_slice(prefix);
sk.extend_from_slice(&id.to_be_bytes());
sk
}
#[inline]
pub fn key(kc: &KeyComposer<'_>, key_bytes: &[u8], id: u64) -> SmallKey {
kc.compose_subkey_stack(
KeyTag::SortedIntData.as_slice(),
key_bytes,
&id.to_be_bytes(),
)
}