Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Add bulk upload to Workers KV #445

Merged
merged 2 commits into from
Aug 21, 2019
Merged

Conversation

gabbifish
Copy link
Contributor

@gabbifish gabbifish commented Aug 15, 2019

This PR adds support for bulk uploads to Workers KV; it currently supports reading from JSON files and uploading directories. The subcommand is used like the following:

wrangler kv write bulk <NAMESPACE_ID> <JSON_FILE_OR_DIRECTORY> 

JSON input is of the format

[{"key": "gabbi", "value": "fisher", "expiration_ttl": <optional_second_value>, "expiration": <optional epoch_second_value>, "base64": <optional_true_or_false>}, ...]

and wrangler output looks like

$ wrangler kv write bulk 06779da6940b431db6e566b4846d64db test.json 
 Success

Output for a directory upload looks like

$ wrangler kv write bulk 06779da6940b431db6e566b4846d64db abc
 Uploading a.txt...
 Uploading b%2Fc.txt...
 Success

^ the working swirl emoji is used here for each Uploading... line but just doesn't show up on my Ubuntu installation for now. :)

This PR will fail to build until the necessary API changes are also merged into cloudflare-rs (cloudflare/cloudflare-rs#28), because it is dependent on these changes.

This PR closes #346.

@gabbifish gabbifish force-pushed the gabbi/add-bulk-upload branch 2 times, most recently from 613f6b0 to 87546d0 Compare August 15, 2019 23:04
@gabbifish gabbifish changed the title Gabbi/add bulk upload [WIP] Gabbi/add bulk upload Aug 15, 2019
src/commands/kv/write_bulk.rs Outdated Show resolved Hide resolved
src/commands/kv/write_bulk.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@Electroid Electroid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just made some design comments, really excited to see this come out soon!

src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/commands/kv/write_bulk.rs Outdated Show resolved Hide resolved
src/commands/kv/write_bulk.rs Show resolved Hide resolved
@gabbifish gabbifish force-pushed the gabbi/add-bulk-upload branch from 9b9ee7d to 4fd03a4 Compare August 19, 2019 20:30
@gabbifish gabbifish changed the title [WIP] Gabbi/add bulk upload Gabbi/add bulk upload Aug 19, 2019
@gabbifish gabbifish changed the title Gabbi/add bulk upload Add bulk upload to Workers KV Aug 19, 2019
@gabbifish gabbifish changed the title Add bulk upload to Workers KV [WIP] Add bulk upload to Workers KV Aug 19, 2019
@gabbifish gabbifish changed the title [WIP] Add bulk upload to Workers KV Add bulk upload to Workers KV Aug 20, 2019
Copy link
Contributor

@ashleymichal ashleymichal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one copy-pasta, but otherwise lgtm! 👍

src/commands/kv/write_bulk.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
@ashleymichal ashleymichal added changelog - feature regression Something is broken, but works in previous releases and removed status - needs review labels Aug 20, 2019
@gabbifish gabbifish force-pushed the gabbi/add-bulk-upload branch from 5bb2d45 to ce88183 Compare August 21, 2019 06:16
@gabbifish gabbifish merged commit df8219a into feat-kv-commands Aug 21, 2019
@delete-merged-branch delete-merged-branch bot deleted the gabbi/add-bulk-upload branch August 21, 2019 06:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
regression Something is broken, but works in previous releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants