Repository navigation
feat(durable): add get options (allowConcurrency, noCache) to Storage - #1101
Open
PedroRosalba wants to merge 1 commit into
Open
PedroRosalba wants to merge 1 commit into
PedroRosalba wants to merge 1 commit into
Conversation
`DurableObjectStorage.get(key, options)` and `get(keys, options)` take a `DurableObjectGetOptions` object (`allowConcurrency`, `noCache`) that the crate had no way to pass (cloudflare#716). Add `Storage::get_with_options` and `Storage::get_multiple_with_options` taking a new `GetOptions` struct, next to the existing `get_alarm_with_options` / `set_alarm_with_options` pattern. `get` and `get_multiple` are unchanged; `get` and `get_with_options` share one decode path. The test puts two keys, reads them back through both new methods (options set and `GetOptions::default()`), and asserts that the options object the runtime receives is camelCase.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DurableObjectStorage.get(key, options)andget(keys, options)take aDurableObjectGetOptionsobject (allowConcurrency,noCache) that the crate has no way to pass (#716).Change
Add
Storage::get_with_optionsandStorage::get_multiple_with_optionstaking a newGetOptionsstruct, next to the existingget_alarm_with_options/set_alarm_with_optionspattern.getandget_multipleare unchanged;getandget_with_optionsshare one decode path. Additive API, minor changeset.Tests
Puts two keys, reads them back through both new methods (options set and
GetOptions::default()), and asserts that the options object the runtime receives is camelCase.Tested on macOS (Apple Silicon) only.
Closes #716