Move iroh_driver and the relay binary out of distribution into a dedicated crates/iroh-driver (lib re-exports IrohDriver; relay bin renamed). Remove the node crate and the single-gpu-inference example; drop the docker/datastream demo. Slim pipeline-parallel vastai. Signed-off-by: Zachery Aaron Shores-Chmielewski <zacheryasc@gmail.com>
19 lines
703 B
Rust
19 lines
703 B
Rust
use std::path::Path;
|
|
|
|
use crate::types::FleetState;
|
|
|
|
impl FleetState {
|
|
pub fn load(path: &Path) -> Result<Self, String> {
|
|
let raw = std::fs::read_to_string(path)
|
|
.map_err(|e| format!("cannot read fleet state {}: {e}", path.display()))?;
|
|
serde_json::from_str(&raw)
|
|
.map_err(|e| format!("cannot parse fleet state {}: {e}", path.display()))
|
|
}
|
|
|
|
pub fn save(&self, path: &Path) -> Result<(), String> {
|
|
let raw = serde_json::to_string_pretty(self)
|
|
.map_err(|e| format!("cannot serialize fleet state: {e}"))?;
|
|
std::fs::write(path, raw)
|
|
.map_err(|e| format!("cannot write fleet state {}: {e}", path.display()))
|
|
}
|
|
}
|