Proto commits in denoland/denokv

These 9 commits are when the Protocol Buffers files have changed:

Commit:38328ea
Author:Bert Belder
Committer:Bert Belder

Add protocol version 4: multiplexed watch channel over WebSocket Watching n keys currently costs one long-lived streaming request per watch() call. Protocol version 4 adds a watch channel: a single WebSocket connection per database that key watches can be added to and removed from at any time, with support for resuming after a reconnect without duplicate deliveries. * proto: add WatchChannelClientMessage (add/remove a watched key; add carries an optional resume baseline: the last seen versionstamp or "absent") and WatchChannelServerMessage (key-tagged outputs carrying only state that differs from what the client has) to datapath.proto. Spec the endpoint and message flow in kv-connect.md and list version 4 in the protocol versions section. The limits module of denokv_proto is now public. * remote: RemoteTransport gains optional WebSocket support through defaulted methods, so existing transport implementations keep compiling and keep negotiating version 3 with the per-watch code path. Transports that implement websocket() advertise version 4 during the metadata exchange. A per-database channel manager refcounts watched keys across watch() calls, demultiplexes updates to the per-call streams (entries shared via Arc, copied only at the caller-facing conversion), and reconnects with jittered backoff, re-adding every key with its last seen state as the baseline. * remote: when the channel cannot be made to work, watch() falls back to per-watch streaming instead of retrying forever: after five consecutive failed or short-lived connections (e.g. an intermediary strips the Upgrade header, or the server closes the channel with a policy violation), subscriptions fail with a marker error that watch() converts into the version 3 code path. The same fallback covers endpoints introduced by metadata refreshes that have not passed the caller's permission check: the driver only connects to endpoints approved in watch(), and the per-watch path re-checks permissions on every request. Watches with more than MAX_WATCHED_KEYS keys or an empty key list also use version 3 semantics. * server: add the /watch_channel WebSocket endpoint, gated on x-denokv-version: 4. The server diffs watcher output against what each channel client is known to have, validates key sizes, enforces a per-channel key limit (close code 1008), batches bursts of add/remove messages into a single watcher rebuild (removals need no rebuild at all), and pings every 5s. The metadata endpoint now negotiates up to version 4. * The watch() stream contract is unchanged regardless of negotiated version: the first item is a full snapshot and later items mark untouched keys as Unchanged, in request key order. Both protocol paths share one entry conversion.

Commit:e6a50cf
Author:Heyang Zhou
Committer:GitHub

feat: atomic sum on v8 values (#53)

The documentation is generated from this commit.

Commit:e667027
Author:Heyang Zhou
Committer:GitHub

feat: append versionstamp to key (#40) This adds a new `M_SET_SUFFIX_VERSIONSTAMPED_KEY` mutation type that is same as `M_SET` except that the hex-encoded versionstamp of the current atomic operation is appended to the key.

Commit:801b32a
Author:Luca Casonato
Committer:GitHub

feat: kv.watch support (#26) This commit adds support for the `Database::watch` method in both SQLite and remote backends, and the `/watch` method in the KV Connect protocol. --------- Co-authored-by: losfair <zhy20000919@hotmail.com>

Commit:7e77d08
Author:Heyang Zhou
Committer:GitHub

feat: s3 replica and pitr (#17) This commit adds support for syncing to the local database from an S3 backup, and doing PITR on this synced database.

Commit:bbd938d
Author:Luca Casonato
Committer:GitHub

feat: remote database backend (#7)

Commit:ba84c38
Author:Luca Casonato
Committer:GitHub

feat: KV Connect protocol spec (#6) This commit adds a proper spec for the KV Connect protocol.

Commit:6e098b9
Author:Luca Casonato
Committer:GitHub

Rewrite the Deno KV implementation (#1) The core of this rewrite is that all SQLite operations now synchronously run from a single thread, and the sqlite connection is pinned to this thread. This cleans up the messy coordination using mutexes and spawn_blocking that we were doing previously. Also: Use `chrono` for all time related things, and implement `Send` for `Sqlite` (the DB handle). Also implements versionstamp increment randomization - we now increment the versionstamp by a random amount between 1 and 10, rather than always by 1.

Commit:e42f659
Author:Luca Casonato

Rewrite the Deno KV implementation