Skip to main content

RegionDatabase

Type Alias RegionDatabase 

Source
pub type RegionDatabase = DatabaseFileSource<Downloads>;
Expand description

A database whose worker downloads its offline regions.

Aliased Type§

pub struct RegionDatabase { /* private fields */ }

Trait Implementations§

Source§

impl DatabaseFileSourceExt for RegionDatabase

Source§

fn list_offline_regions( &self, callback: impl FnOnce(Result<Vec<OfflineRegion>, DatabaseError>) + Send + 'static, )

Lists every region in the database.
Source§

fn get_offline_region( &self, region_id: i64, callback: impl FnOnce(Result<Option<OfflineRegion>, DatabaseError>) + Send + 'static, )

Gets the region region_id, or None if the database has none with that id.
Source§

fn create_offline_region( &self, definition: &OfflineRegionDefinition, metadata: &OfflineRegionMetadata, callback: impl FnOnce(Result<OfflineRegion, DatabaseError>) + Send + 'static, )

Creates a region. The region starts inactive; set_offline_region_download_state starts its download.
Source§

fn update_offline_metadata( &self, region_id: i64, metadata: &OfflineRegionMetadata, callback: impl FnOnce(Result<OfflineRegion, DatabaseError>) + Send + 'static, )

Replaces the region’s metadata, and gives the updated region. Fails when the database has no region region_id.
Source§

fn set_offline_region_observer( &self, region_id: i64, observer: Option<Box<dyn OfflineRegionObserver + Send>>, callback: impl FnOnce(Result<(), DatabaseError>) + Send + 'static, )

Sets the region’s only observer, replacing the previous one; None removes it. Its methods run on the database thread. Fails when the database has no region region_id.
Source§

fn set_offline_region_download_state( &self, region_id: i64, download_state: OfflineRegionDownloadState, callback: impl FnOnce(Result<(), DatabaseError>) + Send + 'static, )

Starts or stops the region’s download. Fails when the database has no region region_id.
Source§

fn get_offline_region_status( &self, region_id: i64, callback: impl FnOnce(Result<OfflineRegionStatus, DatabaseError>) + Send + 'static, )

Gives the region’s download progress. Fails when the database has no region region_id.
Source§

fn get_offline_region_expiry( &self, region_id: i64, callback: impl FnOnce(Result<OfflineRegionExpiry, DatabaseError>) + Send + 'static, )

Gives how long the region’s stored resources stay usable. Fails when the database has no region region_id.
Source§

fn merge_offline_regions( &self, side_database_path: &str, callback: impl FnOnce(Result<Vec<OfflineRegion>, DatabaseError>) + Send + 'static, )

Copies the regions of another database, and the resources and tiles they use, into this one. Identical regions become one. The side database is upgraded to the current schema in place, so it must be writable.
Source§

fn delete_offline_region( &self, region_id: i64, callback: impl FnOnce(Result<(), DatabaseError>) + Send + 'static, )

Stops the region’s download and deletes the region, evicting the resources no other region uses. Fails when the database has no region region_id.
Source§

fn invalidate_offline_region( &self, region_id: i64, callback: impl FnOnce(Result<(), DatabaseError>) + Send + 'static, )

Makes the region’s resources stale, so maps revalidate them with their server when they next use them, and its next download refreshes them, which transfers nothing for resources that haven’t changed. Resources that must revalidate can’t be used until they have.