runtime-rs: Introduce a cached sandbox exit information

Introduce an exit_info field in SandboxInner so sandbox teardown can
store a stable exit result in runtime state.

The follow-on WaitSandbox rework needs a place to keep the final
SandboxExitInfo after the sandbox has already stopped. Without that
cached result, later waiters would have no consistent value to return
once the original stop event has passed.

This change only adds the state holder. Behaviour changes follow in
later commits.

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
This commit is contained in:
Alex Lyn
2026-04-30 18:07:43 +08:00
parent dcafae9645
commit 5ae7b2d8b5

View File

@@ -75,6 +75,7 @@ use resource::{ResourceConfig, ResourceManager};
use runtime_spec as spec;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::time::SystemTime;
use strum::Display;
use tokio::sync::{mpsc::Sender, Mutex, RwLock};
use tracing::instrument;
@@ -96,12 +97,14 @@ pub enum SandboxState {
struct SandboxInner {
state: SandboxState,
exit_info: Option<SandboxExitInfo>,
}
impl SandboxInner {
pub fn new() -> Self {
Self {
state: SandboxState::Init,
exit_info: None,
}
}
}