Skip to content

refactor: batch KV set and delete operations - #173

Merged
RhysSullivan merged 2 commits into
mainfrom
refactor/batch-kv-operations
Apr 10, 2026
Merged

refactor: batch KV set and delete operations#173
RhysSullivan merged 2 commits into
mainfrom
refactor/batch-kv-operations

Conversation

@RhysSullivan

Copy link
Copy Markdown
Collaborator

Summary

  • Kv.set now takes readonly KvEntry[] instead of single key/value
  • Kv.delete now takes readonly string[] instead of single key
  • Postgres uses single INSERT ON CONFLICT / DELETE WHERE IN queries
  • All plugins, storage backends, and tests updated

Test plan

  • Typecheck + lint clean
  • storage-postgres tests pass

Change Kv.set to accept an array of {key, value} entries and Kv.delete
to accept an array of keys. Postgres implementation uses single INSERT
ON CONFLICT and DELETE WHERE IN queries instead of per-item statements.

For a 218-tool OpenAPI spec, this reduces source add from ~218 INSERT
statements to 1, and source delete from ~218 DELETEs to 1.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 10, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
executor-cloud c054d1f Apr 10 2026, 09:27 PM

@RhysSullivan
RhysSullivan force-pushed the refactor/batch-kv-operations branch 2 times, most recently from fd872c3 to fc729c7 Compare April 10, 2026 21:24

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@RhysSullivan
RhysSullivan merged commit a6cff1f into main Apr 10, 2026
2 checks passed
RhysSullivan added a commit that referenced this pull request May 31, 2026
* refactor: batch KV set and delete operations

Change Kv.set to accept an array of {key, value} entries and Kv.delete
to accept an array of keys. Postgres implementation uses single INSERT
ON CONFLICT and DELETE WHERE IN queries instead of per-item statements.

For a 218-tool OpenAPI spec, this reduces source add from ~218 INSERT
statements to 1, and source delete from ~218 DELETEs to 1.

* style: format
@RhysSullivan
RhysSullivan deleted the refactor/batch-kv-operations branch June 11, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant