pub struct DbConfig { /* private fields */ }Expand description
Geometry and identity of a database region.
Validated once, here, so everything downstream receives a configuration that is already known-good.
use sensor_db::db::DbConfig;
use sensor_db::sector::LogId;
let config = DbConfig::new(0, 8, 1)?
.with_log_id(LogId::new(0xC0FFEE).unwrap());Implementations§
Source§impl DbConfig
impl DbConfig
Sourcepub fn new(
base_offset: u32,
sector_count: u16,
reserved_sectors: u16,
) -> Result<Self, Error>
pub fn new( base_offset: u32, sector_count: u16, reserved_sectors: u16, ) -> Result<Self, Error>
Sourcepub fn with_log_id(self, log_id: LogId) -> Self
pub fn with_log_id(self, log_id: LogId) -> Self
Declare this database’s logical identity.
The id is written into every sector header, and mounting a medium whose
sectors carry a different id fails with
Error::ForeignVolume instead of treating them as free space. Set this
on any database whose storage can be swapped between devices.
Sourcepub fn base_offset(&self) -> u32
pub fn base_offset(&self) -> u32
Starting byte offset of the region.
Sourcepub fn sector_count(&self) -> u16
pub fn sector_count(&self) -> u16
Number of erase sectors in the region.
Sourcepub fn reserved_sectors(&self) -> u16
pub fn reserved_sectors(&self) -> u16
Sectors kept free as compaction headroom.
Trait Implementations§
impl Copy for DbConfig
impl Eq for DbConfig
impl StructuralPartialEq for DbConfig
Auto Trait Implementations§
impl Freeze for DbConfig
impl RefUnwindSafe for DbConfig
impl Send for DbConfig
impl Sync for DbConfig
impl Unpin for DbConfig
impl UnsafeUnpin for DbConfig
impl UnwindSafe for DbConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more