Skip to content

Commit 811dfc5

Browse files
committed
Document src/container.rs module
1 parent df5237a commit 811dfc5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/container.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Types for creating and controlling running containers.
2+
13
use std::process::Stdio;
24

35
use anyhow::anyhow;
@@ -11,6 +13,7 @@ use crate::pipe::{CommandExt, StartPipe, SyncPipe};
1113
const CONMON_BIN: &str = "conmon";
1214
const RUNTIME_BIN: &str = "/usr/bin/crun";
1315

16+
/// An actively running OCI container.
1417
#[derive(Debug)]
1518
pub struct Container {
1619
name: String,
@@ -22,6 +25,7 @@ pub struct Container {
2225
}
2326

2427
impl Container {
28+
/// Spawns a new container with the given `id` from the `rt` OCI bundle.
2529
pub async fn create(id: &str, rt: OciBundle) -> anyhow::Result<Self> {
2630
let uuid = Uuid::new_v4();
2731

@@ -85,7 +89,6 @@ impl Container {
8589
// Setup is complete, so connect to the console socket.
8690
let sock_path = rt.base_dir().join(uuid.to_string()).join("attach");
8791
let console_sock = UnixSeqpacket::connect(sock_path).await?;
88-
8992
eprintln!("connected to console socket!");
9093

9194
Ok(Container {
@@ -98,10 +101,12 @@ impl Container {
98101
})
99102
}
100103

104+
/// Returns the name of the container.
101105
pub fn name(&self) -> &str {
102106
&self.name
103107
}
104108

109+
/// Returns the UUIDv4 assigned to the container.
105110
pub fn uuid(&self) -> Uuid {
106111
self.uuid
107112
}

0 commit comments

Comments
 (0)