aboutsummaryrefslogtreecommitdiffstats
path: root/atuin-client
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@elliehuxtable.com>2023-08-07 11:18:39 +0100
committerGitHub <noreply@github.com>2023-08-07 11:18:39 +0100
commit0d5332a87facabb7227458586002226fafa11acb (patch)
tree719adf05cb0c5ae999e4e2fee00436c0376053ae /atuin-client
parentfix(docs): Correct command overview paths (#1145) (diff)
downloadatuin-0d5332a87facabb7227458586002226fafa11acb.zip
Prepare release v16.0.0 (#1143)
* Prepare release v16.0.0 * Remove debug output * Fix kv dupes if the store already exists * Add limit in frontend as well as sync backend
Diffstat (limited to 'atuin-client')
-rw-r--r--atuin-client/Cargo.toml2
-rw-r--r--atuin-client/src/encryption.rs3
-rw-r--r--atuin-client/src/kv.rs8
-rw-r--r--atuin-client/src/record/sync.rs7
4 files changed, 16 insertions, 4 deletions
diff --git a/atuin-client/Cargo.toml b/atuin-client/Cargo.toml
index ca620677..42513d3e 100644
--- a/atuin-client/Cargo.toml
+++ b/atuin-client/Cargo.toml
@@ -23,7 +23,7 @@ sync = [
]
[dependencies]
-atuin-common = { path = "../atuin-common", version = "15.0.0" }
+atuin-common = { path = "../atuin-common", version = "16.0.0" }
log = { workspace = true }
base64 = { workspace = true }
diff --git a/atuin-client/src/encryption.rs b/atuin-client/src/encryption.rs
index 00185fb6..d6c5f893 100644
--- a/atuin-client/src/encryption.rs
+++ b/atuin-client/src/encryption.rs
@@ -147,8 +147,7 @@ fn encode(h: &History) -> Result<Vec<u8>> {
encode::write_str(&mut output, &h.id)?;
encode::write_str(
&mut output,
- &dbg!(h
- .timestamp
+ &(h.timestamp
.to_rfc3339_opts(chrono::SecondsFormat::AutoSi, true)),
)?;
encode::write_sint(&mut output, h.duration)?;
diff --git a/atuin-client/src/kv.rs b/atuin-client/src/kv.rs
index 30018d63..ad53a3d1 100644
--- a/atuin-client/src/kv.rs
+++ b/atuin-client/src/kv.rs
@@ -7,6 +7,7 @@ use crate::settings::Settings;
const KV_VERSION: &str = "v0";
const KV_TAG: &str = "kv";
+const KV_VAL_MAX_LEN: usize = 100 * 1024;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct KvRecord {
@@ -91,6 +92,13 @@ impl KvStore {
key: &str,
value: &str,
) -> Result<()> {
+ if value.len() > KV_VAL_MAX_LEN {
+ return Err(eyre!(
+ "kv value too large: max len {} bytes",
+ KV_VAL_MAX_LEN
+ ));
+ }
+
let host_id = Settings::host_id().expect("failed to get host_id");
let record = KvRecord {
diff --git a/atuin-client/src/record/sync.rs b/atuin-client/src/record/sync.rs
index ebdb8eb2..ad9079ed 100644
--- a/atuin-client/src/record/sync.rs
+++ b/atuin-client/src/record/sync.rs
@@ -124,7 +124,12 @@ async fn sync_upload(
// we need to iterate from the remote tail, and keep going until
// remote tail = current local tail
- let mut record = Some(store.get(start).await.unwrap());
+ let mut record = if current_tail.is_some() {
+ let r = store.get(start).await.unwrap();
+ store.next(&r).await?
+ } else {
+ Some(store.get(start).await.unwrap())
+ };
let mut buf = Vec::with_capacity(upload_page_size);