refactor: extract DownloadStore from ClientContext

Move the Vec<Download> and the download lifecycle methods (add, remove,
lookup, status update, pause, resume, remove-if-queued) into a new
download_store module. ClientContext keeps thin delegating shims so
peer/listen, peer/download_peer and the existing client tests carry on
unchanged. Client::pause_download / resume_download / remove_queued_download
now delegate one-liners. Client::process_failed_uploads keeps the
read-then-write lock dance but the inner filtering is the new
collect_failed_tokens helper.

Adds dedicated unit tests for the store's behavior (add/get/remove,
pause+resume, queued-only removal, failed-token collection) so the
state-machine logic is exercised independently of Client.
This commit is contained in:
michel
2026-04-26 12:36:30 +02:00
parent e1ee3ac493
commit 28baebdb2e
3 changed files with 313 additions and 93 deletions
+1
View File
@@ -2,6 +2,7 @@
pub mod actor;
pub mod client;
pub mod dispatcher;
pub mod download_store;
pub mod error;
pub mod message;
pub mod peer;