MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / build_driver_sandbox

Function build_driver_sandbox

crates/openshell-driver-podman/src/watcher.rs:247–269  ·  view source on GitHub ↗

Construct a `DriverSandbox` from common fields. Centralises the boilerplate that every event/inspect/list path shares: `namespace`, `spec`, `agent_fd`, and `sandbox_fd` are always empty in the Podman driver.

(
    sandbox_id: String,
    sandbox_name: String,
    instance_name: String,
    instance_id: String,
    condition: DriverCondition,
    deleting: bool,
)

Source from the content-addressed store, hash-verified

245/// `namespace`, `spec`, `agent_fd`, and `sandbox_fd` are always empty in
246/// the Podman driver.
247fn build_driver_sandbox(
248 sandbox_id: String,
249 sandbox_name: String,
250 instance_name: String,
251 instance_id: String,
252 condition: DriverCondition,
253 deleting: bool,
254) -> DriverSandbox {
255 DriverSandbox {
256 id: sandbox_id,
257 name: sandbox_name,
258 namespace: String::new(),
259 spec: None,
260 status: Some(DriverSandboxStatus {
261 sandbox_name: instance_name,
262 instance_id,
263 agent_fd: String::new(),
264 sandbox_fd: String::new(),
265 conditions: vec![condition],
266 deleting,
267 }),
268 }
269}
270
271/// Build a `DriverSandbox` from a container inspection result.
272pub fn driver_sandbox_from_inspect(inspect: &ContainerInspect) -> Option<DriverSandbox> {

Callers 3

map_podman_eventFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected