Improvements for example and documentation
All checks were successful
Rust/sat-rs/pipeline/pr-main This commit looks good

- Added diagrams for sat-rs example for both structure and data flow.
- Added explanations for those diagrams as well.
- Some renaming: Use `Pool` instead of `Store` for pool components.
- General improvements for satrs-book.
This commit is contained in:
2024-02-08 17:42:36 +01:00
parent cb8405ca65
commit 176a9f1612
26 changed files with 3372 additions and 161 deletions

View File

@ -17,26 +17,26 @@ pub mod std_mod {
use std::sync::{Arc, RwLock};
#[derive(Clone)]
pub struct SharedTmStore {
pub shared_pool: SharedStaticMemoryPool,
}
pub struct SharedTmPool(pub SharedStaticMemoryPool);
impl SharedTmStore {
impl SharedTmPool {
pub fn new(shared_pool: StaticMemoryPool) -> Self {
Self {
shared_pool: Arc::new(RwLock::new(shared_pool)),
}
Self(Arc::new(RwLock::new(shared_pool)))
}
pub fn clone_backing_pool(&self) -> SharedStaticMemoryPool {
self.shared_pool.clone()
self.0.clone()
}
pub fn shared_pool(&self) -> &SharedStaticMemoryPool {
&self.0
}
pub fn shared_pool_mut(&mut self) -> &mut SharedStaticMemoryPool {
&mut self.0
}
pub fn add_pus_tm(&self, pus_tm: &PusTmCreator) -> Result<StoreAddr, EcssTmtcError> {
let mut pg = self
.shared_pool
.write()
.map_err(|_| EcssTmtcError::StoreLock)?;
let mut pg = self.0.write().map_err(|_| EcssTmtcError::StoreLock)?;
let (addr, buf) = pg.free_element(pus_tm.len_written())?;
pus_tm
.write_to_bytes(buf)