Storage model
The store has a two-level layout:Operations
The operations are defined by the Protobuf host contract. See Protobuf for the shared transport definition.Read a value
The read request contains:
The response contains a
found boolean and a value byte sequence. A missing
key is not an error: found is false and no value is returned.
Reading a value does not create its namespace or key.
Write a value
The write request contains the samenamespace and key fields plus:
Writing an existing key replaces its value. The operation returns an error
string when the write is rejected, for example when the namespace is
read-only.
Delete a value
The delete request containsnamespace and key. Deleting an existing key
removes its value. Deleting a key that does not exist succeeds without changing
the store.
The operation returns an error string when deletion is rejected, including an
attempt to delete from a read-only namespace.
List keys
The list request contains anamespace field:
- When
namespaceis non-empty, the response contains the keys currently present in that namespace. - When
namespaceis empty, the response contains the names of all namespaces currently present in the store.
Lifecycle and persistence
The Kernel creates the KV store when it creates the plugin manager. The store is in memory:- stopping or restarting a plugin does not clear its KV values;
- loading a new version of the same plugin does not clear its KV values; and
- restarting the Kernel creates a new empty store and clears all values.
Concurrency and value ownership
The Kernel synchronizes individual KV operations. Reads, writes, deletes, and lists are safe when multiple plugin calls happen concurrently. There is no transaction or compare-and-swap operation. A sequence such as “read, modify, write” is not atomic with respect to another plugin. If several plugins update the same key, coordinate ownership or design the value so that lost updates do not corrupt the application state. The Kernel copies byte values when storing and reading them. Mutating a byte buffer after a write does not change the stored value, and mutating a returned buffer does not change the value in the store.The sys namespace
sys is a Kernel-managed, read-only namespace. Plugins can read and list it,
but writes and deletes through the plugin host boundary return an error.
The Kernel uses this namespace for host-managed state, including plugin
registry information. Do not write to sys, and do not depend on undocumented
system keys unless the Kernel documentation explicitly defines them.
Backend behavior
WASM and gRPC plugins use the same KV contract:- a WASM plugin reaches the store through the generated host bindings; and
- a gRPC plugin reaches the store through the Kernel’s host callback channel.
Recommended usage
Use a predictable namespace and key scheme:found result before decoding a
value, handle write and delete errors, and avoid treating a successful write
as durable persistence.