Expand description
SensorDb implementation.
Append-only sensor database for NOR flash with circular sector management.
§Usage
ⓘ
use sensor_db::{MockFlash, SensorDb};
const PAGE: usize = 256;
const SECTOR: usize = 4096;
const SECTORS: usize = 32;
let flash = MockFlash::<PAGE, SECTOR>::new(SECTORS * SECTOR);
let mut db: SensorDb<_, PAGE, SECTORS> = SensorDb::new(flash, 0, 32, 2).unwrap();
db.format().unwrap();
db.append(1, 1000, &[0xAB, 0xCD]).unwrap();
let mut buf = [0u8; 16];
let (hdr, n) = db.latest(1, &mut buf).unwrap().unwrap();
assert_eq!(&buf[..n], &[0xAB, 0xCD]);Structs§
- DbConfig
- Geometry and identity of a database region.
- DbStats
- Statistics about the database state.
- LogPosition
- A position in the log: sector sequence plus byte offset within that sector.
- Mount
Stats - Statistics returned after mounting.
- Read
Cursor - Outcome of a
SensorDb::read_frompass. - Replicated
- How much one replication step carried, in both units the accounting needs.
- Sensor
Db - Append-only sensor database for NOR flash.
- Spool
Stats - Replication accounting for a log.
Enums§
- Compact
Scope - Which sealed sectors
SensorDb::compactmay erase. - Mount
Mode - How much of the log to index when mounting.