From 81c1cee1b84fef887a44279ba37791bc20f07ca4 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 12 Dec 2023 10:51:36 -0800 Subject: [PATCH] chore(types): storageHelper params --- packages/SwingSet/src/kernel/state/storageHelper.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/SwingSet/src/kernel/state/storageHelper.js b/packages/SwingSet/src/kernel/state/storageHelper.js index 835153c785e..86b2b0d4dfa 100644 --- a/packages/SwingSet/src/kernel/state/storageHelper.js +++ b/packages/SwingSet/src/kernel/state/storageHelper.js @@ -26,7 +26,10 @@ export function* enumeratePrefixedKeys(kvStore, prefix, exclusiveEnd) { } } -// NOTE: awkward naming: the thing that returns a stream of keys is named +/** + * @param {KVStore} kvStore + * @param {string} prefix + */ // NOTE: awkward naming: the thing that returns a stream of keys is named // "enumerate..." while the thing that returns a stream of values is named // "get..." function* enumerateNumericPrefixedKeys(kvStore, prefix) { @@ -43,12 +46,20 @@ function* enumerateNumericPrefixedKeys(kvStore, prefix) { } } +/** + * @param {KVStore} kvStore + * @param {string} prefix + */ export function* getPrefixedValues(kvStore, prefix) { for (const key of enumerateNumericPrefixedKeys(kvStore, prefix)) { yield kvStore.get(key) || Fail`enumerate ensures get`; } } +/** + * @param {KVStore} kvStore + * @param {string} prefix + */ export function deletePrefixedKeys(kvStore, prefix) { // this is kind of like a deleteRange() would be, but can be implemented // efficiently without backend DB support because it only looks at numeric