Skip to content

Commit b81e97d

Browse files
committed
Update Nanvix and Cache Handling Logic
Signed-off-by: Pedro Henrique Penna <ppenna@microsoft.com>
1 parent e5fa6b3 commit b81e97d

File tree

6 files changed

+163
-114
lines changed

6 files changed

+163
-114
lines changed

Cargo.lock

Lines changed: 50 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ edition = "2021"
55
description = "A Hyperlight VMM wrapper with out-of-the-box support for running Nanvix microkernel guests"
66

77
[dependencies]
8-
nanvix = { git = "https://github.com/nanvix/nanvix", rev = "7752e9f2deb4a5606f9885e4c130eec4ea583de1", features = [
8+
nanvix = { git = "https://github.com/nanvix/nanvix", rev = "cc9c508918bd17678e9d790f10a6a7c20b7902da", features = [
99
"single-process",
1010
"hyperlight",
1111
] }
1212
tokio = { version = "1.0", features = ["rt-multi-thread", "macros"] }
1313
anyhow = "1.0"
1414
clap = { version = "4", features = ["derive"] }
15+
dirs = "6"
1516
libc = "0.2.178"
1617

1718
# NAPI bindings (optional)

src/bin/hyperlight-nanvix.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use anyhow::Result;
22
use clap::{Parser, Subcommand};
33
use hyperlight_nanvix::{cache, RuntimeConfig, Sandbox};
44
use nanvix::log;
5-
use nanvix::registry::Registry;
65
use std::path::PathBuf;
76

87
/// A Hyperlight VMM wrapper with out-of-the-box support for running Nanvix microkernel guests
@@ -39,42 +38,40 @@ const DEFAULT_LOG_LEVEL: &str = "info";
3938
async fn setup_registry_command() -> Result<()> {
4039
println!("Setting up Nanvix registry...");
4140

42-
// Check cache status first using shared cache utilities
41+
// Check cache status first using local filesystem probes
4342
let kernel_cached = cache::is_binary_cached("kernel.elf");
4443
let qjs_cached = cache::is_binary_cached("qjs");
4544
let python_cached = cache::is_binary_cached("python3");
4645

4746
if kernel_cached && qjs_cached && python_cached {
4847
println!("Registry already set up at ~/.cache/nanvix-registry/");
4948
} else {
50-
// Trigger registry download by requesting key binaries
51-
let registry = Registry::new(None);
52-
49+
// Download missing binaries via get_cached_binary_path (local first, registry fallback)
5350
if !kernel_cached {
5451
print!("Downloading kernel.elf... ");
55-
let _kernel = registry
56-
.get_cached_binary("hyperlight", "single-process", "kernel.elf")
57-
.await?;
52+
cache::get_cached_binary_path("kernel.elf")
53+
.await
54+
.ok_or_else(|| anyhow::anyhow!("Failed to download kernel.elf"))?;
5855
println!("done");
5956
} else {
6057
println!("kernel.elf already cached");
6158
}
6259

6360
if !qjs_cached {
6461
print!("Downloading qjs binary... ");
65-
let _qjs = registry
66-
.get_cached_binary("hyperlight", "single-process", "qjs")
67-
.await?;
62+
cache::get_cached_binary_path("qjs")
63+
.await
64+
.ok_or_else(|| anyhow::anyhow!("Failed to download qjs"))?;
6865
println!("done");
6966
} else {
7067
println!("qjs already cached");
7168
}
7269

7370
if !python_cached {
7471
print!("Downloading python3 binary... ");
75-
let _python = registry
76-
.get_cached_binary("hyperlight", "single-process", "python3")
77-
.await?;
72+
cache::get_cached_binary_path("python3")
73+
.await
74+
.ok_or_else(|| anyhow::anyhow!("Failed to download python3"))?;
7875
println!("done");
7976
} else {
8077
println!("python3 already cached");

0 commit comments

Comments
 (0)