pub struct MobileRegionDatabase { /* private fields */ }Expand description
An opened region database.
Read-only, and cheap to hold open for the life of the app. The lock exists because the underlying SQLite connection is single-threaded, not because anything here blocks for long: a worst-case lookup is about a millisecond.
Implementations§
Source§impl MobileRegionDatabase
impl MobileRegionDatabase
Sourcepub fn open(path: String) -> Result<Arc<Self>, MobileRegionError>
pub fn open(path: String) -> Result<Arc<Self>, MobileRegionError>
Open the database at an absolute filesystem path, read-only.
Sourcepub fn dataset_version(&self) -> String
pub fn dataset_version(&self) -> String
The data release this database carries, such as 2026.34.1.
Sourcepub fn format_version(&self) -> u32
pub fn format_version(&self) -> u32
The database format version.
Sourcepub fn region_count(&self) -> u32
pub fn region_count(&self) -> u32
How many regions the database holds.
Sourcepub fn lookup(
&self,
latitude: f64,
longitude: f64,
) -> Result<MobileRegionLookupRecord, MobileRegionError>
pub fn lookup( &self, latitude: f64, longitude: f64, ) -> Result<MobileRegionLookupRecord, MobileRegionError>
Every region covering one exact position, with semantic detail.
Sourcepub fn propose(
&self,
position: MobileRegionPositionRecord,
current_regions: Vec<String>,
current_default_region: Option<Vec<u8>>,
) -> Result<MobileRegionProposalRecord, MobileRegionError>
pub fn propose( &self, position: MobileRegionPositionRecord, current_regions: Vec<String>, current_default_region: Option<Vec<u8>>, ) -> Result<MobileRegionProposalRecord, MobileRegionError>
Propose a region configuration for a position, against what the device currently holds.
The proposal samples the position’s uncertainty — an identity cell’s center and four corners, or a measured fix’s center and the four cardinal points of its accuracy circle — and suggests every region any sample hit. A node whose position straddles a boundary should usually forward both sides, the same reasoning that gives the database its expansion margins; the non-unanimous regions are named so the operator can judge.