mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-02 21:00:55 +00:00
chore: move kratart::image to krataoci and cleanup dependencies
This commit is contained in:
parent
655b8029cb
commit
001409378e
23
Cargo.toml
23
Cargo.toml
@ -1,6 +1,7 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"crates/krata",
|
||||
"crates/krataoci",
|
||||
"crates/krataguest",
|
||||
"crates/kratart",
|
||||
"crates/kratad",
|
||||
@ -21,6 +22,7 @@ version = "0.0.1"
|
||||
[workspace.dependencies]
|
||||
anyhow = "1.0"
|
||||
arrayvec = "0.7.4"
|
||||
async-compression = "0.4.6"
|
||||
async-stream = "0.3.5"
|
||||
async-trait = "0.1.77"
|
||||
backhand = "0.14.2"
|
||||
@ -29,10 +31,8 @@ bytes = "1.5.0"
|
||||
cli-tables = "0.2.1"
|
||||
crossterm = "0.27.0"
|
||||
ctrlc = "3.4.4"
|
||||
directories = "5.0.1"
|
||||
elf = "0.7.4"
|
||||
env_logger = "0.11.0"
|
||||
errno = "0.3.0"
|
||||
etherparse = "0.14.2"
|
||||
flate2 = "1.0"
|
||||
futures = "0.3.30"
|
||||
@ -40,7 +40,6 @@ ipnetwork = "0.20.0"
|
||||
libc = "0.2"
|
||||
log = "0.4.20"
|
||||
memchr = "2"
|
||||
netlink-packet-route = "0.19.0"
|
||||
nix = "0.28.0"
|
||||
oci-spec = "0.6.4"
|
||||
once_cell = "1.19.0"
|
||||
@ -53,28 +52,20 @@ rand = "0.8.5"
|
||||
redb = "1.5.0"
|
||||
rtnetlink = "0.14.1"
|
||||
serde_json = "1.0.113"
|
||||
sha256 = "1.5.0"
|
||||
serde_yaml = "0.9"
|
||||
sha256 = "1.5.0"
|
||||
signal-hook = "0.3.17"
|
||||
slice-copy = "0.3.0"
|
||||
smoltcp = "0.11.0"
|
||||
termion = "3.0.0"
|
||||
thiserror = "1.0"
|
||||
tokio-listener = "0.3.1"
|
||||
tokio-native-tls = "0.3.1"
|
||||
tokio-tar = { git = "https://github.com/edera-dev/tokio-tar.git", branch = "edera" }
|
||||
tokio-tun = "0.11.2"
|
||||
tonic-build = "0.11.0"
|
||||
tower = "0.4.13"
|
||||
trait-variant = "0.1.1"
|
||||
udp-stream = "0.0.11"
|
||||
url = "2.5.0"
|
||||
walkdir = "2"
|
||||
xz2 = "0.1"
|
||||
zstd = "0.13.0"
|
||||
|
||||
[workspace.dependencies.async-compression]
|
||||
version = "0.4.6"
|
||||
|
||||
[workspace.dependencies.clap]
|
||||
version = "4.4.18"
|
||||
@ -89,14 +80,14 @@ version = "0.12.0"
|
||||
default-features = false
|
||||
features = ["rustls-tls"]
|
||||
|
||||
[workspace.dependencies.sys-mount]
|
||||
version = "3.0.0"
|
||||
default-features = false
|
||||
|
||||
[workspace.dependencies.serde]
|
||||
version = "1.0.196"
|
||||
features = ["derive"]
|
||||
|
||||
[workspace.dependencies.sys-mount]
|
||||
version = "3.0.0"
|
||||
default-features = false
|
||||
|
||||
[workspace.dependencies.tokio]
|
||||
version = "1.35.1"
|
||||
features = ["macros", "rt", "rt-multi-thread", "io-util"]
|
||||
|
@ -7,12 +7,10 @@ resolver = "2"
|
||||
[dependencies]
|
||||
anyhow = { workspace = true }
|
||||
libc = { workspace = true }
|
||||
log = { workspace = true }
|
||||
once_cell = { workspace = true }
|
||||
prost = { workspace = true }
|
||||
prost-reflect = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tonic = { workspace = true }
|
||||
url = { workspace = true }
|
||||
|
||||
|
@ -15,15 +15,12 @@ env_logger = { workspace = true }
|
||||
krata = { path = "../krata" }
|
||||
log = { workspace = true }
|
||||
prost-reflect = { workspace = true, features = ["serde"] }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
serde_yaml = { workspace = true }
|
||||
signal-hook = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tokio-stream = { workspace = true }
|
||||
tonic = { workspace = true }
|
||||
tower = { workspace = true }
|
||||
url = { workspace = true }
|
||||
|
||||
[lib]
|
||||
name = "kratactl"
|
||||
|
@ -16,8 +16,6 @@ kratart = { path = "../kratart" }
|
||||
log = { workspace = true }
|
||||
prost = { workspace = true }
|
||||
redb = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_yaml = { workspace = true }
|
||||
signal-hook = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tokio-stream = { workspace = true }
|
||||
|
@ -20,7 +20,6 @@ serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
sys-mount = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tokio-stream = { workspace = true }
|
||||
walkdir = { workspace = true }
|
||||
xenstore = { path = "../xen/xenstore" }
|
||||
|
||||
|
@ -15,7 +15,6 @@ etherparse = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
libc = { workspace = true }
|
||||
log = { workspace = true }
|
||||
netlink-packet-route = { workspace = true }
|
||||
rtnetlink = { workspace = true }
|
||||
smoltcp = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
|
35
crates/krataoci/Cargo.toml
Normal file
35
crates/krataoci/Cargo.toml
Normal file
@ -0,0 +1,35 @@
|
||||
[package]
|
||||
name = "krataoci"
|
||||
version.workspace = true
|
||||
edition = "2021"
|
||||
resolver = "2"
|
||||
|
||||
[dependencies]
|
||||
anyhow = { workspace = true }
|
||||
async-compression = { workspace = true, features = ["tokio", "gzip", "zstd"] }
|
||||
async-trait = { workspace = true }
|
||||
backhand = { workspace = true }
|
||||
bytes = { workspace = true }
|
||||
log = { workspace = true }
|
||||
oci-spec = { workspace = true }
|
||||
path-clean = { workspace = true }
|
||||
reqwest = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
sha256 = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tokio-stream = { workspace = true }
|
||||
tokio-tar = { workspace = true }
|
||||
url = { workspace = true }
|
||||
uuid = { workspace = true }
|
||||
walkdir = { workspace = true }
|
||||
|
||||
[lib]
|
||||
name = "krataoci"
|
||||
|
||||
[dev-dependencies]
|
||||
env_logger = { workspace = true }
|
||||
|
||||
[[example]]
|
||||
name = "krataoci-squashify"
|
||||
path = "examples/squashify.rs"
|
29
crates/krataoci/examples/squashify.rs
Normal file
29
crates/krataoci/examples/squashify.rs
Normal file
@ -0,0 +1,29 @@
|
||||
use std::{env::args, path::PathBuf};
|
||||
|
||||
use anyhow::Result;
|
||||
use env_logger::Env;
|
||||
use krataoci::{cache::ImageCache, compiler::ImageCompiler, name::ImageName};
|
||||
use tokio::fs;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();
|
||||
|
||||
let image = ImageName::parse(&args().nth(1).unwrap())?;
|
||||
let seed = args().nth(2).map(PathBuf::from);
|
||||
|
||||
let cache_dir = PathBuf::from("krata-cache");
|
||||
if !cache_dir.exists() {
|
||||
fs::create_dir(&cache_dir).await?;
|
||||
}
|
||||
|
||||
let cache = ImageCache::new(&cache_dir)?;
|
||||
let compiler = ImageCompiler::new(&cache, seed)?;
|
||||
let info = compiler.compile(&image).await?;
|
||||
println!(
|
||||
"generated squashfs of {} to {}",
|
||||
image,
|
||||
info.image_squashfs.to_string_lossy()
|
||||
);
|
||||
Ok(())
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
use crate::image::cache::ImageCache;
|
||||
use crate::image::name::ImageName;
|
||||
use crate::image::registry::OciRegistryPlatform;
|
||||
use crate::cache::ImageCache;
|
||||
use crate::fetch::{OciImageDownloader, OciImageLayer};
|
||||
use crate::name::ImageName;
|
||||
use crate::registry::OciRegistryPlatform;
|
||||
use anyhow::{anyhow, Result};
|
||||
use backhand::compression::Compressor;
|
||||
use backhand::{FilesystemCompressor, FilesystemWriter, NodeHeader};
|
||||
@ -18,8 +19,6 @@ use tokio_tar::{Archive, Entry};
|
||||
use uuid::Uuid;
|
||||
use walkdir::WalkDir;
|
||||
|
||||
use crate::image::fetch::{OciImageDownloader, OciImageLayer};
|
||||
|
||||
pub const IMAGE_SQUASHFS_VERSION: u64 = 2;
|
||||
|
||||
pub struct ImageInfo {
|
@ -1,3 +1,8 @@
|
||||
use super::{
|
||||
name::ImageName,
|
||||
registry::{OciRegistryClient, OciRegistryPlatform},
|
||||
};
|
||||
|
||||
use std::{
|
||||
path::{Path, PathBuf},
|
||||
pin::Pin,
|
||||
@ -17,11 +22,6 @@ use tokio::{
|
||||
use tokio_stream::StreamExt;
|
||||
use tokio_tar::Archive;
|
||||
|
||||
use super::{
|
||||
name::ImageName,
|
||||
registry::{OciRegistryClient, OciRegistryPlatform},
|
||||
};
|
||||
|
||||
pub struct OciImageDownloader {
|
||||
seed: Option<PathBuf>,
|
||||
storage: PathBuf,
|
@ -7,29 +7,15 @@ resolver = "2"
|
||||
[dependencies]
|
||||
advmac = { path = "../vendor/advmac" }
|
||||
anyhow = { workspace = true }
|
||||
async-compression = { workspace = true, features = ["tokio", "gzip", "zstd"] }
|
||||
async-stream = { workspace = true }
|
||||
async-trait = { workspace = true }
|
||||
backhand = { workspace = true }
|
||||
bytes = { workspace = true }
|
||||
ipnetwork = { workspace = true }
|
||||
krata = { path = "../krata" }
|
||||
krataoci = { path = "../krataoci" }
|
||||
log = { workspace = true }
|
||||
loopdev = { path = "../vendor/loopdev" }
|
||||
nix = { workspace = true, features = ["process"] }
|
||||
oci-spec = { workspace = true }
|
||||
path-clean = { workspace = true }
|
||||
reqwest = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
sha256 = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tokio-stream = { workspace = true }
|
||||
tokio-tar = { workspace = true }
|
||||
tonic = { workspace = true, features = ["tls"] }
|
||||
url = { workspace = true }
|
||||
uuid = { workspace = true }
|
||||
walkdir = { workspace = true }
|
||||
xenclient = { path = "../xen/xenclient" }
|
||||
xenstore = { path = "../xen/xenstore" }
|
||||
|
||||
|
@ -2,7 +2,7 @@ use std::{env::args, path::PathBuf};
|
||||
|
||||
use anyhow::Result;
|
||||
use env_logger::Env;
|
||||
use kratart::image::{cache::ImageCache, compiler::ImageCompiler, name::ImageName};
|
||||
use krataoci::{cache::ImageCache, compiler::ImageCompiler, name::ImageName};
|
||||
use tokio::fs;
|
||||
|
||||
#[tokio::main]
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::image::compiler::ImageInfo;
|
||||
use anyhow::Result;
|
||||
use backhand::{FilesystemWriter, NodeHeader};
|
||||
use krata::launchcfg::LaunchInfo;
|
||||
use krataoci::compiler::ImageInfo;
|
||||
use log::trace;
|
||||
use std::fs;
|
||||
use std::fs::File;
|
||||
|
@ -13,12 +13,12 @@ use xenclient::{DomainConfig, DomainDisk, DomainNetworkInterface};
|
||||
use xenstore::XsdInterface;
|
||||
|
||||
use crate::cfgblk::ConfigBlock;
|
||||
use crate::image::{
|
||||
use crate::RuntimeContext;
|
||||
use krataoci::{
|
||||
cache::ImageCache,
|
||||
compiler::{ImageCompiler, ImageInfo},
|
||||
name::ImageName,
|
||||
};
|
||||
use crate::RuntimeContext;
|
||||
|
||||
use super::{GuestInfo, GuestState};
|
||||
|
||||
|
@ -20,14 +20,13 @@ use xenstore::{XsdClient, XsdInterface, XsdWatchHandle};
|
||||
use self::{
|
||||
autoloop::AutoLoop,
|
||||
console::XenConsole,
|
||||
image::cache::ImageCache,
|
||||
launch::{GuestLaunchRequest, GuestLauncher},
|
||||
};
|
||||
use krataoci::cache::ImageCache;
|
||||
|
||||
pub mod autoloop;
|
||||
pub mod cfgblk;
|
||||
pub mod console;
|
||||
pub mod image;
|
||||
pub mod launch;
|
||||
|
||||
pub struct ContainerLoopInfo {
|
||||
|
Loading…
Reference in New Issue
Block a user