use crate::BoxID;
use crate::net::socket_path::BoxSockets;
use crate::runtime::types::ContainerID;
use boxlite_shared::Transport;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ContainerRuntimeConfig {
pub id: ContainerID,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BoxConfig {
pub id: BoxID,
pub name: Option<String>,
pub created_at: DateTime<Utc>,
pub container: ContainerRuntimeConfig,
pub options: crate::runtime::options::BoxOptions,
pub engine_kind: crate::vmm::VmmKind,
pub box_home: PathBuf,
}
impl BoxConfig {
pub fn sockets(&self) -> BoxSockets {
BoxSockets::new(
self.id.as_str(),
self.box_home
.join(crate::runtime::layout::dirs::SOCKETS_DIR),
)
}
pub fn transport(&self) -> Transport {
Transport::unix(self.sockets().box_sock())
}
pub fn ready_transport(&self) -> Transport {
Transport::unix(self.sockets().ready_sock())
}
}