Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Workers KV bulk upload API endpoint #28

Merged
merged 1 commit into from
Aug 20, 2019

Conversation

gabbifish
Copy link
Contributor

@gabbifish gabbifish commented Aug 15, 2019

This PR adds support for the Workers KV bulk upload API endpoint: https://api.cloudflare.com/#workers-kv-namespace-write-multiple-key-value-pairs.

It is used by cloudflare/wrangler-legacy#445

src/workerskv/write_bulk.rs Outdated Show resolved Hide resolved
src/workerskv/write_bulk.rs Outdated Show resolved Hide resolved
@gabbifish gabbifish force-pushed the add-workers-kv-bulk-upload branch from 88abdd4 to 3d0164a Compare August 20, 2019 18:50
@gabbifish gabbifish merged commit 91944ab into cloudflare:master Aug 20, 2019
@gabbifish gabbifish deleted the add-workers-kv-bulk-upload branch August 20, 2019 18:51
#[serde(skip_serializing_if = "Option::is_none")]
pub expiration_ttl: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub base64: Option<bool>,
Copy link
Contributor

Choose a reason for hiding this comment

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

We should be leveraging mechanisms discussed in dtolnay/request-for-implementation#18 for skip_serializing_if and Option

Copy link
Contributor Author

@gabbifish gabbifish Aug 20, 2019

Choose a reason for hiding this comment

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

#[serde(skip_serializing_if = "Option::is_none")]
pub expiration: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub expiration_ttl: Option<i32>,
Copy link
Contributor

Choose a reason for hiding this comment

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

In other places (CreateDnsRecordParams) TTL field has been defined as u32, which seems more meaningful considering a negative TTL doesn't make sense.

Copy link
Contributor

@adamchalmers adamchalmers Aug 20, 2019

Choose a reason for hiding this comment

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

you may want to join the discussion here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I chatted with the KV team and apparently they use i64! I will use that instead (its max value is much larger than u32).

pub key: String,
pub value: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub expiration: Option<i32>,
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this hold?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It holds an expiration date (seconds since epoch)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants