Open ooker777 opened 1 month ago
I'm unclear on the purpose of setting values in both local and cloud at the same time?
Other points:
kvGet()
function doesn't return anything. kvSetValueAndCount
isn't atomic. Let's say the count is 0 for all tables. You could have a situation where two requests both get the CountMap for the same TableName before updating it, both set-value-and-update-count, but now your table count is 1, but the table has two values on it.Maybe it's because I'm a noob and haven't figured out a better way for this. It's for testing purpose. Sometimes my data has a significant change, and I want to test in local before updating to the cloud. By making the mapKv
map, I can turn on and off which database I want to push by simply commenting or uncommenting these lines:
mapKV.set("Cloud", await Deno.openKv(env["LOCATION"]));
mapKV.set("Local", await Deno.openKv());
Is that clearer?
Thanks for your other feedback. I've fixed the kvGet()
. As for the kvSetValueAndCount
, you are talking about a table of a database has duplicated updates from both database setting, right? I'm not sure why that is the case.
Here is my current and proposed util function to work with both local and cloud KV databases:
Do you think it's suitable for this repo?