This commit is contained in:
Ellie Huxtable 2023-11-23 09:27:16 +00:00
parent bf45eabe8b
commit 2a47234a78
3 changed files with 14 additions and 3 deletions

View File

@ -234,6 +234,13 @@ impl<'a> Client<'a> {
start: Option<RecordId>,
count: u64,
) -> Result<Vec<Record<EncryptedData>>> {
debug!(
"fetching record/s from host {}/{}/{}",
host.0.to_string(),
tag,
start.map_or(String::from("empty"), |f| f.0.to_string())
);
let url = format!(
"{}/record/next?host={}&tag={}&count={}",
self.sync_addr, host.0, tag, count
@ -264,6 +271,8 @@ impl<'a> Client<'a> {
let resp = self.client.get(url).send().await?;
let index = resp.json().await?;
debug!("got remote index {:?}", index);
Ok(index)
}

View File

@ -166,7 +166,7 @@ async fn sync_download(
op: (HostId, String, RecordId),
) -> Result<i64> {
// TODO(ellie): implement variable page sizing like on history sync
let download_page_size = 1000;
let download_page_size = 1;
let mut total = 0;
@ -185,7 +185,7 @@ async fn sync_download(
// In this case, that contains the remote tail.
assert_eq!(remote_tail, op.2);
println!("Downloading {:?}/{}/{:?} to local", op.0, op.1, op.2);
debug!("Downloading {:?}/{}/{:?} to local", op.0, op.1, op.2);
let mut records = client
.next_records(
@ -196,6 +196,8 @@ async fn sync_download(
)
.await?;
debug!("received {} records from remote", records.len());
while !records.is_empty() {
total += std::cmp::min(download_page_size, records.len() as u64);
store.push_batch(records.iter()).await?;

View File

@ -84,7 +84,7 @@ async fn run(
println!("{uploaded}/{downloaded} up/down to record store");
atuin_client::sync::sync(settings, force, db).await?;
//atuin_client::sync::sync(settings, force, db).await?;
println!(
"Sync complete! {} items in history database, force: {}",