Expand description
Session-scoped key-value store: the trait an embedder implements and a bounded in-memory implementation.
Keys and payloads are UTF-16 code units end to end. A payload can contain
lone surrogates — a value a Submilli string may legally hold — so nothing
here round-trips through a Rust String, which would replace them.
The store outlives the Wasm store it is read from, so it never retains guest GC references: serialization to code units happens above this layer.
Structs§
- Cursor
Key - A secret that seals
session.listcursors, named by an id each cursor carries so a server holding several keys knows which one sealed it. - Cursor
Keys - The keys
session.listcursors are sealed and opened with. New cursors are sealed withcurrent; a cursor sealed with aretiredkey still opens, so replacing the key does not break listings already under way. - InMemory
Session Kv - Bounded in-memory store, for embedders without durable storage and for state that must not outlive its owner.
- Session
KvEntry - Key plus retained payload size — what
listmay disclose. Never contents. - Session
KvLimits - Session
KvPage - One page of a key scan.
- Session
KvUsage - What a session holds when a write is checked against its limits.
Enums§
- Session
KvError - Session
KvLimit Kind - Which bound a rejected operation ran into. Carries the numbers, never the value — an error message about a quota must not leak session contents.
Constants§
- CURSOR_
KEY_ ID_ LEN - Bytes in a
CursorKeyid. - DEFAULT_
MAX_ ENTRIES - DEFAULT_
MAX_ KEY_ UNITS - UTF-16 code units in a nonempty key.
- DEFAULT_
MAX_ SESSION_ BYTES - Retained serialized payload per session.
- DEFAULT_
MAX_ VALUE_ BYTES - Serialized payload of a single value.
Traits§
- Session
KvStore - Session-scoped key-value storage.
Functions§
- entry_
bytes - Retained bytes for one entry: what the per-session limit counts.
- render_
key - Only ever used to name the key in a diagnostic. Lone surrogates become replacement characters here, which is acceptable in a message and is why the stored key itself is kept as code units.
- value_
bytes - Serialized bytes of a value: what the value limit and
listcount.
Type Aliases§
- Session
KvFuture - What a
SessionKvStoreoperation returns: a store may reach storage that must not block the caller’s thread.