From df055fc4e9619a241c89b4a3362bc7bf2452fbb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?=
<40151420+ldericher@users.noreply.github.com>
Date: Thu, 19 Jun 2025 10:34:28 +0000
Subject: [PATCH] [wip] implement handling "missing share"
- rework `CacheFile` API
- fix `AppState::{next_chunk, is_done}`
---
src/appstate.rs | 48 +++++++++++++++++++++---------------------------
src/cachefile.rs | 42 ++++++++++++++++++++++++++++++------------
2 files changed, 51 insertions(+), 39 deletions(-)
diff --git a/src/appstate.rs b/src/appstate.rs
index 68eff53..29edeb9 100644
--- a/src/appstate.rs
+++ b/src/appstate.rs
@@ -9,7 +9,7 @@ use indicatif::{ProgressBar, ProgressStyle};
use log::{debug, warn};
use crate::{
- cachefile::{CacheFile, FileState},
+ cachefile::CacheFile,
cli::Cli,
file::{self, Chunk, FileTrait},
sharry::{self, Client},
@@ -89,7 +89,7 @@ impl AppState {
})
}
- fn end_progressbar(&self, f: impl FnOnce(&ProgressBar)) {
+ fn drop_progressbar(&self, f: impl FnOnce(&ProgressBar)) {
let mut slot = self.progress.borrow_mut();
if let Some(bar) = slot.as_ref() {
f(bar);
@@ -97,8 +97,8 @@ impl AppState {
}
}
- fn next_chunk<'t>(&mut self, buffer: &'t mut [u8]) -> io::Result