add a crate k2v client #303
No reviewers
Labels
No labels
action
check-aws
action
discussion-needed
action
for-external-contributors
action
for-newcomers
action
more-info-needed
action
need-funding
action
triage-required
kind
correctness
kind
ideas
kind
improvement
kind
performance
kind
testing
kind
usability
kind
wrong-behavior
prio
critical
prio
low
scope
admin-api
scope
background-healing
scope
build
scope
documentation
scope
k8s
scope
layout
scope
metadata
scope
ops
scope
rpc
scope
s3-api
scope
security
scope
telemetry
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Deuxfleurs/garage#303
Loading…
Reference in a new issue
No description provided.
Delete branch "trinity-1686a/garage:k2v-client"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The code for a working client is there, in the future having a CLI along the way would be nice too.
lib.rs could use getting split in modules, but I'm not sure how exactly
@ -0,0 +200,4 @@
// TODO poke team, draft doc outdated fot the return type of this endpoint
/// Perform a ReadIndex request, listing partition key which have at least one associated
/// sort key, and which matches the filter.
pub async fn read_index<'a>(
The documentation says the response is
but actually partitionKeys values are
{pk: "keys", entries: 1, conflicts: 1, values: 1, bytes: 1}
2e614a2ad9
to149695e144
149695e144
tod0e3434104
GJ, just a small remark below. I'll fix the documentation for ReadIndex.
@ -0,0 +117,4 @@
req.add_param("sort_key", sort_key);
req.add_param("causality_token", &causality.0);
req.add_param("timeout", &timeout.as_secs().to_string());
req.add_header(ACCEPT, "application/octet-stream, application/json;q=0.9");
The server doesn't handle
q=0.9
, this probably breaks k2v in its current state. In all cases when both are specified,application/octet-stream
is already preferred when possible.I noticed when testing, but apparently I forgot to commit
@ -0,0 +197,4 @@
Ok(())
}
// TODO poke team, draft doc outdated fot the return type of this endpoint
thx
d15f3ff083
toeca192af43
@ -11,2 +11,3 @@
"src/garage"
"src/garage",
"src/k2v-client",
]
In the current state this breaks
cargo run
in the root project directory:To fix this, just add:
@ -0,0 +4,4 @@
use clap::{Parser, Subcommand};
/// Simple program to greet a person
I think this comment is wrong
oops that's a copy-past from the doc
@ -0,0 +167,4 @@
let mut val = val.value;
if val.len() != 1 {
eprintln!(
"Raw mode can only read non-concurent values, fond {} values, expected 1",
found*
@ -0,0 +255,4 @@
/// Return only keys where conflict happened
#[clap(short, long)]
conflicts_only: bool,
/// Return only keys storing tombstones
The comment for this should be: "also include keys storing only tombstones", it doesn't list only these keys, just it includes them as well
@ -0,0 +350,4 @@
});
let stdout = std::io::stdout();
serde_json::to_writer(stdout, &json).unwrap();
I think it would be nice to use
to_writer_pretty
here and everywhere where JSON is produced@ -0,0 +360,4 @@
println!(
"{}: {},{},{},{}",
k, v.entries, v.conflicts, v.values, v.bytes
);
We have a simple table formatting function in
garage/cli/util.rs
, maybe reuse that?I think
format_table()
should be moved to garage_util for that. Having k2v-client depends on all of the server code sounds bad@ -0,0 +438,4 @@
}
} else {
false
};
I think this can lead to some confusion, because
limit = 1
andsingleItem = true
do not mean the same thing.If my items are B, C and D:
start = A, limit = 1
will return B (it looks for the first item, starting from A)start = A, singleItem = true
will return nothing (it looks for A exactly)Here deleting a single item is already handled by the
delete
subcommand, so I think we should just forbid the usage oflimit
in DeleteRange@ -0,0 +503,4 @@
#[serde(default)]
pub conflicts_only: bool,
#[serde(default)]
pub include_tombstones: bool,
This field isn't called
include_tombstones
but justtombstones
(currently the-t
flag is not working in k2v-cli)