BlobStore

interface BlobStore

URI-keyed binary blob store. Persists arbitrary HTTP-fetched payloads (3D Tiles content, future generic asset caches) under a single content key.

Distinct from TileStore / FeatureStore: those are pyramid- or feature-shaped. This one is a flat string-keyed key/value store, the right shape for any cache whose entries are independent URLs rather than a coordinate grid. The first user is 3D Tiles (earth.worldwind.layer.ogc3d.Ogc3dTilesLayer) — each tile's content URI keys into one row.

Persistence backend is platform-dependent (GeoPackage extension table on JVM/Android, IndexedDB on JS, file blobs on iOS), all reached through earth.worldwind.util.ContentManager.openBlobStore.

The store stores both the raw payload bytes and a small metadata envelope (BlobEntry.contentType, BlobEntry.etag, BlobEntry.lastModified) so the layer can skip magic-byte detection when the server returned a known content type and so future revalidation (If-None-Match / If-Modified-Since) can be wired without a schema migration.

Inheritors

GpkgBlobStore

Functions

Link copied to clipboard
abstract suspend fun clear()

Drop every entry. Schema is preserved so subsequent puts succeed.

Link copied to clipboard
abstract suspend fun get(uri: String): BlobEntry?

Fetch a previously-stored blob. Null when uri is not in the cache.

Link copied to clipboard
abstract suspend fun put(uri: String, bytes: ByteArray, contentType: String? = null, etag: String? = null, lastModified: Instant? = null, responseUrl: String? = null)

Persist or replace the blob for uri. contentType is whatever the server returned (e.g. application/octet-stream, model/gltf-binary); null when unknown. etag and lastModified are conditional-fetch metadata the layer can consult on a future revalidation request. responseUrl is the post-redirect URL the body was actually served from — replayed via BlobEntry.responseUrl on cache hits so callers can resolve relative URIs against the body's true origin. Null when same as uri / unknown.

Link copied to clipboard
abstract suspend fun remove(uri: String)

Drop one entry. No-op when uri is absent.

Link copied to clipboard
abstract suspend fun sizeBytes(): Long

Total stored payload size in bytes. Excludes metadata + schema overhead; close approximation suitable for budget reporting, not exact accounting.