Expand description
Resolver: caching + dedup + dispatch layer between ChartML::fetch and
the registered DataSourceProvider implementations (chartml 5.0 phase 3).
The resolver owns:
- Tier-1 cache — a
MemoryBackendalways present. - Tier-2 cache — optional
CacheBackendRef(populated in phase 3b byIndexedDbBackend; phase 3 leaves itNone). - In-flight tracker — a
HashMap<u64, Shared<BoxFuture<...>>>so two concurrent fetches for the same key share one provider invocation. - Provider registry —
HashMap<String, Arc<dyn DataSourceProvider>>, keyed by dispatch slug ("inline","http","datasource", …).
Phase 3 leaves ResolverHooks integration as a no-op stub; phase 3c will
add hook dispatch without further changes to this file’s structure.
Re-exports§
pub use builtin::HttpProvider;pub use builtin::InlineProvider;pub use cache::CacheBackend;pub use cache::CacheError;pub use cache::CachedEntry;pub use cache::MemoryBackend;pub use cancel::CancellationToken;pub use hooks::CacheHitEvent;pub use hooks::CacheMissEvent;pub use hooks::CacheTier;pub use hooks::ErrorEvent;pub use hooks::HooksRef;pub use hooks::MissReason;pub use hooks::NullHooks;pub use hooks::Phase;pub use hooks::ProgressEvent;pub use hooks::ResolverHooks;
Modules§
- backends
- Pluggable persistent
CacheBackendimplementations (chartml 5.0 phase 3b). - builtin
- Built-in providers:
InlineProviderandHttpProvider. - cache
- Pluggable caching for fetched provider results.
- cancel
- Cooperative cancellation for in-flight provider work.
- hooks
- Observability for the resolver pipeline (chartml 5.0 phase 3c).
Structs§
- Cache
Config - Parsed cache config. Built from
spec::source::CacheConfig(which carries the raw YAML strings) so the resolver doesn’t have to re-parsehumantimeformats on every fetch. - Fetch
Batch Result - Batch-oriented provider response. Carries multiple RecordBatches with a shared schema, allowing the transform layer to register them into MemTable without concatenation.
- Fetch
Request - Per-source request context. Carries the resolved spec (params already substituted) plus cache + header + namespace + cancellation hints.
- Fetch
Result - Provider response.
Cloneis required becausefutures::future::Shared(used for in-flight dedup) takes aFuture<Output: Clone>.DataTableisArc-backed so cloning is cheap. - Resolve
Outcome - Outcome of a
Resolver::fetchcall: the provider’s result PLUS whether the value came from a cache tier or a fresh provider invocation. - Resolver
- Provider dispatch + cache + dedup orchestration.
Enums§
- Fetch
Error - Provider failures.
ClonematchesFetchResultsoSharedcan clone the error when multiple in-flight callers receive the same outcome.
Constants§
- DEFAULT_
TTL - Default TTL applied when a spec doesn’t declare one. Five minutes matches
the JS middleware’s
CACHE_TTL_DEFAULT_MS. - TAG_
NAMESPACE_ PREFIX - Tag prefix for namespace-based bulk invalidation.
- TAG_
SLUG_ PREFIX - Tag prefix for source-slug-based bulk invalidation. Public so consumers computing tags out-of-band (e.g., a custom CacheBackend that wants to pre-populate entries) match the resolver’s wire format exactly.
Traits§
- Data
Source Provider - Provider dispatch + fetch trait. Host apps implement this for their
custom data sources (BigQuery, Snowflake, internal REST APIs, …) and
register them via
ChartML::register_provider(kind, provider).
Type Aliases§
- Cache
Backend Ref - Public alias for the shared-ownership wrapper around a
CacheBackendtrait object.Arc<dyn CacheBackend>on native,Rc<dyn CacheBackend>on WASM — mirrors theSharedRefstory so wasm32 consumers can hand off!Sendbackends (e.g. [backends::indexeddb::IndexedDbBackend]) without trippingclippy::arc_with_non_send_sync. - Resolver
Ref - Public alias for the shared-ownership wrapper around
Resolver.Arcon native (so consumers usingtokio::spawncan move resolver handles across task boundaries) andRcon WASM (where the resolver’s inflight map is inherently?Send, so anArcwould be both incorrect and rejected byclippy::arc_with_non_send_sync). Returned byChartML::resolver()and accepted by every host that wants a long-lived handle for the bulkinvalidate*API. - Shared
Ref - Cfg-gated shared-ownership pointer.
Arc<T>on native (so handles can move acrosstokio::spawntask boundaries),Rc<T>on WASM (wherewasm32-unknown-unknownis single-threaded and the resolver’s internals are?Send, so anArcwould be both incorrect and rejected byclippy::arc_with_non_send_sync).