kitsonk / kv-toolbox

Utilities for working with Deno KV 🦕🗝️

Home Page:https://kview.deno.dev/kv-toolbox

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

atomic blob commands

inverted-capital opened this issue · comments

Is there a way to do the blob set operation as part of an atomic operation ?

There is a problem in that the amount of operations in an atomic operations is limited, but a blob set operations breaks down the data into discreet chunks which can easily exceed the transaction limit of an atomic operations.

In implementation at the moment, a blob set actually sets that parts using batched atomic transactions. I suspect though what you are really asking for is to be able to have something like .setBlob() as part of an atomic transaction?

It is possible to add that method to the batch atomic API, but because blob currently depends on batch atomic it means that we would have to reorganise the code a bit so there isn't a cyclical dependency.

Correct - setBlob() as part of an atomic transaction.

Ok thank you for your reply. The way I am doing it at the moment is setting the blob to a ulid key, then using an atomic transaction to update the key I want with the blob key, and rolling back if that fails.

Given how the set() function breaks up blobs into a set of keys, would it perhaps be simpler to implement a pointer key system as described rather than making the whole set() function be atomic ? Same result, but no code reorg and no hitting the atomic operation count limit 🤷

Thank you kindly 🔥