Skip to main content

Module storage

Module storage 

Source
Expand description

Resource loading: Resource, Response, the FileSource trait, the Loader over the built-in file sources (assets, local files, MBTiles, PMTiles, the cache database and the network), OfflineDatabase and the offline region definitions. OfflineDownload is in offline.

The crate’s sqlite feature (on by default) holds everything that needs SQLite: OfflineDatabase, the database file source and the MBTiles file source. Without it a Loader has no cache (examples/web relies on the browser’s HTTP cache instead).

Re-exports§

pub use resource::Kind;
pub use resource::LoadingMethod;
pub use resource::RequestOrder;
pub use resource::Resource;
pub use resource::StoragePolicy;
pub use resource::TileFormat;
pub use response::Data;
pub use response::ResourceError;
pub use response::Response;

Modules§

chrono
compression
constants
The storage’s defaults and URL protocols.
http_header_transform
Headers a host adds to the HTTP requests of the online file source, as maplibre-native-ffi’s HTTP file sources do for its mln_runtime_set_http_header_transform. MapLibre Native has no counterpart.
network_status
Whether the network is reachable, as the host reports it.
offline
resource
resource_transform
response

Structs§

DatabaseFileSource
The Database file source: the ambient cache and the offline regions, in an SQLite database that a worker thread owns, with the worker’s extension E beside it. Its drop or shut_down waits for the worker to end, unless it runs on the worker’s thread. When the worker’s thread can’t start, the source logs why, fails each request, and drops the work sent to it.
Loader
The resource loader: one file source over the asset, file, MBTiles and PMTiles file sources, and the cache database and network, if it has them.
LoaderBuilder
Builds a Loader from the file sources it’s given.
OnlineFileSource
The Network file source: HTTP(S) requests, revalidated when they expire and retried with a backoff after errors, with a bounded number of transfers in flight. Requests that would send the same transfer at once share it. Its requests follow the NetworkStatus it was made with.
Request
A request for a resource. Dropping it cancels the request: the file source stops what work it can, and no response reaches the callback after the drop. The drop doesn’t wait for a call that began before it, on the responder’s thread, so a callback may drop its own request.
ResourceOptions
Where a Loader keeps its cache and finds its assets.
Responder
The file source’s side of a Request: where it sends the responses, from any thread, and how it learns that the requester cancelled.

Traits§

Cache
A cache that a Loader reads before the network, and stores the network’s responses in.
FileSource
A source of resources. File sources are shared between threads, hence Send + Sync. Each takes its configuration when it’s made, or through methods of its own type.
FileSourceExt
Requests through a FileSource.

Type Aliases§

Callback
Receives a request’s responses, on the thread that sends each one.