Overview
Document model
Layer reserves the _hevlayer_* attribute prefix for its own bookkeeping. The gateway manages these attributes: your writes and UDF completion patches must not set them, and editing them directly breaks Layer’s guarantees.
| Attribute | Type | Purpose |
|---|---|---|
_hevlayer_upserted_at | integer (epoch ms) | Server-stamped on every write. The gateway filters queries to _hevlayer_upserted_at <= watermark to hold the read-consistency cut while the upstream index catches up. |
_hevlayer_shard | integer | Hash bucket assigned at write time (xxh64(id) % shard_count), present only on sharded namespaces. Lets the gateway scatter/gather a query across the shards of one namespace. |
_hevlayer_udf_<id>_v | string | Function completion marker. The gateway stamps the Function’s spec.version here when a worker completes a row. Hyphens in the Function id are normalized to underscores. |
_hevlayer_udf_<id>_stale_after | integer or null | Function invalidation marker. Discovery reclaims rows once this epoch-ms timestamp expires; completion clears the marker. |
The _hevlayer_ prefix also namespaces internal cache sets (snapshot field-values and search-history clickstream), but those are cache keys, not part of your document schema.