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

Dr/kv overhaul #641

Merged
merged 8 commits into from
Dec 22, 2024
Merged

Dr/kv overhaul #641

merged 8 commits into from
Dec 22, 2024

Conversation

dr-frmr
Copy link
Member

@dr-frmr dr-frmr commented Dec 21, 2024

please give feedback on kv types,
caps had big vuln, fixed
kv runtime was cloning unnecessarily so refactored some of that out

@dr-frmr dr-frmr changed the base branch from main to v0.10.0 December 21, 2024 00:29
@nick1udwig
Copy link
Contributor

Looks good 👍

I wonder if there should be a DbKey type? I guess the choice to not have it is to make it easier for consumers of the API (since they won't have to, e.g., import that type in order to talk to kv)?

pub enum KvResponse {
Ok,
BeginTx { tx_id: u64 },
Get { key: Vec<u8> },
Get(Vec<u8>),
Copy link
Contributor

Choose a reason for hiding this comment

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

now that it's no longer super obvious that the vec here is the original key used in the get request, we should at least add a comment that specifies that the returned value will be in the blob

pub struct KvRequest {
pub package_id: PackageId,
pub db: String,
pub action: KvAction,
}

#[derive(Debug, Serialize, Deserialize, Clone)]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum KvAction {
Open,
RemoveDb,
Set { key: Vec<u8>, tx_id: Option<u64> },
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, //value in blob

@dr-frmr dr-frmr merged commit a6ba2cd into v0.10.0 Dec 22, 2024
1 check passed
@dr-frmr dr-frmr deleted the dr/kv-overhaul branch December 22, 2024 21:27
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.

3 participants