Skip to content

IndexedDB Storage Layout

One IndexedDB database is opened per Maryk database name.

Object stores are created per model and storage family.

StorePurpose
metaStorage version, history options, model signatures, encoded model definitions, and migration metadata.
StoreKeyValue
k:modelIdrecord keycurrent metadata and current value snapshot
t:modelIdkey scope + qualifierencoded current value
i:modelIdindex ref + encoded index value + record keyrecord key marker
u:modelIdunique ref + encoded unique valuerecord key

Current point reads prefer the key snapshot and table rows. Current table scans cursor over k:modelId. Current index scans cursor over i:modelId. Unique lookup uses direct get on u:modelId.

Created when keepAllVersions is enabled.

StoreKeyValue
c:modelIdkey scope + versionversioned change payload
ht:modelIdkey scope + inverted versionmetadata and value rows snapshot
hi:modelIdindex ref + encoded index value + record key + inverted versionactive/tombstone marker
hu:modelIdunique ref + encoded unique value + inverted versionrecord key or tombstone
hik:modelIdkey scope + historic index row keyhistoric index row key
huk:modelIdkey scope + historic unique row keyhistoric unique row key

ht:modelId lets historic point and table reads resolve the latest snapshot at or before toVersion.

hi:modelId lets historic index scans use IndexedDB ranges over Maryk index values. The reader collapses the latest visible row per indexed row so historic tombstones are handled correctly.

hu:modelId lets historic unique scans resolve the latest visible key for a unique value at or before toVersion.

hik:modelId and huk:modelId are cleanup sidecars. They let hard delete purge only historic secondary rows owned by the deleted object, instead of scanning whole historic secondary stores.

Created when both keepAllVersions and keepUpdateHistoryIndex are enabled.

StoreKeyValue
uh:modelIdinverted version + record keyversioned change payload

scanUpdateHistory uses this store for newest-first history scans.

Rows that belong to one object use a length-prefixed object-key scope before the row suffix. This prevents prefix collisions where one raw Maryk key starts with the bytes of another key.

Sensitive current and historic table values are encrypted before being written. Sensitive unique values use deterministic lookup tokens when the provider supports SensitiveIndexTokenProvider.

Sensitive indexed properties are rejected. Use an explicit blind-index field instead.