GpkgTileStore

class GpkgTileStore(geoPackage: GeoPackage, content: GpkgContent, val cachePolicy: CachePolicy = CachePolicy.UNBOUNDED) : TileStore, CachedSourceInfoProvider

GeoPackage-backed TileStore. One instance binds to one tile-pyramid table — works for any data_type that uses the tile-user-data shape (image/png, image/jpeg, image/webp, gridded coverages, vector-tile protobuf).

(z, x, y) maps to (zoom_level, tile_column, tile_row). ETag / Last-Modified ride alongside in the ww_tile_revalidation side table, so a conditional GET against the network source on a follow-up refresh stays cheap.

Tile-payload format is whatever the source produced — the store doesn't decode. Image layers decode PNG/JPEG/WebP at render time; elevation layers decode the gridded blob; MVT layers parse the protobuf.

Constructors

Link copied to clipboard
constructor(geoPackage: GeoPackage, content: GpkgContent, cachePolicy: CachePolicy = CachePolicy.UNBOUNDED)

Properties

Link copied to clipboard
open override val cacheInfo: CachedSourceInfo
Link copied to clipboard
open override val cachePolicy: CachePolicy

Functions

Link copied to clipboard
open suspend override fun bumpValidatedAt(z: Int, x: Int, y: Int)

Refresh a tile's freshness timestamp WITHOUT rewriting its bytes — the conditional-GET 304 Not Modified path. Restarts the stale-while-revalidate window so a still-current tile isn't re-requested every frame. Default no-op for stores that don't track freshness.

Link copied to clipboard
open suspend override fun bumpValidatedAtBatch(keys: Collection<Long>)

bumpValidatedAt for many tiles at once — keys packed by tileKey. Stores that commit per call should override this with a single-transaction implementation so a coalesced restamp burst costs one commit instead of one per tile.

Link copied to clipboard
open suspend override fun deleteTile(z: Int, x: Int, y: Int)

Drop a tile from the store (after a server-side delete, manual eviction, etc.).

Link copied to clipboard
open suspend override fun evict()

Apply cachePolicy now. Idempotent / unbounded policy → no-op.

Link copied to clipboard
open suspend override fun readTile(z: Int, x: Int, y: Int): TileBlob?

Returns the cached blob, or null if the tile isn't present. Treat TileBlob.EMPTY as "the server confirmed no tile here" — distinct from null cache miss.

Link copied to clipboard
open suspend override fun setBoundingSector(sector: Sector)

Persist sector as the store's content bounding box — the data-availability extent a bulk download records (e.g. gpkg_contents). Default no-op for stores without one.

Link copied to clipboard
open suspend override fun sizeBytes(): Long

Approximate byte size of all tiles in the store.

Link copied to clipboard
open suspend override fun writeTile(z: Int, x: Int, y: Int, blob: TileBlob)

Persist a tile. TileBlob.EMPTY is allowed (and recommended) for "no tile here".