earthsciio (Rust)
The Rust core of EarthSciIO — component (a): URL download + a shared content-addressed cache. This is the first data-loader machinery in the Rust track (the project had no I/O dependencies before).
It implements the language-neutral contract under ../spec:
| Spec | Here |
|---|---|
cache key sha256(resolved_url) |
cache_key |
| on-disk layout + manifest | store::LocalStore, Manifest |
| transport / store registries | transport, store |
$EARTHSCIDATADIR |
datadir |
offline mode + CacheMiss |
Cache, offline |
| validation ladder (ETag / checksum / TTL) | validate |
concurrency: advisory flock + atomic rename |
store::LocalStore |
The manifest serializer is byte-identical to the Python writer, so a blob cached by one language is reused — and re-validated — by the others.
The three registries keep the fetch path extensible by construction: a new
transport (s3), store, or reader registers under a new name without touching
the fetch flow. The active set here is the http/https + file transports
and the local store. Format readers (decoding a blob into native-grid
arrays) are component (b).
Use
use ;
// $EARTHSCIDATADIR + EARTHSCI_OFFLINE from the environment.
let cache = from_env?;
let blob = cache.fetch?;
// blob.path is the cached file; blob.manifest carries its validation/provenance.
# Ok::
Point a provider at the conformance corpus with offline = true and every
golden case resolves from disk with no network:
let cache = builder
.data_dir
.offline
.build?;
# Ok::
Dependencies
reqwest (blocking, rustls-tls/ring — no system OpenSSL), sha2, serde +
serde_json, fs2 (advisory lock), tempfile (atomic-rename staging), time
(RFC 3339 fetched_at + TTL). HTTPS works out of the box; offline/CI builds
need no network.
Develop
The integration tests cover the three acceptance criteria: fetch + cache +
offline re-read (fetch_cache_offline),
cross-language reuse of the Python-cached corpus
(conformance_reuse), and concurrent fetchers
downloading exactly once (concurrency_lock).