mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
Merge branch 'main' of github.com:betrusted-io/xous-core into main
This commit is contained in:
commit
efc680ed36
2 changed files with 8 additions and 8 deletions
|
|
@ -332,7 +332,7 @@ impl BasisCache {
|
||||||
small_pool: Vec::<KeySmallPool>::new(),
|
small_pool: Vec::<KeySmallPool>::new(),
|
||||||
small_pool_free: BinaryHeap::<KeySmallPoolOrd>::new(),
|
small_pool_free: BinaryHeap::<KeySmallPoolOrd>::new(),
|
||||||
aad: my_aad,
|
aad: my_aad,
|
||||||
tt: ticktimer_server::Ticktimer::new().unwrap(),
|
created: std::time::Instant::now(),
|
||||||
};
|
};
|
||||||
log::debug!("adding dictionary {}", name);
|
log::debug!("adding dictionary {}", name);
|
||||||
basis.dicts.insert(String::from(name), dict_cache);
|
basis.dicts.insert(String::from(name), dict_cache);
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ pub(crate) struct DictCacheEntry {
|
||||||
/// copy of our AAD, for convenience
|
/// copy of our AAD, for convenience
|
||||||
pub(crate) aad: Vec::<u8>,
|
pub(crate) aad: Vec::<u8>,
|
||||||
/// ticktimer reference, for managing atimes
|
/// ticktimer reference, for managing atimes
|
||||||
pub(crate) tt: ticktimer_server::Ticktimer,
|
pub(crate) created: std::time::Instant,
|
||||||
}
|
}
|
||||||
impl DictCacheEntry {
|
impl DictCacheEntry {
|
||||||
pub fn new(dict: Dictionary, index: usize, aad: &Vec<u8>) -> DictCacheEntry {
|
pub fn new(dict: Dictionary, index: usize, aad: &Vec<u8>) -> DictCacheEntry {
|
||||||
|
|
@ -82,7 +82,7 @@ impl DictCacheEntry {
|
||||||
small_pool: Vec::<KeySmallPool>::new(),
|
small_pool: Vec::<KeySmallPool>::new(),
|
||||||
small_pool_free: BinaryHeap::<KeySmallPoolOrd>::new(),
|
small_pool_free: BinaryHeap::<KeySmallPoolOrd>::new(),
|
||||||
aad: my_aad,
|
aad: my_aad,
|
||||||
tt: ticktimer_server::Ticktimer::new().unwrap(),
|
created: std::time::Instant::now(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Populates cache entries, reporting the maximum extent of large alloc data seen so far.
|
/// Populates cache entries, reporting the maximum extent of large alloc data seen so far.
|
||||||
|
|
@ -160,7 +160,7 @@ impl DictCacheEntry {
|
||||||
descriptor_index: NonZeroU32::new(try_entry as u32).unwrap(),
|
descriptor_index: NonZeroU32::new(try_entry as u32).unwrap(),
|
||||||
clean: true,
|
clean: true,
|
||||||
data: None,
|
data: None,
|
||||||
atime: self.tt.elapsed_ms(),
|
atime: self.created.elapsed().as_millis() as u64,
|
||||||
};
|
};
|
||||||
let kname = std::str::from_utf8(&keydesc.name.data[..keydesc.name.len as usize]).expect("key is not valid utf-8");
|
let kname = std::str::from_utf8(&keydesc.name.data[..keydesc.name.len as usize]).expect("key is not valid utf-8");
|
||||||
let key_exists_and_valid =
|
let key_exists_and_valid =
|
||||||
|
|
@ -263,7 +263,7 @@ impl DictCacheEntry {
|
||||||
descriptor_index: NonZeroU32::new(try_entry as u32).unwrap(),
|
descriptor_index: NonZeroU32::new(try_entry as u32).unwrap(),
|
||||||
clean: true,
|
clean: true,
|
||||||
data: None,
|
data: None,
|
||||||
atime: self.tt.elapsed_ms(),
|
atime: self.created.elapsed().as_millis() as u64,
|
||||||
};
|
};
|
||||||
self.keys.insert(kname.to_string(), kcache);
|
self.keys.insert(kname.to_string(), kcache);
|
||||||
self.try_fill_small_key(hw, v2p_map, cipher, &mut data_cache, &kname);
|
self.try_fill_small_key(hw, v2p_map, cipher, &mut data_cache, &kname);
|
||||||
|
|
@ -374,7 +374,7 @@ impl DictCacheEntry {
|
||||||
self.clean = false;
|
self.clean = false;
|
||||||
if self.ensure_key_entry(hw, v2p_map, cipher, name) {
|
if self.ensure_key_entry(hw, v2p_map, cipher, name) {
|
||||||
let kcache = self.keys.get_mut(name).expect("Entry was assured, but then not there!");
|
let kcache = self.keys.get_mut(name).expect("Entry was assured, but then not there!");
|
||||||
kcache.set_atime(self.tt.elapsed_ms());
|
kcache.set_atime(self.created.elapsed().as_millis() as u64);
|
||||||
kcache.clean = false;
|
kcache.clean = false;
|
||||||
// the update isn't going to fit in the reserved space, remove it, and re-insert it with an entirely new entry.
|
// the update isn't going to fit in the reserved space, remove it, and re-insert it with an entirely new entry.
|
||||||
if kcache.reserved < (data.len() + offset) as u64 {
|
if kcache.reserved < (data.len() + offset) as u64 {
|
||||||
|
|
@ -640,7 +640,7 @@ impl DictCacheEntry {
|
||||||
clean: false,
|
clean: false,
|
||||||
data: alloc_data
|
data: alloc_data
|
||||||
})),
|
})),
|
||||||
atime: self.tt.elapsed_ms(),
|
atime: self.created.elapsed().as_millis() as u64,
|
||||||
};
|
};
|
||||||
self.keys.insert(name.to_string(), kcache);
|
self.keys.insert(name.to_string(), kcache);
|
||||||
self.key_count += 1;
|
self.key_count += 1;
|
||||||
|
|
@ -669,7 +669,7 @@ impl DictCacheEntry {
|
||||||
descriptor_index,
|
descriptor_index,
|
||||||
clean: false,
|
clean: false,
|
||||||
data: None, // no caching implemented yet for large keys
|
data: None, // no caching implemented yet for large keys
|
||||||
atime: self.tt.elapsed_ms(),
|
atime: self.created.elapsed().as_millis() as u64,
|
||||||
};
|
};
|
||||||
self.keys.insert(name.to_string(), kcache);
|
self.keys.insert(name.to_string(), kcache);
|
||||||
self.key_count += 1;
|
self.key_count += 1;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue