pub struct PodSandbox {
pub id: String,
pub metadata: PodSandboxMetadata,
pub state: PodSandboxState,
pub created_at: DateTime<Utc>,
pub labels: Vec<KeyValue>,
pub annotations: Vec<KeyValue>,
pub runtime_handler: String,
/* private fields */
}Expand description
Runtime representation of a pod sandbox
The sandbox stores an opaque backend_handle from the SandboxBackend
that started it. Callers can downcast to the concrete handle type
(e.g. KataHandle, NspawnHandle) via as_any().
Fields§
§id: StringUnique sandbox ID
metadata: PodSandboxMetadataSandbox metadata
state: PodSandboxStateCurrent state
created_at: DateTime<Utc>Creation timestamp
labels: Vec<KeyValue>Labels
annotations: Vec<KeyValue>Annotations
runtime_handler: StringRuntime handler (e.g., “kata”, “nspawn”)
Implementations§
Source§impl PodSandbox
impl PodSandbox
Sourcepub fn new(id: String, config: &PodSandboxConfig, sandbox_path: PathBuf) -> Self
pub fn new(id: String, config: &PodSandboxConfig, sandbox_path: PathBuf) -> Self
Create a new pod sandbox from configuration
The sandbox is created in the NotReady state. The SandboxBackend
will populate backend_handle when it starts the sandbox.
Sourcepub fn from_info(
id: String,
metadata: PodSandboxMetadata,
state: PodSandboxState,
created_at: DateTime<Utc>,
labels: Vec<KeyValue>,
annotations: Vec<KeyValue>,
runtime_handler: String,
) -> Self
pub fn from_info( id: String, metadata: PodSandboxMetadata, state: PodSandboxState, created_at: DateTime<Utc>, labels: Vec<KeyValue>, annotations: Vec<KeyValue>, runtime_handler: String, ) -> Self
Create a pod sandbox from RPC response info
Used when parsing list_pod_sandbox response from WorkerService.
Sourcepub fn backend_handle(&self) -> Option<&Arc<dyn SandboxHandle>>
pub fn backend_handle(&self) -> Option<&Arc<dyn SandboxHandle>>
Get the backend handle (for downcasting to concrete type)
Sourcepub fn set_backend_handle(&mut self, handle: Arc<dyn SandboxHandle>)
pub fn set_backend_handle(&mut self, handle: Arc<dyn SandboxHandle>)
Set the backend handle
Sourcepub fn mark_ready(&mut self)
pub fn mark_ready(&mut self)
Mark sandbox as ready
Sourcepub fn mark_not_ready(&mut self)
pub fn mark_not_ready(&mut self)
Mark sandbox as not ready
Sourcepub fn sandbox_path(&self) -> &PathBuf
pub fn sandbox_path(&self) -> &PathBuf
Get the sandbox runtime directory path
Sourcepub fn console_socket(&self) -> Option<&Path>
pub fn console_socket(&self) -> Option<&Path>
Path to the VM serial console UNIX socket, if set by the backend.
Trait Implementations§
Source§impl Clone for PodSandbox
impl Clone for PodSandbox
Source§impl Debug for PodSandbox
impl Debug for PodSandbox
Source§impl From<&PodSandbox> for PodSandboxInfo
impl From<&PodSandbox> for PodSandboxInfo
Source§fn from(s: &PodSandbox) -> Self
fn from(s: &PodSandbox) -> Self
Source§impl From<&PodSandbox> for PodSandboxStats
impl From<&PodSandbox> for PodSandboxStats
Source§fn from(s: &PodSandbox) -> Self
fn from(s: &PodSandbox) -> Self
Source§impl From<&PodSandbox> for PodSandboxStatus
impl From<&PodSandbox> for PodSandboxStatus
Source§fn from(s: &PodSandbox) -> Self
fn from(s: &PodSandbox) -> Self
Auto Trait Implementations§
impl Freeze for PodSandbox
impl !RefUnwindSafe for PodSandbox
impl Send for PodSandbox
impl Sync for PodSandbox
impl Unpin for PodSandbox
impl UnsafeUnpin for PodSandbox
impl !UnwindSafe for PodSandbox
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more