protocols: Bump ttrpc from 0.6.0 to 0.7.1

Fixes: #6646

Signed-off-by: Tim Zhang <tim@hyper.sh>
This commit is contained in:
Tim Zhang 2023-04-12 16:45:21 +08:00
parent 243cb2e3af
commit 392732e213
6 changed files with 210 additions and 204 deletions

85
src/libs/Cargo.lock generated
View File

@ -703,9 +703,9 @@ dependencies = [
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.9.0" version = "1.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
@ -845,9 +845,16 @@ name = "protobuf"
version = "2.27.1" version = "2.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf7e6d18738ecd0902d30d1ad232c9125985a3422929b16c65517b38adc14f96" checksum = "cf7e6d18738ecd0902d30d1ad232c9125985a3422929b16c65517b38adc14f96"
[[package]]
name = "protobuf"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b55bad9126f378a853655831eb7363b7b01b81d19f8cb1218861086ca4a1a61e"
dependencies = [ dependencies = [
"serde", "once_cell",
"serde_derive", "protobuf-support",
"thiserror",
] ]
[[package]] [[package]]
@ -856,17 +863,47 @@ version = "2.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aec1632b7c8f2e620343439a7dfd1f3c47b18906c4be58982079911482b5d707" checksum = "aec1632b7c8f2e620343439a7dfd1f3c47b18906c4be58982079911482b5d707"
dependencies = [ dependencies = [
"protobuf", "protobuf 2.27.1",
] ]
[[package]] [[package]]
name = "protobuf-codegen-pure" name = "protobuf-codegen"
version = "2.27.1" version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f8122fdb18e55190c796b088a16bdb70cd7acdcd48f7a8b796b58c62e532cc6" checksum = "0dd418ac3c91caa4032d37cb80ff0d44e2ebe637b2fb243b6234bf89cdac4901"
dependencies = [ dependencies = [
"protobuf", "anyhow",
"protobuf-codegen", "once_cell",
"protobuf 3.2.0",
"protobuf-parse",
"regex",
"tempfile",
"thiserror",
]
[[package]]
name = "protobuf-parse"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d39b14605eaa1f6a340aec7f320b34064feb26c93aec35d6a9a2272a8ddfa49"
dependencies = [
"anyhow",
"indexmap",
"log",
"protobuf 3.2.0",
"protobuf-support",
"tempfile",
"thiserror",
"which",
]
[[package]]
name = "protobuf-support"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5d4d7b8601c814cfb36bcebb79f0e61e45e1e93640cf778837833bbed05c372"
dependencies = [
"thiserror",
] ]
[[package]] [[package]]
@ -875,7 +912,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"oci", "oci",
"protobuf", "protobuf 3.2.0",
"serde", "serde",
"serde_json", "serde_json",
"ttrpc", "ttrpc",
@ -1314,9 +1351,9 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
[[package]] [[package]]
name = "ttrpc" name = "ttrpc"
version = "0.6.1" version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ecfff459a859c6ba6668ff72b34c2f1d94d9d58f7088414c2674ad0f31cc7d8" checksum = "a35f22a2964bea14afee161665bb260b83cb48e665e0260ca06ec0e775c8b06c"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"byteorder", "byteorder",
@ -1324,8 +1361,8 @@ dependencies = [
"libc", "libc",
"log", "log",
"nix 0.23.1", "nix 0.23.1",
"protobuf", "protobuf 3.2.0",
"protobuf-codegen-pure", "protobuf-codegen 3.2.0",
"thiserror", "thiserror",
"tokio", "tokio",
"tokio-vsock", "tokio-vsock",
@ -1333,28 +1370,28 @@ dependencies = [
[[package]] [[package]]
name = "ttrpc-codegen" name = "ttrpc-codegen"
version = "0.2.0" version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "809eda4e459820237104e4b61d6b41bbe6c9e1ce6adf4057955e6e6722a90408" checksum = "94d7f7631d7a9ebed715a47cd4cb6072cbc7ae1d4ec01598971bbec0024340c2"
dependencies = [ dependencies = [
"protobuf", "protobuf 2.27.1",
"protobuf-codegen", "protobuf-codegen 3.2.0",
"protobuf-codegen-pure", "protobuf-support",
"ttrpc-compiler", "ttrpc-compiler",
] ]
[[package]] [[package]]
name = "ttrpc-compiler" name = "ttrpc-compiler"
version = "0.4.1" version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2978ed3fa047d8fd55cbeb4d4a61d461fb3021a90c9618519c73ce7e5bb66c15" checksum = "ec3cb5dbf1f0865a34fe3f722290fe776cacb16f50428610b779467b76ddf647"
dependencies = [ dependencies = [
"derive-new", "derive-new",
"prost", "prost",
"prost-build", "prost-build",
"prost-types", "prost-types",
"protobuf", "protobuf 2.27.1",
"protobuf-codegen", "protobuf-codegen 2.27.1",
"tempfile", "tempfile",
] ]

View File

@ -1,11 +1,5 @@
Cargo.lock Cargo.lock
src/agent.rs
src/agent_ttrpc.rs src/*.rs
src/agent_ttrpc_async.rs !src/lib.rs
src/csi.rs !src/trans.rs
src/empty.rs
src/health.rs
src/health_ttrpc.rs
src/health_ttrpc_async.rs
src/oci.rs
src/types.rs

View File

@ -11,12 +11,13 @@ with-serde = [ "serde", "serde_json" ]
async = ["ttrpc/async", "async-trait"] async = ["ttrpc/async", "async-trait"]
[dependencies] [dependencies]
ttrpc = { version = "0.6.0" } ttrpc = { version = "0.7.1" }
async-trait = { version = "0.1.42", optional = true } async-trait = { version = "0.1.42", optional = true }
protobuf = { version = "2.27.0", features = ["with-serde"] } protobuf = { version = "3.2.0" }
serde = { version = "1.0.130", features = ["derive"], optional = true } serde = { version = "1.0.130", features = ["derive"], optional = true }
serde_json = { version = "1.0.68", optional = true } serde_json = { version = "1.0.68", optional = true }
oci = { path = "../oci" } oci = { path = "../oci" }
[build-dependencies] [build-dependencies]
ttrpc-codegen = "0.2.0" ttrpc-codegen = "0.4.2"
protobuf = { version = "3.2.0" }

View File

@ -7,6 +7,7 @@ use std::fs::{self, File};
use std::io::{BufRead, BufReader, Read, Write}; use std::io::{BufRead, BufReader, Read, Write};
use std::path::Path; use std::path::Path;
use std::process::exit; use std::process::exit;
use ttrpc_codegen::{Codegen, Customize, ProtobufCustomize}; use ttrpc_codegen::{Codegen, Customize, ProtobufCustomize};
fn replace_text_in_file(file_name: &str, from: &str, to: &str) -> Result<(), std::io::Error> { fn replace_text_in_file(file_name: &str, from: &str, to: &str) -> Result<(), std::io::Error> {
@ -103,10 +104,10 @@ fn codegen(path: &str, protos: &[&str], async_all: bool) -> Result<(), std::io::
..Default::default() ..Default::default()
}; };
let protobuf_options = ProtobufCustomize { let protobuf_options = ProtobufCustomize::default()
serde_derive: Some(true), .gen_mod_rs(false)
..Default::default() .generate_getter(true)
}; .generate_accessors(true);
let out_dir = Path::new("src"); let out_dir = Path::new("src");
@ -147,6 +148,7 @@ fn real_main() -> Result<(), std::io::Error> {
"src", "src",
&[ &[
"protos/google/protobuf/empty.proto", "protos/google/protobuf/empty.proto",
"protos/gogo/protobuf/gogoproto/gogo.proto",
"protos/oci.proto", "protos/oci.proto",
"protos/types.proto", "protos/types.proto",
"protos/csi.proto", "protos/csi.proto",

View File

@ -11,6 +11,7 @@ pub mod agent_ttrpc;
pub mod agent_ttrpc_async; pub mod agent_ttrpc_async;
pub mod csi; pub mod csi;
pub mod empty; pub mod empty;
mod gogo;
pub mod health; pub mod health;
pub mod health_ttrpc; pub mod health_ttrpc;
#[cfg(feature = "async")] #[cfg(feature = "async")]

View File

@ -15,19 +15,19 @@ use oci::{
}; };
// translate from interface to ttprc tools // translate from interface to ttprc tools
fn from_option<F: Sized, T: From<F>>(from: Option<F>) -> ::protobuf::SingularPtrField<T> { fn from_option<F: Sized, T: From<F>>(from: Option<F>) -> protobuf::MessageField<T> {
match from { match from {
Some(f) => ::protobuf::SingularPtrField::from_option(Some(T::from(f))), Some(f) => protobuf::MessageField::from_option(Some(f.into())),
None => ::protobuf::SingularPtrField::none(), None => protobuf::MessageField::none(),
} }
} }
fn from_vec<F: Sized, T: From<F>>(from: Vec<F>) -> ::protobuf::RepeatedField<T> { fn from_vec<F: Sized, T: From<F>>(from: Vec<F>) -> Vec<T> {
let mut to: Vec<T> = vec![]; let mut to: Vec<T> = vec![];
for data in from { for data in from {
to.push(T::from(data)); to.push(data.into());
} }
::protobuf::RepeatedField::from_vec(to) to
} }
impl From<oci::Box> for crate::oci::Box { impl From<oci::Box> for crate::oci::Box {
@ -35,8 +35,7 @@ impl From<oci::Box> for crate::oci::Box {
crate::oci::Box { crate::oci::Box {
Height: from.height, Height: from.height,
Width: from.width, Width: from.width,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -48,8 +47,7 @@ impl From<oci::User> for crate::oci::User {
GID: from.gid, GID: from.gid,
AdditionalGids: from.additional_gids, AdditionalGids: from.additional_gids,
Username: from.username, Username: from.username,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -57,13 +55,12 @@ impl From<oci::User> for crate::oci::User {
impl From<oci::LinuxCapabilities> for crate::oci::LinuxCapabilities { impl From<oci::LinuxCapabilities> for crate::oci::LinuxCapabilities {
fn from(from: LinuxCapabilities) -> Self { fn from(from: LinuxCapabilities) -> Self {
crate::oci::LinuxCapabilities { crate::oci::LinuxCapabilities {
Bounding: from_vec(from.bounding), Bounding: from.bounding,
Effective: from_vec(from.effective), Effective: from.effective,
Inheritable: from_vec(from.inheritable), Inheritable: from.inheritable,
Permitted: from_vec(from.permitted), Permitted: from.permitted,
Ambient: from_vec(from.ambient), Ambient: from.ambient,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -74,8 +71,7 @@ impl From<oci::PosixRlimit> for crate::oci::POSIXRlimit {
Type: from.r#type, Type: from.r#type,
Hard: from.hard, Hard: from.hard,
Soft: from.soft, Soft: from.soft,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -86,8 +82,8 @@ impl From<oci::Process> for crate::oci::Process {
Terminal: from.terminal, Terminal: from.terminal,
ConsoleSize: from_option(from.console_size), ConsoleSize: from_option(from.console_size),
User: from_option(Some(from.user)), User: from_option(Some(from.user)),
Args: from_vec(from.args), Args: from.args,
Env: from_vec(from.env), Env: from.env,
Cwd: from.cwd, Cwd: from.cwd,
Capabilities: from_option(from.capabilities), Capabilities: from_option(from.capabilities),
Rlimits: from_vec(from.rlimits), Rlimits: from_vec(from.rlimits),
@ -95,8 +91,7 @@ impl From<oci::Process> for crate::oci::Process {
ApparmorProfile: from.apparmor_profile, ApparmorProfile: from.apparmor_profile,
OOMScoreAdj: from.oom_score_adj.map_or(0, |t| t as i64), OOMScoreAdj: from.oom_score_adj.map_or(0, |t| t as i64),
SelinuxLabel: from.selinux_label, SelinuxLabel: from.selinux_label,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -109,8 +104,7 @@ impl From<oci::LinuxDeviceCgroup> for crate::oci::LinuxDeviceCgroup {
Major: from.major.map_or(0, |t| t), Major: from.major.map_or(0, |t| t),
Minor: from.minor.map_or(0, |t| t), Minor: from.minor.map_or(0, |t| t),
Access: from.access, Access: from.access,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -125,8 +119,7 @@ impl From<oci::LinuxMemory> for crate::oci::LinuxMemory {
KernelTCP: from.kernel_tcp.map_or(0, |t| t), KernelTCP: from.kernel_tcp.map_or(0, |t| t),
Swappiness: from.swappiness.map_or(0, |t| t), Swappiness: from.swappiness.map_or(0, |t| t),
DisableOOMKiller: from.disable_oom_killer.map_or(false, |t| t), DisableOOMKiller: from.disable_oom_killer.map_or(false, |t| t),
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -141,8 +134,7 @@ impl From<oci::LinuxCpu> for crate::oci::LinuxCPU {
RealtimePeriod: from.realtime_period.map_or(0, |t| t), RealtimePeriod: from.realtime_period.map_or(0, |t| t),
Cpus: from.cpus, Cpus: from.cpus,
Mems: from.mems, Mems: from.mems,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -151,8 +143,7 @@ impl From<oci::LinuxPids> for crate::oci::LinuxPids {
fn from(from: LinuxPids) -> Self { fn from(from: LinuxPids) -> Self {
crate::oci::LinuxPids { crate::oci::LinuxPids {
Limit: from.limit, Limit: from.limit,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -165,8 +156,7 @@ impl From<oci::LinuxWeightDevice> for crate::oci::LinuxWeightDevice {
Minor: 0, Minor: 0,
Weight: from.weight.map_or(0, |t| t as u32), Weight: from.weight.map_or(0, |t| t as u32),
LeafWeight: from.leaf_weight.map_or(0, |t| t as u32), LeafWeight: from.leaf_weight.map_or(0, |t| t as u32),
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -178,8 +168,7 @@ impl From<oci::LinuxThrottleDevice> for crate::oci::LinuxThrottleDevice {
Major: 0, Major: 0,
Minor: 0, Minor: 0,
Rate: from.rate, Rate: from.rate,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -194,8 +183,7 @@ impl From<oci::LinuxBlockIo> for crate::oci::LinuxBlockIO {
ThrottleWriteBpsDevice: from_vec(from.throttle_write_bps_device), ThrottleWriteBpsDevice: from_vec(from.throttle_write_bps_device),
ThrottleReadIOPSDevice: from_vec(from.throttle_read_iops_device), ThrottleReadIOPSDevice: from_vec(from.throttle_read_iops_device),
ThrottleWriteIOPSDevice: from_vec(from.throttle_write_iops_device), ThrottleWriteIOPSDevice: from_vec(from.throttle_write_iops_device),
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -205,8 +193,7 @@ impl From<oci::LinuxHugepageLimit> for crate::oci::LinuxHugepageLimit {
crate::oci::LinuxHugepageLimit { crate::oci::LinuxHugepageLimit {
Pagesize: from.page_size, Pagesize: from.page_size,
Limit: from.limit, Limit: from.limit,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -216,8 +203,7 @@ impl From<oci::LinuxInterfacePriority> for crate::oci::LinuxInterfacePriority {
crate::oci::LinuxInterfacePriority { crate::oci::LinuxInterfacePriority {
Name: from.name, Name: from.name,
Priority: from.priority, Priority: from.priority,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -227,8 +213,7 @@ impl From<oci::LinuxNetwork> for crate::oci::LinuxNetwork {
crate::oci::LinuxNetwork { crate::oci::LinuxNetwork {
ClassID: from.class_id.map_or(0, |t| t), ClassID: from.class_id.map_or(0, |t| t),
Priorities: from_vec(from.priorities), Priorities: from_vec(from.priorities),
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -243,8 +228,7 @@ impl From<oci::LinuxResources> for crate::oci::LinuxResources {
BlockIO: from_option(from.block_io), BlockIO: from_option(from.block_io),
HugepageLimits: from_vec(from.hugepage_limits), HugepageLimits: from_vec(from.hugepage_limits),
Network: from_option(from.network), Network: from_option(from.network),
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -254,8 +238,7 @@ impl From<oci::Root> for crate::oci::Root {
crate::oci::Root { crate::oci::Root {
Path: from.path, Path: from.path,
Readonly: from.readonly, Readonly: from.readonly,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -265,10 +248,9 @@ impl From<oci::Mount> for crate::oci::Mount {
crate::oci::Mount { crate::oci::Mount {
destination: from.destination, destination: from.destination,
source: from.source, source: from.source,
field_type: from.r#type, type_: from.r#type,
options: from_vec(from.options), options: from.options,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -281,11 +263,10 @@ impl From<oci::Hook> for crate::oci::Hook {
} }
crate::oci::Hook { crate::oci::Hook {
Path: from.path, Path: from.path,
Args: from_vec(from.args), Args: from.args,
Env: from_vec(from.env), Env: from.env,
Timeout: timeout, Timeout: timeout,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -299,8 +280,7 @@ impl From<oci::Hooks> for crate::oci::Hooks {
StartContainer: from_vec(from.start_container), StartContainer: from_vec(from.start_container),
Poststart: from_vec(from.poststart), Poststart: from_vec(from.poststart),
Poststop: from_vec(from.poststop), Poststop: from_vec(from.poststop),
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -311,8 +291,7 @@ impl From<oci::LinuxIdMapping> for crate::oci::LinuxIDMapping {
HostID: from.host_id, HostID: from.host_id,
ContainerID: from.container_id, ContainerID: from.container_id,
Size: from.size, Size: from.size,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -322,8 +301,7 @@ impl From<oci::LinuxNamespace> for crate::oci::LinuxNamespace {
crate::oci::LinuxNamespace { crate::oci::LinuxNamespace {
Type: from.r#type, Type: from.r#type,
Path: from.path, Path: from.path,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -338,8 +316,7 @@ impl From<oci::LinuxDevice> for crate::oci::LinuxDevice {
FileMode: from.file_mode.map_or(0, |v| v), FileMode: from.file_mode.map_or(0, |v| v),
UID: from.uid.map_or(0, |v| v), UID: from.uid.map_or(0, |v| v),
GID: from.gid.map_or(0, |v| v), GID: from.gid.map_or(0, |v| v),
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -351,8 +328,7 @@ impl From<oci::LinuxSeccompArg> for crate::oci::LinuxSeccompArg {
Value: from.value, Value: from.value,
ValueTwo: from.value_two, ValueTwo: from.value_two,
Op: from.op, Op: from.op,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -360,14 +336,13 @@ impl From<oci::LinuxSeccompArg> for crate::oci::LinuxSeccompArg {
impl From<oci::LinuxSyscall> for crate::oci::LinuxSyscall { impl From<oci::LinuxSyscall> for crate::oci::LinuxSyscall {
fn from(from: LinuxSyscall) -> Self { fn from(from: LinuxSyscall) -> Self {
crate::oci::LinuxSyscall { crate::oci::LinuxSyscall {
Names: from_vec(from.names), Names: from.names,
Action: from.action, Action: from.action,
Args: from_vec(from.args), Args: from_vec(from.args),
ErrnoRet: Some(crate::oci::LinuxSyscall_oneof_ErrnoRet::errnoret( ErrnoRet: Some(crate::oci::linux_syscall::ErrnoRet::Errnoret(
from.errno_ret, from.errno_ret,
)), )),
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -376,11 +351,10 @@ impl From<oci::LinuxSeccomp> for crate::oci::LinuxSeccomp {
fn from(from: LinuxSeccomp) -> Self { fn from(from: LinuxSeccomp) -> Self {
crate::oci::LinuxSeccomp { crate::oci::LinuxSeccomp {
DefaultAction: from.default_action, DefaultAction: from.default_action,
Architectures: from_vec(from.architectures), Architectures: from.architectures,
Syscalls: from_vec(from.syscalls), Syscalls: from_vec(from.syscalls),
Flags: from_vec(from.flags), Flags: from.flags,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -389,8 +363,7 @@ impl From<oci::LinuxIntelRdt> for crate::oci::LinuxIntelRdt {
fn from(from: LinuxIntelRdt) -> Self { fn from(from: LinuxIntelRdt) -> Self {
crate::oci::LinuxIntelRdt { crate::oci::LinuxIntelRdt {
L3CacheSchema: from.l3_cache_schema, L3CacheSchema: from.l3_cache_schema,
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -407,12 +380,11 @@ impl From<oci::Linux> for crate::oci::Linux {
Devices: from_vec(from.devices), Devices: from_vec(from.devices),
Seccomp: from_option(from.seccomp), Seccomp: from_option(from.seccomp),
RootfsPropagation: from.rootfs_propagation, RootfsPropagation: from.rootfs_propagation,
MaskedPaths: from_vec(from.masked_paths), MaskedPaths: from.masked_paths,
ReadonlyPaths: from_vec(from.readonly_paths), ReadonlyPaths: from.readonly_paths,
MountLabel: from.mount_label, MountLabel: from.mount_label,
IntelRdt: from_option(from.intel_rdt), IntelRdt: from_option(from.intel_rdt),
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -430,8 +402,7 @@ impl From<oci::Spec> for crate::oci::Spec {
Linux: from_option(from.linux), Linux: from_option(from.linux),
Solaris: Default::default(), Solaris: Default::default(),
Windows: Default::default(), Windows: Default::default(),
unknown_fields: Default::default(), ..Default::default()
cached_size: Default::default(),
} }
} }
} }
@ -449,7 +420,7 @@ impl From<crate::oci::Mount> for oci::Mount {
fn from(mut from: crate::oci::Mount) -> Self { fn from(mut from: crate::oci::Mount) -> Self {
let options = from.take_options().to_vec(); let options = from.take_options().to_vec();
Self { Self {
r#type: from.take_field_type(), r#type: from.take_type_(),
destination: from.take_destination(), destination: from.take_destination(),
source: from.take_source(), source: from.take_source(),
options, options,
@ -460,9 +431,9 @@ impl From<crate::oci::Mount> for oci::Mount {
impl From<crate::oci::LinuxIDMapping> for oci::LinuxIdMapping { impl From<crate::oci::LinuxIDMapping> for oci::LinuxIdMapping {
fn from(from: crate::oci::LinuxIDMapping) -> Self { fn from(from: crate::oci::LinuxIDMapping) -> Self {
LinuxIdMapping { LinuxIdMapping {
container_id: from.get_ContainerID(), container_id: from.ContainerID(),
host_id: from.get_HostID(), host_id: from.HostID(),
size: from.get_Size(), size: from.Size(),
} }
} }
} }
@ -470,17 +441,17 @@ impl From<crate::oci::LinuxIDMapping> for oci::LinuxIdMapping {
impl From<crate::oci::LinuxDeviceCgroup> for oci::LinuxDeviceCgroup { impl From<crate::oci::LinuxDeviceCgroup> for oci::LinuxDeviceCgroup {
fn from(mut from: crate::oci::LinuxDeviceCgroup) -> Self { fn from(mut from: crate::oci::LinuxDeviceCgroup) -> Self {
let mut major = None; let mut major = None;
if from.get_Major() > 0 { if from.Major() > 0 {
major = Some(from.get_Major()); major = Some(from.Major());
} }
let mut minor = None; let mut minor = None;
if from.get_Minor() > 0 { if from.Minor() > 0 {
minor = Some(from.get_Minor()) minor = Some(from.Minor())
} }
oci::LinuxDeviceCgroup { oci::LinuxDeviceCgroup {
allow: from.get_Allow(), allow: from.Allow(),
r#type: from.take_Type(), r#type: from.take_Type(),
major, major,
minor, minor,
@ -492,36 +463,36 @@ impl From<crate::oci::LinuxDeviceCgroup> for oci::LinuxDeviceCgroup {
impl From<crate::oci::LinuxMemory> for oci::LinuxMemory { impl From<crate::oci::LinuxMemory> for oci::LinuxMemory {
fn from(from: crate::oci::LinuxMemory) -> Self { fn from(from: crate::oci::LinuxMemory) -> Self {
let mut limit = None; let mut limit = None;
if from.get_Limit() > 0 { if from.Limit() > 0 {
limit = Some(from.get_Limit()); limit = Some(from.Limit());
} }
let mut reservation = None; let mut reservation = None;
if from.get_Reservation() > 0 { if from.Reservation() > 0 {
reservation = Some(from.get_Reservation()); reservation = Some(from.Reservation());
} }
let mut swap = None; let mut swap = None;
if from.get_Swap() > 0 { if from.Swap() > 0 {
swap = Some(from.get_Swap()); swap = Some(from.Swap());
} }
let mut kernel = None; let mut kernel = None;
if from.get_Kernel() > 0 { if from.Kernel() > 0 {
kernel = Some(from.get_Kernel()); kernel = Some(from.Kernel());
} }
let mut kernel_tcp = None; let mut kernel_tcp = None;
if from.get_KernelTCP() > 0 { if from.KernelTCP() > 0 {
kernel_tcp = Some(from.get_KernelTCP()); kernel_tcp = Some(from.KernelTCP());
} }
let mut swappiness = None; let mut swappiness = None;
if from.get_Swappiness() > 0 { if from.Swappiness() > 0 {
swappiness = Some(from.get_Swappiness()); swappiness = Some(from.Swappiness());
} }
let disable_oom_killer = Some(from.get_DisableOOMKiller()); let disable_oom_killer = Some(from.DisableOOMKiller());
oci::LinuxMemory { oci::LinuxMemory {
limit, limit,
@ -538,28 +509,28 @@ impl From<crate::oci::LinuxMemory> for oci::LinuxMemory {
impl From<crate::oci::LinuxCPU> for oci::LinuxCpu { impl From<crate::oci::LinuxCPU> for oci::LinuxCpu {
fn from(mut from: crate::oci::LinuxCPU) -> Self { fn from(mut from: crate::oci::LinuxCPU) -> Self {
let mut shares = None; let mut shares = None;
if from.get_Shares() > 0 { if from.Shares() > 0 {
shares = Some(from.get_Shares()); shares = Some(from.Shares());
} }
let mut quota = None; let mut quota = None;
if from.get_Quota() > 0 { if from.Quota() > 0 {
quota = Some(from.get_Quota()); quota = Some(from.Quota());
} }
let mut period = None; let mut period = None;
if from.get_Period() > 0 { if from.Period() > 0 {
period = Some(from.get_Period()); period = Some(from.Period());
} }
let mut realtime_runtime = None; let mut realtime_runtime = None;
if from.get_RealtimeRuntime() > 0 { if from.RealtimeRuntime() > 0 {
realtime_runtime = Some(from.get_RealtimeRuntime()); realtime_runtime = Some(from.RealtimeRuntime());
} }
let mut realtime_period = None; let mut realtime_period = None;
if from.get_RealtimePeriod() > 0 { if from.RealtimePeriod() > 0 {
realtime_period = Some(from.get_RealtimePeriod()); realtime_period = Some(from.RealtimePeriod());
} }
let cpus = from.take_Cpus(); let cpus = from.take_Cpus();
@ -580,7 +551,7 @@ impl From<crate::oci::LinuxCPU> for oci::LinuxCpu {
impl From<crate::oci::LinuxPids> for oci::LinuxPids { impl From<crate::oci::LinuxPids> for oci::LinuxPids {
fn from(from: crate::oci::LinuxPids) -> Self { fn from(from: crate::oci::LinuxPids) -> Self {
oci::LinuxPids { oci::LinuxPids {
limit: from.get_Limit(), limit: from.Limit(),
} }
} }
} }
@ -588,35 +559,35 @@ impl From<crate::oci::LinuxPids> for oci::LinuxPids {
impl From<crate::oci::LinuxBlockIO> for oci::LinuxBlockIo { impl From<crate::oci::LinuxBlockIO> for oci::LinuxBlockIo {
fn from(from: crate::oci::LinuxBlockIO) -> Self { fn from(from: crate::oci::LinuxBlockIO) -> Self {
let mut weight = None; let mut weight = None;
if from.get_Weight() > 0 { if from.Weight() > 0 {
weight = Some(from.get_Weight() as u16); weight = Some(from.Weight() as u16);
} }
let mut leaf_weight = None; let mut leaf_weight = None;
if from.get_LeafWeight() > 0 { if from.LeafWeight() > 0 {
leaf_weight = Some(from.get_LeafWeight() as u16); leaf_weight = Some(from.LeafWeight() as u16);
} }
let mut weight_device = Vec::new(); let mut weight_device = Vec::new();
for wd in from.get_WeightDevice() { for wd in from.WeightDevice() {
weight_device.push(wd.clone().into()); weight_device.push(wd.clone().into());
} }
let mut throttle_read_bps_device = Vec::new(); let mut throttle_read_bps_device = Vec::new();
for td in from.get_ThrottleReadBpsDevice() { for td in from.ThrottleReadBpsDevice() {
throttle_read_bps_device.push(td.clone().into()); throttle_read_bps_device.push(td.clone().into());
} }
let mut throttle_write_bps_device = Vec::new(); let mut throttle_write_bps_device = Vec::new();
for td in from.get_ThrottleWriteBpsDevice() { for td in from.ThrottleWriteBpsDevice() {
throttle_write_bps_device.push(td.clone().into()); throttle_write_bps_device.push(td.clone().into());
} }
let mut throttle_read_iops_device = Vec::new(); let mut throttle_read_iops_device = Vec::new();
for td in from.get_ThrottleReadIOPSDevice() { for td in from.ThrottleReadIOPSDevice() {
throttle_read_iops_device.push(td.clone().into()); throttle_read_iops_device.push(td.clone().into());
} }
let mut throttle_write_iops_device = Vec::new(); let mut throttle_write_iops_device = Vec::new();
for td in from.get_ThrottleWriteIOPSDevice() { for td in from.ThrottleWriteIOPSDevice() {
throttle_write_iops_device.push(td.clone().into()); throttle_write_iops_device.push(td.clone().into());
} }
@ -661,7 +632,7 @@ impl From<crate::oci::LinuxInterfacePriority> for oci::LinuxInterfacePriority {
fn from(mut from: crate::oci::LinuxInterfacePriority) -> Self { fn from(mut from: crate::oci::LinuxInterfacePriority) -> Self {
oci::LinuxInterfacePriority { oci::LinuxInterfacePriority {
name: from.take_Name(), name: from.take_Name(),
priority: from.get_Priority(), priority: from.Priority(),
} }
} }
} }
@ -669,11 +640,11 @@ impl From<crate::oci::LinuxInterfacePriority> for oci::LinuxInterfacePriority {
impl From<crate::oci::LinuxNetwork> for oci::LinuxNetwork { impl From<crate::oci::LinuxNetwork> for oci::LinuxNetwork {
fn from(mut from: crate::oci::LinuxNetwork) -> Self { fn from(mut from: crate::oci::LinuxNetwork) -> Self {
let mut class_id = None; let mut class_id = None;
if from.get_ClassID() > 0 { if from.ClassID() > 0 {
class_id = Some(from.get_ClassID()); class_id = Some(from.ClassID());
} }
let mut priorities = Vec::new(); let mut priorities = Vec::new();
for p in from.take_Priorities().to_vec() { for p in from.take_Priorities() {
priorities.push(p.into()) priorities.push(p.into())
} }
@ -688,7 +659,7 @@ impl From<crate::oci::LinuxHugepageLimit> for oci::LinuxHugepageLimit {
fn from(mut from: crate::oci::LinuxHugepageLimit) -> Self { fn from(mut from: crate::oci::LinuxHugepageLimit) -> Self {
oci::LinuxHugepageLimit { oci::LinuxHugepageLimit {
page_size: from.take_Pagesize(), page_size: from.take_Pagesize(),
limit: from.get_Limit(), limit: from.Limit(),
} }
} }
} }
@ -696,7 +667,7 @@ impl From<crate::oci::LinuxHugepageLimit> for oci::LinuxHugepageLimit {
impl From<crate::oci::LinuxResources> for oci::LinuxResources { impl From<crate::oci::LinuxResources> for oci::LinuxResources {
fn from(mut from: crate::oci::LinuxResources) -> Self { fn from(mut from: crate::oci::LinuxResources) -> Self {
let mut devices = Vec::new(); let mut devices = Vec::new();
for d in from.take_Devices().to_vec() { for d in from.take_Devices() {
devices.push(d.into()); devices.push(d.into());
} }
@ -712,16 +683,16 @@ impl From<crate::oci::LinuxResources> for oci::LinuxResources {
let mut pids = None; let mut pids = None;
if from.has_Pids() { if from.has_Pids() {
pids = Some(from.get_Pids().clone().into()) pids = Some(from.Pids().clone().into())
} }
let mut block_io = None; let mut block_io = None;
if from.has_BlockIO() { if from.has_BlockIO() {
block_io = Some(from.get_BlockIO().clone().into()); block_io = Some(from.BlockIO().clone().into());
} }
let mut hugepage_limits = Vec::new(); let mut hugepage_limits = Vec::new();
for hl in from.get_HugepageLimits() { for hl in from.HugepageLimits() {
hugepage_limits.push(hl.clone().into()); hugepage_limits.push(hl.clone().into());
} }
@ -750,11 +721,11 @@ impl From<crate::oci::LinuxDevice> for oci::LinuxDevice {
oci::LinuxDevice { oci::LinuxDevice {
path: from.take_Path(), path: from.take_Path(),
r#type: from.take_Type(), r#type: from.take_Type(),
major: from.get_Major(), major: from.Major(),
minor: from.get_Minor(), minor: from.Minor(),
file_mode: Some(from.get_FileMode()), file_mode: Some(from.FileMode()),
uid: Some(from.get_UID()), uid: Some(from.UID()),
gid: Some(from.get_GID()), gid: Some(from.GID()),
} }
} }
} }
@ -762,9 +733,9 @@ impl From<crate::oci::LinuxDevice> for oci::LinuxDevice {
impl From<crate::oci::LinuxSeccompArg> for oci::LinuxSeccompArg { impl From<crate::oci::LinuxSeccompArg> for oci::LinuxSeccompArg {
fn from(mut from: crate::oci::LinuxSeccompArg) -> Self { fn from(mut from: crate::oci::LinuxSeccompArg) -> Self {
oci::LinuxSeccompArg { oci::LinuxSeccompArg {
index: from.get_Index() as u32, index: from.Index() as u32,
value: from.get_Value(), value: from.Value(),
value_two: from.get_ValueTwo(), value_two: from.ValueTwo(),
op: from.take_Op(), op: from.take_Op(),
} }
} }
@ -773,14 +744,14 @@ impl From<crate::oci::LinuxSeccompArg> for oci::LinuxSeccompArg {
impl From<crate::oci::LinuxSyscall> for oci::LinuxSyscall { impl From<crate::oci::LinuxSyscall> for oci::LinuxSyscall {
fn from(mut from: crate::oci::LinuxSyscall) -> Self { fn from(mut from: crate::oci::LinuxSyscall) -> Self {
let mut args = Vec::new(); let mut args = Vec::new();
for ag in from.take_Args().to_vec() { for ag in from.take_Args() {
args.push(ag.into()); args.push(ag.into());
} }
oci::LinuxSyscall { oci::LinuxSyscall {
names: from.take_Names().to_vec(), names: from.take_Names().to_vec(),
action: from.take_Action(), action: from.take_Action(),
args, args,
errno_ret: from.get_errnoret(), errno_ret: from.errnoret(),
} }
} }
} }
@ -788,7 +759,7 @@ impl From<crate::oci::LinuxSyscall> for oci::LinuxSyscall {
impl From<crate::oci::LinuxSeccomp> for oci::LinuxSeccomp { impl From<crate::oci::LinuxSeccomp> for oci::LinuxSeccomp {
fn from(mut from: crate::oci::LinuxSeccomp) -> Self { fn from(mut from: crate::oci::LinuxSeccomp) -> Self {
let mut syscalls = Vec::new(); let mut syscalls = Vec::new();
for s in from.take_Syscalls().to_vec() { for s in from.take_Syscalls() {
syscalls.push(s.into()); syscalls.push(s.into());
} }
@ -813,16 +784,16 @@ impl From<crate::oci::LinuxNamespace> for oci::LinuxNamespace {
impl From<crate::oci::Linux> for oci::Linux { impl From<crate::oci::Linux> for oci::Linux {
fn from(mut from: crate::oci::Linux) -> Self { fn from(mut from: crate::oci::Linux) -> Self {
let mut uid_mappings = Vec::new(); let mut uid_mappings = Vec::new();
for id_map in from.take_UIDMappings().to_vec() { for id_map in from.take_UIDMappings() {
uid_mappings.push(id_map.into()) uid_mappings.push(id_map.into())
} }
let mut gid_mappings = Vec::new(); let mut gid_mappings = Vec::new();
for id_map in from.take_GIDMappings().to_vec() { for id_map in from.take_GIDMappings() {
gid_mappings.push(id_map.into()) gid_mappings.push(id_map.into())
} }
let sysctl = from.get_Sysctl().clone(); let sysctl = from.Sysctl().clone();
let mut resources = None; let mut resources = None;
if from.has_Resources() { if from.has_Resources() {
resources = Some(from.take_Resources().into()); resources = Some(from.take_Resources().into());
@ -830,12 +801,12 @@ impl From<crate::oci::Linux> for oci::Linux {
let cgroups_path = from.take_CgroupsPath(); let cgroups_path = from.take_CgroupsPath();
let mut namespaces = Vec::new(); let mut namespaces = Vec::new();
for ns in from.take_Namespaces().to_vec() { for ns in from.take_Namespaces() {
namespaces.push(ns.into()) namespaces.push(ns.into())
} }
let mut devices = Vec::new(); let mut devices = Vec::new();
for d in from.take_Devices().to_vec() { for d in from.take_Devices() {
devices.push(d.into()); devices.push(d.into());
} }
@ -874,8 +845,8 @@ impl From<crate::oci::POSIXRlimit> for oci::PosixRlimit {
fn from(mut from: crate::oci::POSIXRlimit) -> Self { fn from(mut from: crate::oci::POSIXRlimit) -> Self {
oci::PosixRlimit { oci::PosixRlimit {
r#type: from.take_Type(), r#type: from.take_Type(),
hard: from.get_Hard(), hard: from.Hard(),
soft: from.get_Soft(), soft: from.Soft(),
} }
} }
} }
@ -895,8 +866,8 @@ impl From<crate::oci::LinuxCapabilities> for oci::LinuxCapabilities {
impl From<crate::oci::User> for oci::User { impl From<crate::oci::User> for oci::User {
fn from(mut from: crate::oci::User) -> Self { fn from(mut from: crate::oci::User) -> Self {
oci::User { oci::User {
uid: from.get_UID(), uid: from.UID(),
gid: from.get_GID(), gid: from.GID(),
additional_gids: from.take_AdditionalGids().to_vec(), additional_gids: from.take_AdditionalGids().to_vec(),
username: from.take_Username(), username: from.take_Username(),
} }
@ -906,8 +877,8 @@ impl From<crate::oci::User> for oci::User {
impl From<crate::oci::Box> for oci::Box { impl From<crate::oci::Box> for oci::Box {
fn from(from: crate::oci::Box) -> Self { fn from(from: crate::oci::Box) -> Self {
oci::Box { oci::Box {
height: from.get_Height(), height: from.Height(),
width: from.get_Width(), width: from.Width(),
} }
} }
} }
@ -920,22 +891,22 @@ impl From<crate::oci::Process> for oci::Process {
} }
let user = from.take_User().into(); let user = from.take_User().into();
let args = from.take_Args().into_vec(); let args = from.take_Args();
let env = from.take_Env().into_vec(); let env = from.take_Env();
let cwd = from.take_Cwd(); let cwd = from.take_Cwd();
let mut capabilities = None; let mut capabilities = None;
if from.has_Capabilities() { if from.has_Capabilities() {
capabilities = Some(from.take_Capabilities().into()); capabilities = Some(from.take_Capabilities().into());
} }
let mut rlimits = Vec::new(); let mut rlimits = Vec::new();
for rl in from.take_Rlimits().to_vec() { for rl in from.take_Rlimits() {
rlimits.push(rl.into()); rlimits.push(rl.into());
} }
let no_new_privileges = from.get_NoNewPrivileges(); let no_new_privileges = from.NoNewPrivileges();
let apparmor_profile = from.take_ApparmorProfile(); let apparmor_profile = from.take_ApparmorProfile();
let mut oom_score_adj = None; let mut oom_score_adj = None;
if from.get_OOMScoreAdj() != 0 { if from.OOMScoreAdj() != 0 {
oom_score_adj = Some(from.get_OOMScoreAdj() as i32); oom_score_adj = Some(from.OOMScoreAdj() as i32);
} }
let selinux_label = from.take_SelinuxLabel(); let selinux_label = from.take_SelinuxLabel();
@ -959,8 +930,8 @@ impl From<crate::oci::Process> for oci::Process {
impl From<crate::oci::Hook> for oci::Hook { impl From<crate::oci::Hook> for oci::Hook {
fn from(mut from: crate::oci::Hook) -> Self { fn from(mut from: crate::oci::Hook) -> Self {
let mut timeout = None; let mut timeout = None;
if from.get_Timeout() > 0 { if from.Timeout() > 0 {
timeout = Some(from.get_Timeout() as i32); timeout = Some(from.Timeout() as i32);
} }
oci::Hook { oci::Hook {
path: from.take_Path(), path: from.take_Path(),
@ -1020,7 +991,7 @@ impl From<crate::oci::Spec> for oci::Spec {
} }
let mut mounts = Vec::new(); let mut mounts = Vec::new();
for m in from.take_Mounts().into_vec() { for m in from.take_Mounts() {
mounts.push(m.into()) mounts.push(m.into())
} }