pub struct ArangoGuard(/* private fields */);Expand description
The running guard for an ArangoContainer.
Implementations§
Methods from Deref<Target = ContainerGuard>§
Sourcepub fn network(&self) -> Option<&Arc<Network>>
pub fn network(&self) -> Option<&Arc<Network>>
The network this container joined, if any — a module may use this to
resolve a sibling’s alias from the guard itself rather than needing to keep a
separate Network reference around.
Sourcepub fn host(&self) -> &str
pub fn host(&self) -> &str
The host address published ports are reachable on — always loopback.
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
The backend-facing sandbox name (e.g. rz-<run-id>-<seq>, or
rz-reuse-<12hex> for a reuse container — see Container::reuse). This
is always the human-readable ledger/reaping name, on every backend — never
the docker daemon’s opaque container id — matching what the diagnostics
report and the reaping ledger both name this sandbox.
Sourcepub fn get_mapped_port(&self, guest_port: u16) -> Result<u16, RightsizeError>
pub fn get_mapped_port(&self, guest_port: u16) -> Result<u16, RightsizeError>
The host port guest_port is published on.
Distinguishes two failure causes: if this guard isn’t running (stopped, or never
successfully started), the error says so; if it IS running but guest_port was
never declared via with_exposed_ports, the error says the port isn’t exposed.
Sourcepub async fn logs(&self) -> Result<String, RightsizeError>
pub async fn logs(&self) -> Result<String, RightsizeError>
The full logs captured so far. Requires the container to be running.
Sourcepub async fn exec(&self, cmd: &[&str]) -> Result<ExecResult, RightsizeError>
pub async fn exec(&self, cmd: &[&str]) -> Result<ExecResult, RightsizeError>
Runs cmd inside the running container and returns its exit code and captured
output.
Sourcepub async fn checkpoint(&self) -> Result<Checkpoint, RightsizeError>
pub async fn checkpoint(&self) -> Result<Checkpoint, RightsizeError>
Checkpoints this RUNNING container: commits its current filesystem state into
a new image via the active backend’s commit_to_image, and returns a
Checkpoint carrying that image’s ref plus this container’s full spec (see
Checkpoint’s own doc for the “filesystem capture, not memory” semantics
and Container::from_checkpoint for restoring from the result).
Gated on crate::backend::Capabilities::checkpoint BEFORE any backend
call: on a backend that doesn’t support it (microsandbox today), this returns
RightsizeError::CheckpointUnsupported without ever reaching
commit_to_image. Requires this guard to currently be running — a state
error otherwise, same shape as Self::exec/Self::logs.
Sourcepub async fn follow_output(
&self,
consumer: impl Fn(String) + Send + Sync + 'static,
) -> Result<FollowHandle, RightsizeError>
pub async fn follow_output( &self, consumer: impl Fn(String) + Send + Sync + 'static, ) -> Result<FollowHandle, RightsizeError>
Streams log lines to consumer as they’re produced. Closing (or dropping) the
returned crate::backend::FollowHandle halts delivery — no further lines
reach consumer afterward, even if the container keeps running.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
True from a successful start() until stop(); false before the first start()
and after.