diff --git a/crates/shim-protos/build.rs b/crates/shim-protos/build.rs index 409b7a8..0848dbc 100644 --- a/crates/shim-protos/build.rs +++ b/crates/shim-protos/build.rs @@ -27,6 +27,13 @@ fn main() {} #[cfg(feature = "generate_bindings")] fn main() { + codegen( + "src/cgroups", + &["vendor/github.com/containerd/cgroups/stats/v1/metrics.proto"], + true, + false, + ); + codegen( "src/events", &[ @@ -41,13 +48,6 @@ fn main() { false, ); - codegen( - "src/cgroups", - &["vendor/github.com/containerd/cgroups/stats/v1/metrics.proto"], - true, - false, - ); - // generate async service codegen( "src/shim", @@ -55,11 +55,9 @@ fn main() { "vendor/github.com/containerd/containerd/runtime/v2/task/shim.proto", "vendor/github.com/containerd/containerd/api/services/ttrpc/events/v1/events.proto", ], - true, + false, true, ); - - // rename to async fs::rename("src/shim/shim_ttrpc.rs", "src/shim/shim_ttrpc_async.rs").unwrap(); fs::rename("src/shim/events_ttrpc.rs", "src/shim/events_ttrpc_async.rs").unwrap(); @@ -68,30 +66,22 @@ fn main() { &[ "vendor/github.com/containerd/containerd/runtime/v2/runc/options/oci.proto", "vendor/github.com/containerd/containerd/runtime/v2/task/shim.proto", + "vendor/github.com/containerd/containerd/api/services/ttrpc/events/v1/events.proto", + ], + false, + false, + ); + + codegen( + "src/types", + &[ "vendor/github.com/containerd/containerd/api/types/mount.proto", "vendor/github.com/containerd/containerd/api/types/task/task.proto", - "vendor/github.com/containerd/containerd/api/services/ttrpc/events/v1/events.proto", "vendor/google/protobuf/empty.proto", ], true, false, ); - - // TODO: shim_ttrpc is not included in mod.rs, file a bug upstream. - let mut f = fs::OpenOptions::new() - .append(true) - .open("src/shim/mod.rs") - .unwrap(); - - // export sync mod - writeln!(f, "pub mod shim_ttrpc;").unwrap(); - writeln!(f, "pub mod events_ttrpc;").unwrap(); - - // export async mod by feature - writeln!(f, r##"#[cfg(feature = "async")]"##).unwrap(); - writeln!(f, "pub mod shim_ttrpc_async;").unwrap(); - writeln!(f, r##"#[cfg(feature = "async")]"##).unwrap(); - writeln!(f, "pub mod events_ttrpc_async;").unwrap(); } #[cfg(feature = "generate_bindings")] diff --git a/crates/shim-protos/src/events/mod.rs b/crates/shim-protos/src/events/mod.rs index 212a809..9a78b6e 100644 --- a/crates/shim-protos/src/events/mod.rs +++ b/crates/shim-protos/src/events/mod.rs @@ -1,7 +1,8 @@ pub mod container; pub mod content; pub mod image; -pub mod mount; pub mod namespace; pub mod snapshot; pub mod task; + +pub(crate) mod mount; diff --git a/crates/shim-protos/src/events/mount.rs b/crates/shim-protos/src/events/mount.rs index f66fa69..2164cfc 100644 --- a/crates/shim-protos/src/events/mount.rs +++ b/crates/shim-protos/src/events/mount.rs @@ -1,3 +1,3 @@ -/// Reexport shim::mount::* to keep backward compatibility. +/// Reexport types::mount::* to avoid manually editing other auto-generated source files. -pub use crate::shim::mount::*; \ No newline at end of file +pub use crate::types::mount::*; \ No newline at end of file diff --git a/crates/shim-protos/src/lib.rs b/crates/shim-protos/src/lib.rs index e0ef38b..03e67bf 100644 --- a/crates/shim-protos/src/lib.rs +++ b/crates/shim-protos/src/lib.rs @@ -73,6 +73,8 @@ pub mod events; pub mod cgroups; #[rustfmt::skip] pub mod shim; +#[rustfmt::skip] +pub mod types; /// Includes event names shims can publish to containerd. pub mod topics; diff --git a/crates/shim-protos/src/shim/empty.rs b/crates/shim-protos/src/shim/empty.rs index 9827104..7faf084 100644 --- a/crates/shim-protos/src/shim/empty.rs +++ b/crates/shim-protos/src/shim/empty.rs @@ -1,157 +1,3 @@ -// This file is generated by rust-protobuf 2.27.1. Do not edit -// @generated +/// Reexport types::empty::* to avoid manually editing other auto-generated source files. -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_imports)] -#![allow(unused_results)] -//! Generated file from `google/protobuf/empty.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_27_1; - -#[derive(PartialEq,Clone,Default)] -pub struct Empty { - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a Empty { - fn default() -> &'a Empty { - ::default_instance() - } -} - -impl Empty { - pub fn new() -> Empty { - ::std::default::Default::default() - } -} - -impl ::protobuf::Message for Empty { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> Empty { - Empty::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let fields = ::std::vec::Vec::new(); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "Empty", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static Empty { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(Empty::new) - } -} - -impl ::protobuf::Clear for Empty { - fn clear(&mut self) { - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Empty { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Empty { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x1bgoogle/protobuf/empty.proto\x12\x0fgoogle.protobuf\"\t\n\x05Empty:\ - \0B\0b\x06proto3\ -"; - -static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) -} +pub use crate::types::empty::*; diff --git a/crates/shim-protos/src/shim/mod.rs b/crates/shim-protos/src/shim/mod.rs index 14bb701..79d02c1 100644 --- a/crates/shim-protos/src/shim/mod.rs +++ b/crates/shim-protos/src/shim/mod.rs @@ -1,14 +1,15 @@ -// @generated - pub mod oci; -pub mod shim; -pub mod mount; -pub mod task; + pub mod events; -pub mod empty; -pub mod shim_ttrpc; pub mod events_ttrpc; #[cfg(feature = "async")] -pub mod shim_ttrpc_async; -#[cfg(feature = "async")] pub mod events_ttrpc_async; + +pub mod shim; +pub mod shim_ttrpc; +#[cfg(feature = "async")] +pub mod shim_ttrpc_async; + +pub(crate) mod empty; +pub(crate) mod mount; +pub(crate) mod task; diff --git a/crates/shim-protos/src/shim/mount.rs b/crates/shim-protos/src/shim/mount.rs index b07151e..48d3f00 100644 --- a/crates/shim-protos/src/shim/mount.rs +++ b/crates/shim-protos/src/shim/mount.rs @@ -1,328 +1,3 @@ -// This file is generated by rust-protobuf 2.27.1. Do not edit -// @generated +/// Reexport types::mount::* to avoid manually editing other auto-generated source files. -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_imports)] -#![allow(unused_results)] -//! Generated file from `github.com/containerd/containerd/api/types/mount.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_27_1; - -#[derive(PartialEq,Clone,Default)] -pub struct Mount { - // message fields - pub field_type: ::std::string::String, - pub source: ::std::string::String, - pub target: ::std::string::String, - pub options: ::protobuf::RepeatedField<::std::string::String>, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a Mount { - fn default() -> &'a Mount { - ::default_instance() - } -} - -impl Mount { - pub fn new() -> Mount { - ::std::default::Default::default() - } - - // string type = 1; - - - pub fn get_field_type(&self) -> &str { - &self.field_type - } - pub fn clear_field_type(&mut self) { - self.field_type.clear(); - } - - // Param is passed by value, moved - pub fn set_field_type(&mut self, v: ::std::string::String) { - self.field_type = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_field_type(&mut self) -> &mut ::std::string::String { - &mut self.field_type - } - - // Take field - pub fn take_field_type(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.field_type, ::std::string::String::new()) - } - - // string source = 2; - - - pub fn get_source(&self) -> &str { - &self.source - } - pub fn clear_source(&mut self) { - self.source.clear(); - } - - // Param is passed by value, moved - pub fn set_source(&mut self, v: ::std::string::String) { - self.source = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source(&mut self) -> &mut ::std::string::String { - &mut self.source - } - - // Take field - pub fn take_source(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.source, ::std::string::String::new()) - } - - // string target = 3; - - - pub fn get_target(&self) -> &str { - &self.target - } - pub fn clear_target(&mut self) { - self.target.clear(); - } - - // Param is passed by value, moved - pub fn set_target(&mut self, v: ::std::string::String) { - self.target = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_target(&mut self) -> &mut ::std::string::String { - &mut self.target - } - - // Take field - pub fn take_target(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.target, ::std::string::String::new()) - } - - // repeated string options = 4; - - - pub fn get_options(&self) -> &[::std::string::String] { - &self.options - } - pub fn clear_options(&mut self) { - self.options.clear(); - } - - // Param is passed by value, moved - pub fn set_options(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { - self.options = v; - } - - // Mutable pointer to the field. - pub fn mut_options(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { - &mut self.options - } - - // Take field - pub fn take_options(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { - ::std::mem::replace(&mut self.options, ::protobuf::RepeatedField::new()) - } -} - -impl ::protobuf::Message for Mount { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_type)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.source)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.target)?; - }, - 4 => { - ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.options)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.field_type.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.field_type); - } - if !self.source.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.source); - } - if !self.target.is_empty() { - my_size += ::protobuf::rt::string_size(3, &self.target); - } - for value in &self.options { - my_size += ::protobuf::rt::string_size(4, &value); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.field_type.is_empty() { - os.write_string(1, &self.field_type)?; - } - if !self.source.is_empty() { - os.write_string(2, &self.source)?; - } - if !self.target.is_empty() { - os.write_string(3, &self.target)?; - } - for v in &self.options { - os.write_string(4, &v)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> Mount { - Mount::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "type", - |m: &Mount| { &m.field_type }, - |m: &mut Mount| { &mut m.field_type }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "source", - |m: &Mount| { &m.source }, - |m: &mut Mount| { &mut m.source }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "target", - |m: &Mount| { &m.target }, - |m: &mut Mount| { &mut m.target }, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "options", - |m: &Mount| { &m.options }, - |m: &mut Mount| { &mut m.options }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "Mount", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static Mount { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(Mount::new) - } -} - -impl ::protobuf::Clear for Mount { - fn clear(&mut self) { - self.field_type.clear(); - self.source.clear(); - self.target.clear(); - self.options.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Mount { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Mount { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n6github.com/containerd/containerd/api/types/mount.proto\x12\x10contain\ - erd.types\x1a\x14gogoproto/gogo.protoX\0\"o\n\x05Mount\x12\x14\n\x04type\ - \x18\x01\x20\x01(\tR\x04typeB\0\x12\x18\n\x06source\x18\x02\x20\x01(\tR\ - \x06sourceB\0\x12\x18\n\x06target\x18\x03\x20\x01(\tR\x06targetB\0\x12\ - \x1a\n\x07options\x18\x04\x20\x03(\tR\x07optionsB\0:\0B\0b\x06proto3\ -"; - -static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) -} +pub use crate::types::mount::*; diff --git a/crates/shim-protos/src/shim/task.rs b/crates/shim-protos/src/shim/task.rs index ac05d53..03ce397 100644 --- a/crates/shim-protos/src/shim/task.rs +++ b/crates/shim-protos/src/shim/task.rs @@ -1,848 +1,3 @@ -// This file is generated by rust-protobuf 2.27.1. Do not edit -// @generated +/// Reexport types::task::* to avoid manually editing other auto-generated source files. -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_imports)] -#![allow(unused_results)] -//! Generated file from `github.com/containerd/containerd/api/types/task/task.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_27_1; - -#[derive(PartialEq,Clone,Default)] -pub struct Process { - // message fields - pub container_id: ::std::string::String, - pub id: ::std::string::String, - pub pid: u32, - pub status: Status, - pub stdin: ::std::string::String, - pub stdout: ::std::string::String, - pub stderr: ::std::string::String, - pub terminal: bool, - pub exit_status: u32, - pub exited_at: ::protobuf::SingularPtrField<::protobuf::well_known_types::Timestamp>, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a Process { - fn default() -> &'a Process { - ::default_instance() - } -} - -impl Process { - pub fn new() -> Process { - ::std::default::Default::default() - } - - // string container_id = 1; - - - pub fn get_container_id(&self) -> &str { - &self.container_id - } - pub fn clear_container_id(&mut self) { - self.container_id.clear(); - } - - // Param is passed by value, moved - pub fn set_container_id(&mut self, v: ::std::string::String) { - self.container_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_container_id(&mut self) -> &mut ::std::string::String { - &mut self.container_id - } - - // Take field - pub fn take_container_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.container_id, ::std::string::String::new()) - } - - // string id = 2; - - - pub fn get_id(&self) -> &str { - &self.id - } - pub fn clear_id(&mut self) { - self.id.clear(); - } - - // Param is passed by value, moved - pub fn set_id(&mut self, v: ::std::string::String) { - self.id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_id(&mut self) -> &mut ::std::string::String { - &mut self.id - } - - // Take field - pub fn take_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.id, ::std::string::String::new()) - } - - // uint32 pid = 3; - - - pub fn get_pid(&self) -> u32 { - self.pid - } - pub fn clear_pid(&mut self) { - self.pid = 0; - } - - // Param is passed by value, moved - pub fn set_pid(&mut self, v: u32) { - self.pid = v; - } - - // .containerd.v1.types.Status status = 4; - - - pub fn get_status(&self) -> Status { - self.status - } - pub fn clear_status(&mut self) { - self.status = Status::UNKNOWN; - } - - // Param is passed by value, moved - pub fn set_status(&mut self, v: Status) { - self.status = v; - } - - // string stdin = 5; - - - pub fn get_stdin(&self) -> &str { - &self.stdin - } - pub fn clear_stdin(&mut self) { - self.stdin.clear(); - } - - // Param is passed by value, moved - pub fn set_stdin(&mut self, v: ::std::string::String) { - self.stdin = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_stdin(&mut self) -> &mut ::std::string::String { - &mut self.stdin - } - - // Take field - pub fn take_stdin(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.stdin, ::std::string::String::new()) - } - - // string stdout = 6; - - - pub fn get_stdout(&self) -> &str { - &self.stdout - } - pub fn clear_stdout(&mut self) { - self.stdout.clear(); - } - - // Param is passed by value, moved - pub fn set_stdout(&mut self, v: ::std::string::String) { - self.stdout = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_stdout(&mut self) -> &mut ::std::string::String { - &mut self.stdout - } - - // Take field - pub fn take_stdout(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.stdout, ::std::string::String::new()) - } - - // string stderr = 7; - - - pub fn get_stderr(&self) -> &str { - &self.stderr - } - pub fn clear_stderr(&mut self) { - self.stderr.clear(); - } - - // Param is passed by value, moved - pub fn set_stderr(&mut self, v: ::std::string::String) { - self.stderr = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_stderr(&mut self) -> &mut ::std::string::String { - &mut self.stderr - } - - // Take field - pub fn take_stderr(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.stderr, ::std::string::String::new()) - } - - // bool terminal = 8; - - - pub fn get_terminal(&self) -> bool { - self.terminal - } - pub fn clear_terminal(&mut self) { - self.terminal = false; - } - - // Param is passed by value, moved - pub fn set_terminal(&mut self, v: bool) { - self.terminal = v; - } - - // uint32 exit_status = 9; - - - pub fn get_exit_status(&self) -> u32 { - self.exit_status - } - pub fn clear_exit_status(&mut self) { - self.exit_status = 0; - } - - // Param is passed by value, moved - pub fn set_exit_status(&mut self, v: u32) { - self.exit_status = v; - } - - // .google.protobuf.Timestamp exited_at = 10; - - - pub fn get_exited_at(&self) -> &::protobuf::well_known_types::Timestamp { - self.exited_at.as_ref().unwrap_or_else(|| <::protobuf::well_known_types::Timestamp as ::protobuf::Message>::default_instance()) - } - pub fn clear_exited_at(&mut self) { - self.exited_at.clear(); - } - - pub fn has_exited_at(&self) -> bool { - self.exited_at.is_some() - } - - // Param is passed by value, moved - pub fn set_exited_at(&mut self, v: ::protobuf::well_known_types::Timestamp) { - self.exited_at = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_exited_at(&mut self) -> &mut ::protobuf::well_known_types::Timestamp { - if self.exited_at.is_none() { - self.exited_at.set_default(); - } - self.exited_at.as_mut().unwrap() - } - - // Take field - pub fn take_exited_at(&mut self) -> ::protobuf::well_known_types::Timestamp { - self.exited_at.take().unwrap_or_else(|| ::protobuf::well_known_types::Timestamp::new()) - } -} - -impl ::protobuf::Message for Process { - fn is_initialized(&self) -> bool { - for v in &self.exited_at { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container_id)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.id)?; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint32()?; - self.pid = tmp; - }, - 4 => { - ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.status, 4, &mut self.unknown_fields)? - }, - 5 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.stdin)?; - }, - 6 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.stdout)?; - }, - 7 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.stderr)?; - }, - 8 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.terminal = tmp; - }, - 9 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint32()?; - self.exit_status = tmp; - }, - 10 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.exited_at)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.container_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.container_id); - } - if !self.id.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.id); - } - if self.pid != 0 { - my_size += ::protobuf::rt::value_size(3, self.pid, ::protobuf::wire_format::WireTypeVarint); - } - if self.status != Status::UNKNOWN { - my_size += ::protobuf::rt::enum_size(4, self.status); - } - if !self.stdin.is_empty() { - my_size += ::protobuf::rt::string_size(5, &self.stdin); - } - if !self.stdout.is_empty() { - my_size += ::protobuf::rt::string_size(6, &self.stdout); - } - if !self.stderr.is_empty() { - my_size += ::protobuf::rt::string_size(7, &self.stderr); - } - if self.terminal != false { - my_size += 2; - } - if self.exit_status != 0 { - my_size += ::protobuf::rt::value_size(9, self.exit_status, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.exited_at.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.container_id.is_empty() { - os.write_string(1, &self.container_id)?; - } - if !self.id.is_empty() { - os.write_string(2, &self.id)?; - } - if self.pid != 0 { - os.write_uint32(3, self.pid)?; - } - if self.status != Status::UNKNOWN { - os.write_enum(4, ::protobuf::ProtobufEnum::value(&self.status))?; - } - if !self.stdin.is_empty() { - os.write_string(5, &self.stdin)?; - } - if !self.stdout.is_empty() { - os.write_string(6, &self.stdout)?; - } - if !self.stderr.is_empty() { - os.write_string(7, &self.stderr)?; - } - if self.terminal != false { - os.write_bool(8, self.terminal)?; - } - if self.exit_status != 0 { - os.write_uint32(9, self.exit_status)?; - } - if let Some(ref v) = self.exited_at.as_ref() { - os.write_tag(10, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> Process { - Process::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "container_id", - |m: &Process| { &m.container_id }, - |m: &mut Process| { &mut m.container_id }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "id", - |m: &Process| { &m.id }, - |m: &mut Process| { &mut m.id }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( - "pid", - |m: &Process| { &m.pid }, - |m: &mut Process| { &mut m.pid }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "status", - |m: &Process| { &m.status }, - |m: &mut Process| { &mut m.status }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "stdin", - |m: &Process| { &m.stdin }, - |m: &mut Process| { &mut m.stdin }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "stdout", - |m: &Process| { &m.stdout }, - |m: &mut Process| { &mut m.stdout }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "stderr", - |m: &Process| { &m.stderr }, - |m: &mut Process| { &mut m.stderr }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "terminal", - |m: &Process| { &m.terminal }, - |m: &mut Process| { &mut m.terminal }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( - "exit_status", - |m: &Process| { &m.exit_status }, - |m: &mut Process| { &mut m.exit_status }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<::protobuf::well_known_types::Timestamp>>( - "exited_at", - |m: &Process| { &m.exited_at }, - |m: &mut Process| { &mut m.exited_at }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "Process", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static Process { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(Process::new) - } -} - -impl ::protobuf::Clear for Process { - fn clear(&mut self) { - self.container_id.clear(); - self.id.clear(); - self.pid = 0; - self.status = Status::UNKNOWN; - self.stdin.clear(); - self.stdout.clear(); - self.stderr.clear(); - self.terminal = false; - self.exit_status = 0; - self.exited_at.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Process { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Process { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ProcessInfo { - // message fields - pub pid: u32, - pub info: ::protobuf::SingularPtrField<::protobuf::well_known_types::Any>, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a ProcessInfo { - fn default() -> &'a ProcessInfo { - ::default_instance() - } -} - -impl ProcessInfo { - pub fn new() -> ProcessInfo { - ::std::default::Default::default() - } - - // uint32 pid = 1; - - - pub fn get_pid(&self) -> u32 { - self.pid - } - pub fn clear_pid(&mut self) { - self.pid = 0; - } - - // Param is passed by value, moved - pub fn set_pid(&mut self, v: u32) { - self.pid = v; - } - - // .google.protobuf.Any info = 2; - - - pub fn get_info(&self) -> &::protobuf::well_known_types::Any { - self.info.as_ref().unwrap_or_else(|| <::protobuf::well_known_types::Any as ::protobuf::Message>::default_instance()) - } - pub fn clear_info(&mut self) { - self.info.clear(); - } - - pub fn has_info(&self) -> bool { - self.info.is_some() - } - - // Param is passed by value, moved - pub fn set_info(&mut self, v: ::protobuf::well_known_types::Any) { - self.info = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_info(&mut self) -> &mut ::protobuf::well_known_types::Any { - if self.info.is_none() { - self.info.set_default(); - } - self.info.as_mut().unwrap() - } - - // Take field - pub fn take_info(&mut self) -> ::protobuf::well_known_types::Any { - self.info.take().unwrap_or_else(|| ::protobuf::well_known_types::Any::new()) - } -} - -impl ::protobuf::Message for ProcessInfo { - fn is_initialized(&self) -> bool { - for v in &self.info { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint32()?; - self.pid = tmp; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.info)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if self.pid != 0 { - my_size += ::protobuf::rt::value_size(1, self.pid, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.info.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if self.pid != 0 { - os.write_uint32(1, self.pid)?; - } - if let Some(ref v) = self.info.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> ProcessInfo { - ProcessInfo::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( - "pid", - |m: &ProcessInfo| { &m.pid }, - |m: &mut ProcessInfo| { &mut m.pid }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<::protobuf::well_known_types::Any>>( - "info", - |m: &ProcessInfo| { &m.info }, - |m: &mut ProcessInfo| { &mut m.info }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "ProcessInfo", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static ProcessInfo { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(ProcessInfo::new) - } -} - -impl ::protobuf::Clear for ProcessInfo { - fn clear(&mut self) { - self.pid = 0; - self.info.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ProcessInfo { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ProcessInfo { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum Status { - UNKNOWN = 0, - CREATED = 1, - RUNNING = 2, - STOPPED = 3, - PAUSED = 4, - PAUSING = 5, -} - -impl ::protobuf::ProtobufEnum for Status { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(Status::UNKNOWN), - 1 => ::std::option::Option::Some(Status::CREATED), - 2 => ::std::option::Option::Some(Status::RUNNING), - 3 => ::std::option::Option::Some(Status::STOPPED), - 4 => ::std::option::Option::Some(Status::PAUSED), - 5 => ::std::option::Option::Some(Status::PAUSING), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [Status] = &[ - Status::UNKNOWN, - Status::CREATED, - Status::RUNNING, - Status::STOPPED, - Status::PAUSED, - Status::PAUSING, - ]; - values - } - - fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new_pb_name::("Status", file_descriptor_proto()) - }) - } -} - -impl ::std::marker::Copy for Status { -} - -impl ::std::default::Default for Status { - fn default() -> Self { - Status::UNKNOWN - } -} - -impl ::protobuf::reflect::ProtobufValue for Status { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n:github.com/containerd/containerd/api/types/task/task.proto\x12\x13con\ - tainerd.v1.types\x1a\x14gogoproto/gogo.proto\x1a\x1fgoogle/protobuf/time\ - stamp.proto\x1a\x19google/protobuf/any.protoX\0\"\xdd\x02\n\x07Process\ - \x12#\n\x0ccontainer_id\x18\x01\x20\x01(\tR\x0bcontainerIdB\0\x12\x10\n\ - \x02id\x18\x02\x20\x01(\tR\x02idB\0\x12\x12\n\x03pid\x18\x03\x20\x01(\rR\ - \x03pidB\0\x125\n\x06status\x18\x04\x20\x01(\x0e2\x1b.containerd.v1.type\ - s.StatusR\x06statusB\0\x12\x16\n\x05stdin\x18\x05\x20\x01(\tR\x05stdinB\ - \0\x12\x18\n\x06stdout\x18\x06\x20\x01(\tR\x06stdoutB\0\x12\x18\n\x06std\ - err\x18\x07\x20\x01(\tR\x06stderrB\0\x12\x1c\n\x08terminal\x18\x08\x20\ - \x01(\x08R\x08terminalB\0\x12!\n\x0bexit_status\x18\t\x20\x01(\rR\nexitS\ - tatusB\0\x12A\n\texited_at\x18\n\x20\x01(\x0b2\x1a.google.protobuf.Times\ - tampR\x08exitedAtB\x08\x90\xdf\x1f\x01\xc8\xde\x1f\0:\0\"O\n\x0bProcessI\ - nfo\x12\x12\n\x03pid\x18\x01\x20\x01(\rR\x03pidB\0\x12*\n\x04info\x18\ - \x02\x20\x01(\x0b2\x14.google.protobuf.AnyR\x04infoB\0:\0*e\n\x06Status\ - \x12\x0b\n\x07UNKNOWN\x10\0\x12\x0b\n\x07CREATED\x10\x01\x12\x0b\n\x07RU\ - NNING\x10\x02\x12\x0b\n\x07STOPPED\x10\x03\x12\n\n\x06PAUSED\x10\x04\x12\ - \x0b\n\x07PAUSING\x10\x05\x1a\x0e\xba\xa4\x1e\x06Status\x88\xa3\x1e\0B\0\ - b\x06proto3\ -"; - -static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) -} +pub use crate::types::task::*; diff --git a/crates/shim-protos/src/types/empty.rs b/crates/shim-protos/src/types/empty.rs new file mode 100644 index 0000000..9827104 --- /dev/null +++ b/crates/shim-protos/src/types/empty.rs @@ -0,0 +1,157 @@ +// This file is generated by rust-protobuf 2.27.1. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_imports)] +#![allow(unused_results)] +//! Generated file from `google/protobuf/empty.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_27_1; + +#[derive(PartialEq,Clone,Default)] +pub struct Empty { + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Empty { + fn default() -> &'a Empty { + ::default_instance() + } +} + +impl Empty { + pub fn new() -> Empty { + ::std::default::Default::default() + } +} + +impl ::protobuf::Message for Empty { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Empty { + Empty::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "Empty", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static Empty { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(Empty::new) + } +} + +impl ::protobuf::Clear for Empty { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Empty { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Empty { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x1bgoogle/protobuf/empty.proto\x12\x0fgoogle.protobuf\"\t\n\x05Empty:\ + \0B\0b\x06proto3\ +"; + +static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) +} diff --git a/crates/shim-protos/src/types/mod.rs b/crates/shim-protos/src/types/mod.rs new file mode 100644 index 0000000..26e5d27 --- /dev/null +++ b/crates/shim-protos/src/types/mod.rs @@ -0,0 +1,5 @@ +// @generated + +pub mod mount; +pub mod task; +pub mod empty; diff --git a/crates/shim-protos/src/types/mount.rs b/crates/shim-protos/src/types/mount.rs new file mode 100644 index 0000000..b07151e --- /dev/null +++ b/crates/shim-protos/src/types/mount.rs @@ -0,0 +1,328 @@ +// This file is generated by rust-protobuf 2.27.1. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_imports)] +#![allow(unused_results)] +//! Generated file from `github.com/containerd/containerd/api/types/mount.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_27_1; + +#[derive(PartialEq,Clone,Default)] +pub struct Mount { + // message fields + pub field_type: ::std::string::String, + pub source: ::std::string::String, + pub target: ::std::string::String, + pub options: ::protobuf::RepeatedField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Mount { + fn default() -> &'a Mount { + ::default_instance() + } +} + +impl Mount { + pub fn new() -> Mount { + ::std::default::Default::default() + } + + // string type = 1; + + + pub fn get_field_type(&self) -> &str { + &self.field_type + } + pub fn clear_field_type(&mut self) { + self.field_type.clear(); + } + + // Param is passed by value, moved + pub fn set_field_type(&mut self, v: ::std::string::String) { + self.field_type = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_field_type(&mut self) -> &mut ::std::string::String { + &mut self.field_type + } + + // Take field + pub fn take_field_type(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.field_type, ::std::string::String::new()) + } + + // string source = 2; + + + pub fn get_source(&self) -> &str { + &self.source + } + pub fn clear_source(&mut self) { + self.source.clear(); + } + + // Param is passed by value, moved + pub fn set_source(&mut self, v: ::std::string::String) { + self.source = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source(&mut self) -> &mut ::std::string::String { + &mut self.source + } + + // Take field + pub fn take_source(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.source, ::std::string::String::new()) + } + + // string target = 3; + + + pub fn get_target(&self) -> &str { + &self.target + } + pub fn clear_target(&mut self) { + self.target.clear(); + } + + // Param is passed by value, moved + pub fn set_target(&mut self, v: ::std::string::String) { + self.target = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_target(&mut self) -> &mut ::std::string::String { + &mut self.target + } + + // Take field + pub fn take_target(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.target, ::std::string::String::new()) + } + + // repeated string options = 4; + + + pub fn get_options(&self) -> &[::std::string::String] { + &self.options + } + pub fn clear_options(&mut self) { + self.options.clear(); + } + + // Param is passed by value, moved + pub fn set_options(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.options = v; + } + + // Mutable pointer to the field. + pub fn mut_options(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.options + } + + // Take field + pub fn take_options(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.options, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for Mount { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_type)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.source)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.target)?; + }, + 4 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.options)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.field_type.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.field_type); + } + if !self.source.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.source); + } + if !self.target.is_empty() { + my_size += ::protobuf::rt::string_size(3, &self.target); + } + for value in &self.options { + my_size += ::protobuf::rt::string_size(4, &value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.field_type.is_empty() { + os.write_string(1, &self.field_type)?; + } + if !self.source.is_empty() { + os.write_string(2, &self.source)?; + } + if !self.target.is_empty() { + os.write_string(3, &self.target)?; + } + for v in &self.options { + os.write_string(4, &v)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Mount { + Mount::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "type", + |m: &Mount| { &m.field_type }, + |m: &mut Mount| { &mut m.field_type }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "source", + |m: &Mount| { &m.source }, + |m: &mut Mount| { &mut m.source }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "target", + |m: &Mount| { &m.target }, + |m: &mut Mount| { &mut m.target }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "options", + |m: &Mount| { &m.options }, + |m: &mut Mount| { &mut m.options }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "Mount", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static Mount { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(Mount::new) + } +} + +impl ::protobuf::Clear for Mount { + fn clear(&mut self) { + self.field_type.clear(); + self.source.clear(); + self.target.clear(); + self.options.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Mount { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Mount { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n6github.com/containerd/containerd/api/types/mount.proto\x12\x10contain\ + erd.types\x1a\x14gogoproto/gogo.protoX\0\"o\n\x05Mount\x12\x14\n\x04type\ + \x18\x01\x20\x01(\tR\x04typeB\0\x12\x18\n\x06source\x18\x02\x20\x01(\tR\ + \x06sourceB\0\x12\x18\n\x06target\x18\x03\x20\x01(\tR\x06targetB\0\x12\ + \x1a\n\x07options\x18\x04\x20\x03(\tR\x07optionsB\0:\0B\0b\x06proto3\ +"; + +static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) +} diff --git a/crates/shim-protos/src/types/task.rs b/crates/shim-protos/src/types/task.rs new file mode 100644 index 0000000..ac05d53 --- /dev/null +++ b/crates/shim-protos/src/types/task.rs @@ -0,0 +1,848 @@ +// This file is generated by rust-protobuf 2.27.1. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_imports)] +#![allow(unused_results)] +//! Generated file from `github.com/containerd/containerd/api/types/task/task.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_27_1; + +#[derive(PartialEq,Clone,Default)] +pub struct Process { + // message fields + pub container_id: ::std::string::String, + pub id: ::std::string::String, + pub pid: u32, + pub status: Status, + pub stdin: ::std::string::String, + pub stdout: ::std::string::String, + pub stderr: ::std::string::String, + pub terminal: bool, + pub exit_status: u32, + pub exited_at: ::protobuf::SingularPtrField<::protobuf::well_known_types::Timestamp>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Process { + fn default() -> &'a Process { + ::default_instance() + } +} + +impl Process { + pub fn new() -> Process { + ::std::default::Default::default() + } + + // string container_id = 1; + + + pub fn get_container_id(&self) -> &str { + &self.container_id + } + pub fn clear_container_id(&mut self) { + self.container_id.clear(); + } + + // Param is passed by value, moved + pub fn set_container_id(&mut self, v: ::std::string::String) { + self.container_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_container_id(&mut self) -> &mut ::std::string::String { + &mut self.container_id + } + + // Take field + pub fn take_container_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.container_id, ::std::string::String::new()) + } + + // string id = 2; + + + pub fn get_id(&self) -> &str { + &self.id + } + pub fn clear_id(&mut self) { + self.id.clear(); + } + + // Param is passed by value, moved + pub fn set_id(&mut self, v: ::std::string::String) { + self.id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_id(&mut self) -> &mut ::std::string::String { + &mut self.id + } + + // Take field + pub fn take_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.id, ::std::string::String::new()) + } + + // uint32 pid = 3; + + + pub fn get_pid(&self) -> u32 { + self.pid + } + pub fn clear_pid(&mut self) { + self.pid = 0; + } + + // Param is passed by value, moved + pub fn set_pid(&mut self, v: u32) { + self.pid = v; + } + + // .containerd.v1.types.Status status = 4; + + + pub fn get_status(&self) -> Status { + self.status + } + pub fn clear_status(&mut self) { + self.status = Status::UNKNOWN; + } + + // Param is passed by value, moved + pub fn set_status(&mut self, v: Status) { + self.status = v; + } + + // string stdin = 5; + + + pub fn get_stdin(&self) -> &str { + &self.stdin + } + pub fn clear_stdin(&mut self) { + self.stdin.clear(); + } + + // Param is passed by value, moved + pub fn set_stdin(&mut self, v: ::std::string::String) { + self.stdin = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_stdin(&mut self) -> &mut ::std::string::String { + &mut self.stdin + } + + // Take field + pub fn take_stdin(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.stdin, ::std::string::String::new()) + } + + // string stdout = 6; + + + pub fn get_stdout(&self) -> &str { + &self.stdout + } + pub fn clear_stdout(&mut self) { + self.stdout.clear(); + } + + // Param is passed by value, moved + pub fn set_stdout(&mut self, v: ::std::string::String) { + self.stdout = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_stdout(&mut self) -> &mut ::std::string::String { + &mut self.stdout + } + + // Take field + pub fn take_stdout(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.stdout, ::std::string::String::new()) + } + + // string stderr = 7; + + + pub fn get_stderr(&self) -> &str { + &self.stderr + } + pub fn clear_stderr(&mut self) { + self.stderr.clear(); + } + + // Param is passed by value, moved + pub fn set_stderr(&mut self, v: ::std::string::String) { + self.stderr = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_stderr(&mut self) -> &mut ::std::string::String { + &mut self.stderr + } + + // Take field + pub fn take_stderr(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.stderr, ::std::string::String::new()) + } + + // bool terminal = 8; + + + pub fn get_terminal(&self) -> bool { + self.terminal + } + pub fn clear_terminal(&mut self) { + self.terminal = false; + } + + // Param is passed by value, moved + pub fn set_terminal(&mut self, v: bool) { + self.terminal = v; + } + + // uint32 exit_status = 9; + + + pub fn get_exit_status(&self) -> u32 { + self.exit_status + } + pub fn clear_exit_status(&mut self) { + self.exit_status = 0; + } + + // Param is passed by value, moved + pub fn set_exit_status(&mut self, v: u32) { + self.exit_status = v; + } + + // .google.protobuf.Timestamp exited_at = 10; + + + pub fn get_exited_at(&self) -> &::protobuf::well_known_types::Timestamp { + self.exited_at.as_ref().unwrap_or_else(|| <::protobuf::well_known_types::Timestamp as ::protobuf::Message>::default_instance()) + } + pub fn clear_exited_at(&mut self) { + self.exited_at.clear(); + } + + pub fn has_exited_at(&self) -> bool { + self.exited_at.is_some() + } + + // Param is passed by value, moved + pub fn set_exited_at(&mut self, v: ::protobuf::well_known_types::Timestamp) { + self.exited_at = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_exited_at(&mut self) -> &mut ::protobuf::well_known_types::Timestamp { + if self.exited_at.is_none() { + self.exited_at.set_default(); + } + self.exited_at.as_mut().unwrap() + } + + // Take field + pub fn take_exited_at(&mut self) -> ::protobuf::well_known_types::Timestamp { + self.exited_at.take().unwrap_or_else(|| ::protobuf::well_known_types::Timestamp::new()) + } +} + +impl ::protobuf::Message for Process { + fn is_initialized(&self) -> bool { + for v in &self.exited_at { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.id)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.pid = tmp; + }, + 4 => { + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.status, 4, &mut self.unknown_fields)? + }, + 5 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.stdin)?; + }, + 6 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.stdout)?; + }, + 7 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.stderr)?; + }, + 8 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.terminal = tmp; + }, + 9 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.exit_status = tmp; + }, + 10 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.exited_at)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.container_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.container_id); + } + if !self.id.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.id); + } + if self.pid != 0 { + my_size += ::protobuf::rt::value_size(3, self.pid, ::protobuf::wire_format::WireTypeVarint); + } + if self.status != Status::UNKNOWN { + my_size += ::protobuf::rt::enum_size(4, self.status); + } + if !self.stdin.is_empty() { + my_size += ::protobuf::rt::string_size(5, &self.stdin); + } + if !self.stdout.is_empty() { + my_size += ::protobuf::rt::string_size(6, &self.stdout); + } + if !self.stderr.is_empty() { + my_size += ::protobuf::rt::string_size(7, &self.stderr); + } + if self.terminal != false { + my_size += 2; + } + if self.exit_status != 0 { + my_size += ::protobuf::rt::value_size(9, self.exit_status, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.exited_at.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.container_id.is_empty() { + os.write_string(1, &self.container_id)?; + } + if !self.id.is_empty() { + os.write_string(2, &self.id)?; + } + if self.pid != 0 { + os.write_uint32(3, self.pid)?; + } + if self.status != Status::UNKNOWN { + os.write_enum(4, ::protobuf::ProtobufEnum::value(&self.status))?; + } + if !self.stdin.is_empty() { + os.write_string(5, &self.stdin)?; + } + if !self.stdout.is_empty() { + os.write_string(6, &self.stdout)?; + } + if !self.stderr.is_empty() { + os.write_string(7, &self.stderr)?; + } + if self.terminal != false { + os.write_bool(8, self.terminal)?; + } + if self.exit_status != 0 { + os.write_uint32(9, self.exit_status)?; + } + if let Some(ref v) = self.exited_at.as_ref() { + os.write_tag(10, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Process { + Process::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "container_id", + |m: &Process| { &m.container_id }, + |m: &mut Process| { &mut m.container_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "id", + |m: &Process| { &m.id }, + |m: &mut Process| { &mut m.id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "pid", + |m: &Process| { &m.pid }, + |m: &mut Process| { &mut m.pid }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "status", + |m: &Process| { &m.status }, + |m: &mut Process| { &mut m.status }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "stdin", + |m: &Process| { &m.stdin }, + |m: &mut Process| { &mut m.stdin }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "stdout", + |m: &Process| { &m.stdout }, + |m: &mut Process| { &mut m.stdout }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "stderr", + |m: &Process| { &m.stderr }, + |m: &mut Process| { &mut m.stderr }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "terminal", + |m: &Process| { &m.terminal }, + |m: &mut Process| { &mut m.terminal }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "exit_status", + |m: &Process| { &m.exit_status }, + |m: &mut Process| { &mut m.exit_status }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<::protobuf::well_known_types::Timestamp>>( + "exited_at", + |m: &Process| { &m.exited_at }, + |m: &mut Process| { &mut m.exited_at }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "Process", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static Process { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(Process::new) + } +} + +impl ::protobuf::Clear for Process { + fn clear(&mut self) { + self.container_id.clear(); + self.id.clear(); + self.pid = 0; + self.status = Status::UNKNOWN; + self.stdin.clear(); + self.stdout.clear(); + self.stderr.clear(); + self.terminal = false; + self.exit_status = 0; + self.exited_at.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Process { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Process { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ProcessInfo { + // message fields + pub pid: u32, + pub info: ::protobuf::SingularPtrField<::protobuf::well_known_types::Any>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ProcessInfo { + fn default() -> &'a ProcessInfo { + ::default_instance() + } +} + +impl ProcessInfo { + pub fn new() -> ProcessInfo { + ::std::default::Default::default() + } + + // uint32 pid = 1; + + + pub fn get_pid(&self) -> u32 { + self.pid + } + pub fn clear_pid(&mut self) { + self.pid = 0; + } + + // Param is passed by value, moved + pub fn set_pid(&mut self, v: u32) { + self.pid = v; + } + + // .google.protobuf.Any info = 2; + + + pub fn get_info(&self) -> &::protobuf::well_known_types::Any { + self.info.as_ref().unwrap_or_else(|| <::protobuf::well_known_types::Any as ::protobuf::Message>::default_instance()) + } + pub fn clear_info(&mut self) { + self.info.clear(); + } + + pub fn has_info(&self) -> bool { + self.info.is_some() + } + + // Param is passed by value, moved + pub fn set_info(&mut self, v: ::protobuf::well_known_types::Any) { + self.info = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_info(&mut self) -> &mut ::protobuf::well_known_types::Any { + if self.info.is_none() { + self.info.set_default(); + } + self.info.as_mut().unwrap() + } + + // Take field + pub fn take_info(&mut self) -> ::protobuf::well_known_types::Any { + self.info.take().unwrap_or_else(|| ::protobuf::well_known_types::Any::new()) + } +} + +impl ::protobuf::Message for ProcessInfo { + fn is_initialized(&self) -> bool { + for v in &self.info { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.pid = tmp; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.info)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.pid != 0 { + my_size += ::protobuf::rt::value_size(1, self.pid, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.info.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if self.pid != 0 { + os.write_uint32(1, self.pid)?; + } + if let Some(ref v) = self.info.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ProcessInfo { + ProcessInfo::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "pid", + |m: &ProcessInfo| { &m.pid }, + |m: &mut ProcessInfo| { &mut m.pid }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<::protobuf::well_known_types::Any>>( + "info", + |m: &ProcessInfo| { &m.info }, + |m: &mut ProcessInfo| { &mut m.info }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "ProcessInfo", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static ProcessInfo { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(ProcessInfo::new) + } +} + +impl ::protobuf::Clear for ProcessInfo { + fn clear(&mut self) { + self.pid = 0; + self.info.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ProcessInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ProcessInfo { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum Status { + UNKNOWN = 0, + CREATED = 1, + RUNNING = 2, + STOPPED = 3, + PAUSED = 4, + PAUSING = 5, +} + +impl ::protobuf::ProtobufEnum for Status { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(Status::UNKNOWN), + 1 => ::std::option::Option::Some(Status::CREATED), + 2 => ::std::option::Option::Some(Status::RUNNING), + 3 => ::std::option::Option::Some(Status::STOPPED), + 4 => ::std::option::Option::Some(Status::PAUSED), + 5 => ::std::option::Option::Some(Status::PAUSING), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [Status] = &[ + Status::UNKNOWN, + Status::CREATED, + Status::RUNNING, + Status::STOPPED, + Status::PAUSED, + Status::PAUSING, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new_pb_name::("Status", file_descriptor_proto()) + }) + } +} + +impl ::std::marker::Copy for Status { +} + +impl ::std::default::Default for Status { + fn default() -> Self { + Status::UNKNOWN + } +} + +impl ::protobuf::reflect::ProtobufValue for Status { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n:github.com/containerd/containerd/api/types/task/task.proto\x12\x13con\ + tainerd.v1.types\x1a\x14gogoproto/gogo.proto\x1a\x1fgoogle/protobuf/time\ + stamp.proto\x1a\x19google/protobuf/any.protoX\0\"\xdd\x02\n\x07Process\ + \x12#\n\x0ccontainer_id\x18\x01\x20\x01(\tR\x0bcontainerIdB\0\x12\x10\n\ + \x02id\x18\x02\x20\x01(\tR\x02idB\0\x12\x12\n\x03pid\x18\x03\x20\x01(\rR\ + \x03pidB\0\x125\n\x06status\x18\x04\x20\x01(\x0e2\x1b.containerd.v1.type\ + s.StatusR\x06statusB\0\x12\x16\n\x05stdin\x18\x05\x20\x01(\tR\x05stdinB\ + \0\x12\x18\n\x06stdout\x18\x06\x20\x01(\tR\x06stdoutB\0\x12\x18\n\x06std\ + err\x18\x07\x20\x01(\tR\x06stderrB\0\x12\x1c\n\x08terminal\x18\x08\x20\ + \x01(\x08R\x08terminalB\0\x12!\n\x0bexit_status\x18\t\x20\x01(\rR\nexitS\ + tatusB\0\x12A\n\texited_at\x18\n\x20\x01(\x0b2\x1a.google.protobuf.Times\ + tampR\x08exitedAtB\x08\x90\xdf\x1f\x01\xc8\xde\x1f\0:\0\"O\n\x0bProcessI\ + nfo\x12\x12\n\x03pid\x18\x01\x20\x01(\rR\x03pidB\0\x12*\n\x04info\x18\ + \x02\x20\x01(\x0b2\x14.google.protobuf.AnyR\x04infoB\0:\0*e\n\x06Status\ + \x12\x0b\n\x07UNKNOWN\x10\0\x12\x0b\n\x07CREATED\x10\x01\x12\x0b\n\x07RU\ + NNING\x10\x02\x12\x0b\n\x07STOPPED\x10\x03\x12\n\n\x06PAUSED\x10\x04\x12\ + \x0b\n\x07PAUSING\x10\x05\x1a\x0e\xba\xa4\x1e\x06Status\x88\xa3\x1e\0B\0\ + b\x06proto3\ +"; + +static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) +} diff --git a/crates/shim/src/lib.rs b/crates/shim/src/lib.rs index 61e8c14..77fea46 100644 --- a/crates/shim/src/lib.rs +++ b/crates/shim/src/lib.rs @@ -66,9 +66,9 @@ pub mod error; /// Generated request/response structures. pub mod api { pub use super::protos::api::Status; - pub use super::protos::shim::empty::Empty; pub use super::protos::shim::oci::Options; pub use super::protos::shim::shim::*; + pub use super::protos::types::empty::Empty; } mod args; mod logger; diff --git a/crates/shim/src/publisher.rs b/crates/shim/src/publisher.rs index 2aa2ccf..6f1ba94 100644 --- a/crates/shim/src/publisher.rs +++ b/crates/shim/src/publisher.rs @@ -21,8 +21,9 @@ use std::time::{SystemTime, UNIX_EPOCH}; use containerd_shim_protos as client; use client::protobuf; -use client::shim::{empty, events}; +use client::shim::events; use client::ttrpc::{self, context::Context}; +use client::types::empty; use client::{Client, Events, EventsClient}; use protobuf::well_known_types::{Any, Timestamp};