Support OCI bundles containing multiple independently restorable snapshots

未关闭
#1,865 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
45/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
rust

调研方向

Start with Snapshot::load and Snapshot::save, focusing on resolution through the OCI layout's root index.json. Trace how a tagged descriptor is selected and how manifests and blobs are loaded. Done means a tagged bundle can contain independently restorable loaded-state and runtime-ready-baseline snapshots, selected by role, with standard OCI traversal preserving both.

由索引模型根据 Issue 内容生成。

描述

S-needs-triage
Problem

hyperlight-js needs two hyperlight snapshots to persist a LoadedJSSandbox:

  1. Loaded state: the JavaScript runtime with user modules and handlers registered, including mutable JavaScript state produced by handle_event() calls.
  2. Runtime-ready baseline: the state captured immediately after loading the JavaScript runtime, before registering user modules or handlers.

JSSandbox::get_loaded_sandbox() carries the runtime-ready baseline into the resulting LoadedJSSandbox. Later, LoadedJSSandbox::unload() restores that baseline to discard registered guest code and mutable module state and return a JSSandbox.

A typical lifecycle is:

let mut sandbox = builder.build()?.load_runtime()?;
sandbox.add_module("counter", module)?;
sandbox.add_handler("handler", handler)?;

let mut loaded = sandbox.get_loaded_sandbox()?;
loaded.handle_event("handler", event, None)?;

let snapshot = loaded.snapshot()?;
snapshot.save(path, "application-ready")?;

// In another process:
let snapshot = Snapshot::load(path, "application-ready")?;
let loaded = builder
    .build_from_snapshot(snapshot)?
    .restore_loaded_sandbox()?;

let sandbox = loaded.unload()?; // Requires the runtime-ready baseline.

hyperlight-js currently saves the loaded state and runtime-ready baseline as independent top-level OCI manifests. The loaded-state config records the baseline manifest digest in application metadata.

That relationship is not visible through OCI descriptors:

  • Copying only the application-ready tag may omit the baseline manifest and config.
  • OCI garbage collection cannot infer that both manifests form one logical artifact.
  • The copied hyperlight-js snapshot cannot be loaded because hyperlight-js eagerly resolves the baseline manifest.
  • If baseline loading became lazy, LoadedJSSandbox::unload() would still fail when the baseline was absent.
Relationship to incremental snapshots

HIP 0003 / #1823 proposes that each incremental snapshot manifest directly reference every memory blob needed to restore that state.

That solves inherited memory-blob reachability for one Hyperlight snapshot. It does not preserve a second independently restorable state.

The loaded-state manifest may reference memory blobs shared with the runtime-ready baseline, but it does not preserve the baseline’s manifest, config, or semantic role. The HIP intentionally does not retain parent snapshot references.

This request concerns bundling multiple independently restorable snapshots, not representing the internal memory layers of one incremental snapshot.

Current limitation

Snapshot::load resolves a tag or digest only among descriptors directly present in the layout’s root index.json.

The selected descriptor must have media type application/vnd.oci.image.manifest.v1+json. A tagged nested image index containing multiple related snapshot manifests is therefore rejected.

Required Capability

Provide a supported way to represent multiple independently restorable Hyperlight snapshots as one strongly linked OCI artifact.

One possible representation is a tagged OCI image index:

index.json
└── application-ready bundle index
    ├── loaded-state manifest
    └── runtime-ready-baseline manifest

Each child descriptor would carry an explicit application-defined role annotation. Standard OCI tooling could then discover and copy every required manifest and blob by traversing the tagged index.

OCI subject is not sufficient because it defines a weak association with a separate DAG rather than containment within one artifact.

Possible API
  1. Native snapshot-bundle save/load APIs.
  2. Bundle loading resolves a tagged image index and selects children by role.
let bundle = SnapshotBundle::load(path, "application-ready")?;
let loaded = bundle.snapshot("loaded-state")?;
let baseline = bundle.snapshot("runtime-ready-baseline")?;
主要语言
Rust
星标
4.8k
派生
222
平均合并
1 天 16 小时
30 天内合并 PR
60

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

hyperlight-dev/hyperlight 的其他 Issue

查看 hyperlight-dev/hyperlight 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。