Allow to set the key context periodicity

This commit is contained in:
Rodolphe Bréard 2024-03-09 11:50:27 +01:00
parent 9e3cfc2fd6
commit e735198f6a

View file

@ -9,6 +9,10 @@ pub struct KeyContext {
} }
impl KeyContext { impl KeyContext {
pub fn set_periodicity(&mut self, periodicity: u64) {
self.periodicity = Some(periodicity);
}
pub(crate) fn get_value(&self, time_period: Option<u64>) -> Vec<Vec<u8>> { pub(crate) fn get_value(&self, time_period: Option<u64>) -> Vec<Vec<u8>> {
let mut ret: Vec<Vec<u8>> = self.ctx.iter().map(|s| s.as_bytes().to_vec()).collect(); let mut ret: Vec<Vec<u8>> = self.ctx.iter().map(|s| s.as_bytes().to_vec()).collect();
if let Some(tp) = time_period { if let Some(tp) = time_period {