use crate::key_composer::{KeyComposer, KeyTag, SmallKey};
#[inline]
pub fn meta(kc: &KeyComposer<'_>, key: &[u8]) -> SmallKey {
kc.compose_meta_key_stack(KeyTag::TimeSeriesMeta.as_slice(), key)
}
#[inline]
pub fn meta_prefix(kc: &KeyComposer<'_>) -> Vec<u8> {
kc.compose_meta_prefix(KeyTag::TimeSeriesMeta.as_slice())
}
#[inline]
pub fn item(kc: &KeyComposer<'_>, key: &[u8], timestamp: u64) -> SmallKey {
kc.compose_subkey_stack(
KeyTag::TimeSeriesData.as_slice(),
key,
×tamp.to_be_bytes(),
)
}
#[inline]
pub fn prefix(kc: &KeyComposer<'_>, key: &[u8]) -> Vec<u8> {
kc.compose_prefix(KeyTag::TimeSeriesData.as_slice(), key)
}
#[inline]
pub fn prefix_stack(kc: &KeyComposer<'_>, key: &[u8]) -> SmallKey {
kc.compose_prefix_stack(KeyTag::TimeSeriesData.as_slice(), key)
}
#[inline]
pub fn downstream_meta(kc: &KeyComposer<'_>, src_key: &[u8], dst_key: &[u8]) -> SmallKey {
kc.compose_subkey2_stack(KeyTag::TimeSeriesData.as_slice(), src_key, b"\xFF", dst_key)
}
#[inline]
pub fn downstream_prefix(kc: &KeyComposer<'_>, src_key: &[u8]) -> Vec<u8> {
let mut buf = Vec::new();
kc.compose_prefix_into_with_extra(KeyTag::TimeSeriesData.as_slice(), src_key, 1, &mut buf);
buf.push(0xFF);
buf
}