fetch: add parallel downloads and --shelve flag

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Id61b7c502923c697599cfb3afed948d56a6a6964
This commit is contained in:
raf 2026-02-12 23:20:26 +03:00
commit 788bdb0f1b
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
2 changed files with 225 additions and 19 deletions

View file

@ -12,7 +12,7 @@ use std::{
fs::{self, File, OpenOptions},
io::Write,
os::unix::{fs::PermissionsExt, io::AsRawFd},
path::PathBuf,
path::{Path, PathBuf},
time::{Duration, SystemTime},
};
@ -108,7 +108,7 @@ impl IpcCoordinator {
/// Extract modpack hash from pakku.json's parentLockHash field.
/// This is the authoritative content hash for the modpack (Nix-style).
fn get_modpack_hash(working_dir: &PathBuf) -> Result<String, IpcError> {
fn get_modpack_hash(working_dir: &Path) -> Result<String, IpcError> {
let pakku_path = working_dir.join("pakku.json");
if !pakku_path.exists() {
@ -147,7 +147,7 @@ impl IpcCoordinator {
/// Create a new IPC coordinator for the given modpack directory.
/// Uses parentLockHash from pakku.json to identify the modpack.
pub fn new(working_dir: &PathBuf) -> Result<Self, IpcError> {
pub fn new(working_dir: &Path) -> Result<Self, IpcError> {
let modpack_hash = Self::get_modpack_hash(working_dir)?;
let ipc_base = Self::get_ipc_base_dir();
let ipc_dir = ipc_base.join(&modpack_hash);
@ -187,6 +187,7 @@ impl IpcCoordinator {
.read(true)
.write(true)
.create(true)
.truncate(false)
.open(&self.ops_file)
.map_err(|e| IpcError::InvalidFormat(e.to_string()))?;