CachedBulkFeatureSource

Cache-first decorator over a BulkFeatureSource. On fetchAll:

  1. If store has any bulk rows, return them as-is (no network).

  2. Otherwise stream from inner, emit rows to the caller as they arrive, accumulate them, and atomically FeatureStore.replaceAll when the inner flow completes.

When inner is null, this acts as a pure cache view — useful for replaying a GPKG file offline. A network failure with an empty cache yields an empty flow.

Streaming preserves incremental-render behaviour for paginated WFS responses; the cache write happens once, atomically, after the full fetch succeeds.

Constructors

Link copied to clipboard
constructor(inner: BulkFeatureSource?, store: FeatureStore)

Properties

Link copied to clipboard
open override val cacheInfo: CachedSourceInfo?
Link copied to clipboard
open override var isCacheOnly: Boolean

When true, fetchAll never calls inner — cache content is returned as-is and a cold cache yields an empty flow. Mirrors CachedTileSource.isCacheOnly.

Link copied to clipboard

The wrapped upstream feature source. Exposed for rebind flows — attachCache extractors peel this off when the layer is already cache-attached.

Functions

Link copied to clipboard
open override fun close()

Propagate close to the wrapped network source so it can release its HTTP client.

Link copied to clipboard
open suspend override fun fetchAll(): Flow<CachedFeatureRow>
Link copied to clipboard
open suspend override fun readBySector(sector: Sector): Flow<CachedFeatureRow>

Populate the store once from inner (a full download), then serve only the rows intersecting sector from its spatial index — offline and viewport-bounded thereafter. An already-populated store (e.g. a prior session) skips the download.