Shared key-value documents with change subscriptions; a document's scope decides where it lives and who shares it. Access is shared through grants minted by doc:grant, which can be narrowed further and whose encoded form travels over any channel. For private durable bytes no other app can observe, see storage.
This user's durable document identity key — what others pass as to in grants and what appears as meta.author on this user's writes. Stable across restarts.
Open (creating if needed) a document keyed by name within this app's @scope. Apps of one @scope share it when their packages came from the same place: one registry or a folder. An app under another @scope, or a copy of this one that came another way, opens a different document under the same name; with shared, every app that also sets it opens one. The returned handle is always writable. Requires the network capability when scope = "network".
Example
-- Every app of this @scope on this workstation that opens "scores"-- shares it.local scores = datumhue.documents.open_named({ name = "scores" })
scores:set("ada", 3):ready()
print(scores:get("ada"):ready().value) --> 3
Open the document of this name that every app setting shared opens, whatever its @scope and wherever its package came from, instead of one kept within this app's @scope. Any app can open a shared name: to hand a document to one other app, give it a DocumentGrant.
prefix
string
the whole document
Sync, read, and observe only this key subtree.
since
integer
entries of any age
Sync only entries written at or after this UNIX-microseconds timestamp.
authors
string[]
every writer's entries
Sync only these writers' entries (identity keys, as meta.author / documents.identity).
Open the document a grant authorizes. The scope is decided by the grant; requires the network capability when the grant is network-scoped. opts narrows the synced window — reads and subscriptions outside it see nothing.
Open the communal document derived from an identity. Every user holds intrinsic write authority over their own section; reading another user's section requires a grant from them. Requires the identity and network capabilities.