Skip to main content

Module async_data

Module async_data 

Source
Expand description

Async retained data pipeline (worker-equivalent architecture.

This module provides the infrastructure for offloading heavy per-frame CPU work (terrain mesh generation, vector tessellation, symbol placement) to background tasks, matching the MapLibre/Mapbox web worker model.

§Architecture

The DataTaskPool trait is an executor-agnostic interface that the host or renderer injects into MapState. The engine submits work items via typed spawn methods and polls completed results via DataTaskResultReceiver::try_recv each frame.

When no task pool is set, MapState falls back to synchronous inline execution (current behavior), ensuring backward compatibility.

§Task families

FamilyInputOutput
TerrainTerrainTaskInput (tile, elevation grid, config)TerrainTaskOutput (mesh + hillshade)
VectorVectorTaskInput (features, style, terrain samples, projection)VectorTaskOutput (tessellated mesh + symbol candidates)

§Retained model

Completed results are stored per cache key and reused across frames until invalidated by source data changes, camera origin movement, or zoom-level style property changes.

§Per-tile vector buckets (MapLibre parity)

Vector features can be spatially partitioned into per-tile buckets using partition_features_by_tile. Each bucket is dispatched, tessellated, and cached independently via VectorBucketKey, matching MapLibre’s per-tile bucket architecture. Only buckets whose tiles are in the visible set are collected for rendering; off-screen buckets are retained in the cache for reuse when the camera pans back.

Structs§

AsyncVisualizationPipeline
Asynchronous preprocessing pipeline for large visualization data updates.
MvtDecodeOutput
Output from an async MVT decode task.
TerrainCacheKey
Cache key for a retained terrain task result.
TerrainTaskInput
Input for an async terrain mesh generation task.
TerrainTaskOutput
Output from an async terrain mesh generation task.
ThreadDataTaskPool
A simple std::thread-based DataTaskPool implementation.
VectorBucketKey
Cache key for a per-tile vector bucket.
VectorCacheKey
Cache key for a retained vector task result.
VectorTaskInput
Input for an async vector tessellation task.
VectorTaskOutput
Output from an async vector tessellation task.

Enums§

VisualizationTaskOutput
Output of an asynchronous visualization preprocessing task.

Traits§

DataTaskPool
An executor-agnostic task pool for offloading heavy data pipeline work.
DataTaskResultReceiver
A result receiver for completed async data tasks.

Functions§

partition_features_by_tile
Partition a feature collection into per-tile sub-collections.