Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Furisto committed Jul 17, 2021
1 parent ef06782 commit b7d0560
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
10 changes: 6 additions & 4 deletions src/container/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ use std::path::PathBuf;

use super::{init_builder::InitContainerBuilder, tenant_builder::TenantContainerBuilder};
pub struct ContainerBuilder {
/// Id of the container
pub(super) container_id: String,

/// Root directory for container state
pub(super) root_path: PathBuf,

/// Interface to operating system primitives
pub(super) syscall: LinuxSyscall,

/// File which will be used to communicate the pid of the
/// container process to the higher level runtime
pub(super) pid_file: Option<PathBuf>,

/// Socket to communicate the file descriptor of the ptty
pub(super) console_socket: Option<PathBuf>,
}

Expand Down
14 changes: 13 additions & 1 deletion src/container/builder_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,30 @@ use crate::{
use super::{Container, ContainerStatus};

pub(super) struct ContainerBuilderImpl {
/// Flag indicating if an init or a tenant container should be created
pub init: bool,
/// Interface to operating system primitives
pub syscall: LinuxSyscall,
/// Flag indicating if systemd should be used for cgroup management
pub use_systemd: bool,
/// Id of the container
pub container_id: String,
pub root_path: PathBuf,
/// Directory where the state of the container will be stored
pub container_dir: PathBuf,
/// OCI complient runtime spec
pub spec: Spec,
/// Root filesystem of the container
pub rootfs: PathBuf,
/// File which will be used to communicate the pid of the
/// container process to the higher level runtime
pub pid_file: Option<PathBuf>,
/// Socket to communicate the file descriptor of the ptty
pub console_socket: Option<FileDescriptor>,
/// Options for rootless containers
pub rootless: Option<Rootless>,
/// Socket to communicate container start
pub notify_socket: NotifyListener,
/// Container state
pub container: Option<Container>,
}

Expand Down
1 change: 0 additions & 1 deletion src/container/init_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ impl InitContainerBuilder {
init: true,
syscall: self.base.syscall,
container_id: self.base.container_id,
root_path: self.base.root_path,
pid_file: self.base.pid_file,
console_socket: csocketfd,
use_systemd: self.use_systemd,
Expand Down
5 changes: 5 additions & 0 deletions src/container/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
//! Container management
/// This crate is responsible for the creation of containers. It provides a builder that can
/// be used to configure and create containers. We distinguish between an init container for which
/// namespaces and cgroups will be created (usually) and a tenant container process that will move
/// into the existing namespaces and cgroups of the initial container process (e.g. used to implement
/// the exec command).

pub mod builder;
mod builder_impl;
Expand Down
1 change: 0 additions & 1 deletion src/container/tenant_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ impl TenantContainerBuilder {
init: false,
syscall: self.base.syscall,
container_id: self.base.container_id,
root_path: self.base.root_path,
pid_file: self.base.pid_file,
console_socket: csocketfd,
use_systemd,
Expand Down

0 comments on commit b7d0560

Please sign in to comment.