agent: agent-protocol support async

1. support async.
2. update ttrpc and protobuf
update ttrpc to 0.6.0
update protobuf to 2.23.0
3. support trans from oci

Fixes: #3746
Signed-off-by: Quanwei Zhou <quanweiZhou@linux.alibaba.com>
This commit is contained in:
Quanwei Zhou 2022-02-22 15:41:10 +08:00 committed by Fupan Li
parent aee9633ced
commit d2a9bc6674
16 changed files with 2092 additions and 166 deletions

32
src/agent/Cargo.lock generated
View File

@ -807,19 +807,6 @@ dependencies = [
"void",
]
[[package]]
name = "nix"
version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5e06129fb611568ef4e868c14b326274959aa70ff7776e9d55323531c374945"
dependencies = [
"bitflags",
"cc",
"cfg-if 1.0.0",
"libc",
"memoffset",
]
[[package]]
name = "nix"
version = "0.22.2"
@ -1183,9 +1170,9 @@ dependencies = [
[[package]]
name = "protobuf"
version = "2.14.0"
version = "2.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e86d370532557ae7573551a1ec8235a0f8d6cb276c7c9e6aa490b511c447485"
checksum = "cf7e6d18738ecd0902d30d1ad232c9125985a3422929b16c65517b38adc14f96"
dependencies = [
"serde",
"serde_derive",
@ -1193,18 +1180,18 @@ dependencies = [
[[package]]
name = "protobuf-codegen"
version = "2.14.0"
version = "2.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de113bba758ccf2c1ef816b127c958001b7831136c9bc3f8e9ec695ac4e82b0c"
checksum = "aec1632b7c8f2e620343439a7dfd1f3c47b18906c4be58982079911482b5d707"
dependencies = [
"protobuf",
]
[[package]]
name = "protobuf-codegen-pure"
version = "2.14.0"
version = "2.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d1a4febc73bf0cada1d77c459a0c8e5973179f1cfd5b0f1ab789d45b17b6440"
checksum = "9f8122fdb18e55190c796b088a16bdb70cd7acdcd48f7a8b796b58c62e532cc6"
dependencies = [
"protobuf",
"protobuf-codegen",
@ -1215,6 +1202,7 @@ name = "protocols"
version = "0.1.0"
dependencies = [
"async-trait",
"oci",
"protobuf",
"ttrpc",
"ttrpc-codegen",
@ -1831,16 +1819,16 @@ dependencies = [
[[package]]
name = "ttrpc"
version = "0.5.2"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66a973ce6d5eaa20c173635b29ffb660dafbc7ef109172c0015ba44e47a23711"
checksum = "0c7d6c992964a013c17814c08d31708d577b0aae44ebadb58755659dd824c2d1"
dependencies = [
"async-trait",
"byteorder",
"futures",
"libc",
"log",
"nix 0.20.2",
"nix 0.23.1",
"protobuf",
"protobuf-codegen-pure",
"thiserror",

View File

@ -7,10 +7,10 @@ edition = "2018"
[dependencies]
oci = { path = "../libs/oci" }
rustjail = { path = "rustjail" }
protocols = { path = "../libs/protocols" }
protocols = { path = "../libs/protocols", features = ["async"] }
lazy_static = "1.3.0"
ttrpc = { version = "0.5.0", features = ["async", "protobuf-codec"], default-features = false }
protobuf = "=2.14.0"
ttrpc = { version = "0.6.0", features = ["async"], default-features = false }
protobuf = "2.23.0"
libc = "0.2.58"
nix = "0.23.0"
capctl = "0.2.0"
@ -31,7 +31,7 @@ futures = "0.3.17"
tokio = { version = "1.14.0", features = ["full"] }
tokio-vsock = "0.3.1"
netlink-sys = { version = "0.7.0", features = ["tokio_socket",]}
netlink-sys = { version = "0.7.0", features = ["tokio_socket"]}
rtnetlink = "0.8.0"
netlink-packet-utils = "0.4.1"
ipnetwork = "0.17.0"

View File

@ -16,7 +16,7 @@ scopeguard = "1.0.0"
capctl = "0.2.0"
lazy_static = "1.3.0"
libc = "0.2.58"
protobuf = "=2.14.0"
protobuf = "2.23.0"
slog = "2.5.2"
slog-scope = "4.1.2"
scan_fmt = "0.2.6"
@ -27,7 +27,7 @@ cgroups = { package = "cgroups-rs", version = "0.2.8" }
rlimit = "0.5.3"
cfg-if = "0.1.0"
tokio = { version = "1.2.0", features = ["sync", "io-util", "process", "time", "macros"] }
tokio = { version = "1.2.0", features = ["sync", "io-util", "process", "time", "macros", "rt"] }
futures = "0.3.17"
async-trait = "0.1.31"
inotify = "0.9.2"

View File

@ -34,6 +34,7 @@ use protocols::health::{
HealthCheckResponse, HealthCheckResponse_ServingStatus, VersionCheckResponse,
};
use protocols::types::Interface;
use protocols::{agent_ttrpc_async as agent_ttrpc, health_ttrpc_async as health_ttrpc};
use rustjail::cgroups::notifier;
use rustjail::container::{BaseContainer, Container, LinuxContainer};
use rustjail::process::Process;
@ -650,7 +651,7 @@ impl AgentService {
}
#[async_trait]
impl protocols::agent_ttrpc::AgentService for AgentService {
impl agent_ttrpc::AgentService for AgentService {
async fn create_container(
&self,
ctx: &TtrpcContext,
@ -1536,7 +1537,7 @@ impl protocols::agent_ttrpc::AgentService for AgentService {
struct HealthService;
#[async_trait]
impl protocols::health_ttrpc::Health for HealthService {
impl health_ttrpc::Health for HealthService {
async fn check(
&self,
_ctx: &TtrpcContext,
@ -1675,18 +1676,17 @@ async fn read_stream(reader: Arc<Mutex<ReadHalf<PipeStream>>>, l: usize) -> Resu
}
pub fn start(s: Arc<Mutex<Sandbox>>, server_address: &str) -> Result<TtrpcServer> {
let agent_service = Box::new(AgentService { sandbox: s })
as Box<dyn protocols::agent_ttrpc::AgentService + Send + Sync>;
let agent_service =
Box::new(AgentService { sandbox: s }) as Box<dyn agent_ttrpc::AgentService + Send + Sync>;
let agent_worker = Arc::new(agent_service);
let health_service =
Box::new(HealthService {}) as Box<dyn protocols::health_ttrpc::Health + Send + Sync>;
let health_service = Box::new(HealthService {}) as Box<dyn health_ttrpc::Health + Send + Sync>;
let health_worker = Arc::new(health_service);
let aservice = protocols::agent_ttrpc::create_agent_service(agent_worker);
let aservice = agent_ttrpc::create_agent_service(agent_worker);
let hservice = protocols::health_ttrpc::create_health(health_worker);
let hservice = health_ttrpc::create_health(health_worker);
let server = TtrpcServer::new()
.bind(server_address)?
@ -2021,7 +2021,7 @@ fn load_kernel_module(module: &protocols::agent::KernelModule) -> Result<()> {
mod tests {
use super::*;
use crate::{
assert_result, namespace::Namespace, protocols::agent_ttrpc::AgentService as _,
assert_result, namespace::Namespace, protocols::agent_ttrpc_async::AgentService as _,
skip_if_not_root,
};
use nix::mount;

38
src/libs/Cargo.lock generated
View File

@ -88,7 +88,7 @@ checksum = "1b827f9d9f6c2fff719d25f5d44cbc8d2ef6df1ef00d055c5c14d5dc25529579"
dependencies = [
"libc",
"log",
"nix 0.23.1",
"nix",
"regex",
]
@ -358,7 +358,7 @@ dependencies = [
"kata-types",
"lazy_static",
"libc",
"nix 0.23.1",
"nix",
"num_cpus",
"oci",
"once_cell",
@ -475,19 +475,6 @@ version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a"
[[package]]
name = "nix"
version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5e06129fb611568ef4e868c14b326274959aa70ff7776e9d55323531c374945"
dependencies = [
"bitflags",
"cc",
"cfg-if",
"libc",
"memoffset",
]
[[package]]
name = "nix"
version = "0.23.1"
@ -670,9 +657,9 @@ dependencies = [
[[package]]
name = "protobuf"
version = "2.14.0"
version = "2.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e86d370532557ae7573551a1ec8235a0f8d6cb276c7c9e6aa490b511c447485"
checksum = "cf7e6d18738ecd0902d30d1ad232c9125985a3422929b16c65517b38adc14f96"
dependencies = [
"serde",
"serde_derive",
@ -680,18 +667,18 @@ dependencies = [
[[package]]
name = "protobuf-codegen"
version = "2.14.0"
version = "2.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de113bba758ccf2c1ef816b127c958001b7831136c9bc3f8e9ec695ac4e82b0c"
checksum = "aec1632b7c8f2e620343439a7dfd1f3c47b18906c4be58982079911482b5d707"
dependencies = [
"protobuf",
]
[[package]]
name = "protobuf-codegen-pure"
version = "2.14.0"
version = "2.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d1a4febc73bf0cada1d77c459a0c8e5973179f1cfd5b0f1ab789d45b17b6440"
checksum = "9f8122fdb18e55190c796b088a16bdb70cd7acdcd48f7a8b796b58c62e532cc6"
dependencies = [
"protobuf",
"protobuf-codegen",
@ -702,6 +689,7 @@ name = "protocols"
version = "0.1.0"
dependencies = [
"async-trait",
"oci",
"protobuf",
"serde",
"serde_json",
@ -1050,16 +1038,16 @@ dependencies = [
[[package]]
name = "ttrpc"
version = "0.5.2"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66a973ce6d5eaa20c173635b29ffb660dafbc7ef109172c0015ba44e47a23711"
checksum = "2ecfff459a859c6ba6668ff72b34c2f1d94d9d58f7088414c2674ad0f31cc7d8"
dependencies = [
"async-trait",
"byteorder",
"futures",
"libc",
"log",
"nix 0.20.2",
"nix",
"protobuf",
"protobuf-codegen-pure",
"thiserror",
@ -1113,7 +1101,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e32675ee2b3ce5df274c0ab52d19b28789632406277ca26bffee79a8e27dc133"
dependencies = [
"libc",
"nix 0.23.1",
"nix",
]
[[package]]

View File

@ -7,13 +7,15 @@ edition = "2018"
[features]
default = []
with-serde = [ "serde", "serde_json" ]
async = ["ttrpc/async", "async-trait"]
[dependencies]
ttrpc = { version = "0.5.0", features = ["async"] }
async-trait = "0.1.42"
protobuf = { version = "=2.14.0", features = ["with-serde"] }
ttrpc = { version = "0.6.0" }
async-trait = { version = "0.1.42", optional = true }
protobuf = { version = "2.23.0", features = ["with-serde"] }
serde = { version = "1.0.130", features = ["derive"], optional = true }
serde_json = { version = "1.0.68", optional = true }
oci = { path = "../oci" }
[build-dependencies]
ttrpc-codegen = "0.2.0"

View File

@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0
//
use std::fs::File;
use std::fs::{self, File};
use std::io::{BufRead, BufReader, Read, Write};
use std::path::Path;
use std::process::exit;
@ -90,17 +90,8 @@ fn handle_file(autogen_comment: &str, rust_filename: &str) -> Result<(), std::io
Ok(())
}
fn real_main() -> Result<(), std::io::Error> {
let autogen_comment = format!("\n//! Generated by {:?} ({:?})", file!(), module_path!());
let protos = vec![
"protos/agent.proto",
"protos/csi.proto",
"protos/google/protobuf/empty.proto",
"protos/health.proto",
"protos/oci.proto",
"protos/types.proto",
];
fn codegen(path: &str, protos: &[&str], async_all: bool) -> Result<(), std::io::Error> {
fs::create_dir_all(path).unwrap();
// Tell Cargo that if the .proto files changed, to rerun this build script.
protos
@ -108,7 +99,7 @@ fn real_main() -> Result<(), std::io::Error> {
.for_each(|p| println!("cargo:rerun-if-changed={}", &p));
let ttrpc_options = Customize {
async_server: true,
async_all,
..Default::default()
};
@ -121,13 +112,14 @@ fn real_main() -> Result<(), std::io::Error> {
Codegen::new()
.out_dir(out_dir)
.inputs(&protos)
.inputs(protos)
.include("protos")
.customize(ttrpc_options)
.rust_protobuf()
.rust_protobuf_customize(protobuf_options)
.run()?;
let autogen_comment = format!("\n//! Generated by {:?} ({:?})", file!(), module_path!());
for file in protos.iter() {
let proto_filename = Path::new(file).file_name().unwrap();
@ -147,6 +139,31 @@ fn real_main() -> Result<(), std::io::Error> {
handle_file(&autogen_comment, out_file_str)?;
}
use_serde(protos, out_dir)?;
Ok(())
}
fn real_main() -> Result<(), std::io::Error> {
codegen(
"src",
&[
"protos/google/protobuf/empty.proto",
"protos/oci.proto",
"protos/types.proto",
],
false,
)?;
// generate async
#[cfg(feature = "async")]
{
codegen("src", &["protos/agent.proto", "protos/health.proto"], true)?;
fs::rename("src/agent_ttrpc.rs", "src/agent_ttrpc_async.rs")?;
fs::rename("src/health_ttrpc.rs", "src/health_ttrpc_async.rs")?;
}
codegen("src", &["protos/agent.proto", "protos/health.proto"], false)?;
// There is a message named 'Box' in oci.proto
// so there is a struct named 'Box', we should replace Box<Self> to ::std::boxed::Box<Self>
// to avoid the conflict.
@ -156,8 +173,6 @@ fn real_main() -> Result<(), std::io::Error> {
"self: ::std::boxed::Box<Self>",
)?;
use_serde(&protos, out_dir)?;
Ok(())
}

View File

@ -0,0 +1,816 @@
// This file is generated by ttrpc-compiler 0.4.1. Do not edit
// @generated
// https://github.com/Manishearth/rust-clippy/issues/702
#![allow(unknown_lints)]
#![allow(clipto_camel_casepy)]
#![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(unsafe_code)]
#![allow(unused_imports)]
#![allow(unused_results)]
use protobuf::{CodedInputStream, CodedOutputStream, Message};
use std::collections::HashMap;
use std::sync::Arc;
use async_trait::async_trait;
#[derive(Clone)]
pub struct AgentServiceClient {
client: ::ttrpc::r#async::Client,
}
impl AgentServiceClient {
pub fn new(client: ::ttrpc::r#async::Client) -> Self {
AgentServiceClient {
client: client,
}
}
pub async fn create_container(&mut self, ctx: ttrpc::context::Context, req: &super::agent::CreateContainerRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "CreateContainer", cres);
}
pub async fn start_container(&mut self, ctx: ttrpc::context::Context, req: &super::agent::StartContainerRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "StartContainer", cres);
}
pub async fn remove_container(&mut self, ctx: ttrpc::context::Context, req: &super::agent::RemoveContainerRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "RemoveContainer", cres);
}
pub async fn exec_process(&mut self, ctx: ttrpc::context::Context, req: &super::agent::ExecProcessRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "ExecProcess", cres);
}
pub async fn signal_process(&mut self, ctx: ttrpc::context::Context, req: &super::agent::SignalProcessRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "SignalProcess", cres);
}
pub async fn wait_process(&mut self, ctx: ttrpc::context::Context, req: &super::agent::WaitProcessRequest) -> ::ttrpc::Result<super::agent::WaitProcessResponse> {
let mut cres = super::agent::WaitProcessResponse::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "WaitProcess", cres);
}
pub async fn update_container(&mut self, ctx: ttrpc::context::Context, req: &super::agent::UpdateContainerRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "UpdateContainer", cres);
}
pub async fn stats_container(&mut self, ctx: ttrpc::context::Context, req: &super::agent::StatsContainerRequest) -> ::ttrpc::Result<super::agent::StatsContainerResponse> {
let mut cres = super::agent::StatsContainerResponse::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "StatsContainer", cres);
}
pub async fn pause_container(&mut self, ctx: ttrpc::context::Context, req: &super::agent::PauseContainerRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "PauseContainer", cres);
}
pub async fn resume_container(&mut self, ctx: ttrpc::context::Context, req: &super::agent::ResumeContainerRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "ResumeContainer", cres);
}
pub async fn write_stdin(&mut self, ctx: ttrpc::context::Context, req: &super::agent::WriteStreamRequest) -> ::ttrpc::Result<super::agent::WriteStreamResponse> {
let mut cres = super::agent::WriteStreamResponse::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "WriteStdin", cres);
}
pub async fn read_stdout(&mut self, ctx: ttrpc::context::Context, req: &super::agent::ReadStreamRequest) -> ::ttrpc::Result<super::agent::ReadStreamResponse> {
let mut cres = super::agent::ReadStreamResponse::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "ReadStdout", cres);
}
pub async fn read_stderr(&mut self, ctx: ttrpc::context::Context, req: &super::agent::ReadStreamRequest) -> ::ttrpc::Result<super::agent::ReadStreamResponse> {
let mut cres = super::agent::ReadStreamResponse::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "ReadStderr", cres);
}
pub async fn close_stdin(&mut self, ctx: ttrpc::context::Context, req: &super::agent::CloseStdinRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "CloseStdin", cres);
}
pub async fn tty_win_resize(&mut self, ctx: ttrpc::context::Context, req: &super::agent::TtyWinResizeRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "TtyWinResize", cres);
}
pub async fn update_interface(&mut self, ctx: ttrpc::context::Context, req: &super::agent::UpdateInterfaceRequest) -> ::ttrpc::Result<super::types::Interface> {
let mut cres = super::types::Interface::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "UpdateInterface", cres);
}
pub async fn update_routes(&mut self, ctx: ttrpc::context::Context, req: &super::agent::UpdateRoutesRequest) -> ::ttrpc::Result<super::agent::Routes> {
let mut cres = super::agent::Routes::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "UpdateRoutes", cres);
}
pub async fn list_interfaces(&mut self, ctx: ttrpc::context::Context, req: &super::agent::ListInterfacesRequest) -> ::ttrpc::Result<super::agent::Interfaces> {
let mut cres = super::agent::Interfaces::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "ListInterfaces", cres);
}
pub async fn list_routes(&mut self, ctx: ttrpc::context::Context, req: &super::agent::ListRoutesRequest) -> ::ttrpc::Result<super::agent::Routes> {
let mut cres = super::agent::Routes::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "ListRoutes", cres);
}
pub async fn add_arp_neighbors(&mut self, ctx: ttrpc::context::Context, req: &super::agent::AddARPNeighborsRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "AddARPNeighbors", cres);
}
pub async fn get_ip_tables(&mut self, ctx: ttrpc::context::Context, req: &super::agent::GetIPTablesRequest) -> ::ttrpc::Result<super::agent::GetIPTablesResponse> {
let mut cres = super::agent::GetIPTablesResponse::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "GetIPTables", cres);
}
pub async fn set_ip_tables(&mut self, ctx: ttrpc::context::Context, req: &super::agent::SetIPTablesRequest) -> ::ttrpc::Result<super::agent::SetIPTablesResponse> {
let mut cres = super::agent::SetIPTablesResponse::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "SetIPTables", cres);
}
pub async fn get_metrics(&mut self, ctx: ttrpc::context::Context, req: &super::agent::GetMetricsRequest) -> ::ttrpc::Result<super::agent::Metrics> {
let mut cres = super::agent::Metrics::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "GetMetrics", cres);
}
pub async fn create_sandbox(&mut self, ctx: ttrpc::context::Context, req: &super::agent::CreateSandboxRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "CreateSandbox", cres);
}
pub async fn destroy_sandbox(&mut self, ctx: ttrpc::context::Context, req: &super::agent::DestroySandboxRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "DestroySandbox", cres);
}
pub async fn online_cpu_mem(&mut self, ctx: ttrpc::context::Context, req: &super::agent::OnlineCPUMemRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "OnlineCPUMem", cres);
}
pub async fn reseed_random_dev(&mut self, ctx: ttrpc::context::Context, req: &super::agent::ReseedRandomDevRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "ReseedRandomDev", cres);
}
pub async fn get_guest_details(&mut self, ctx: ttrpc::context::Context, req: &super::agent::GuestDetailsRequest) -> ::ttrpc::Result<super::agent::GuestDetailsResponse> {
let mut cres = super::agent::GuestDetailsResponse::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "GetGuestDetails", cres);
}
pub async fn mem_hotplug_by_probe(&mut self, ctx: ttrpc::context::Context, req: &super::agent::MemHotplugByProbeRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "MemHotplugByProbe", cres);
}
pub async fn set_guest_date_time(&mut self, ctx: ttrpc::context::Context, req: &super::agent::SetGuestDateTimeRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "SetGuestDateTime", cres);
}
pub async fn copy_file(&mut self, ctx: ttrpc::context::Context, req: &super::agent::CopyFileRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "CopyFile", cres);
}
pub async fn get_oom_event(&mut self, ctx: ttrpc::context::Context, req: &super::agent::GetOOMEventRequest) -> ::ttrpc::Result<super::agent::OOMEvent> {
let mut cres = super::agent::OOMEvent::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "GetOOMEvent", cres);
}
pub async fn add_swap(&mut self, ctx: ttrpc::context::Context, req: &super::agent::AddSwapRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "AddSwap", cres);
}
pub async fn get_volume_stats(&mut self, ctx: ttrpc::context::Context, req: &super::agent::VolumeStatsRequest) -> ::ttrpc::Result<super::csi::VolumeStatsResponse> {
let mut cres = super::csi::VolumeStatsResponse::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "GetVolumeStats", cres);
}
pub async fn resize_volume(&mut self, ctx: ttrpc::context::Context, req: &super::agent::ResizeVolumeRequest) -> ::ttrpc::Result<super::empty::Empty> {
let mut cres = super::empty::Empty::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.AgentService", "ResizeVolume", cres);
}
}
struct CreateContainerMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for CreateContainerMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, CreateContainerRequest, create_container);
}
}
struct StartContainerMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for StartContainerMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, StartContainerRequest, start_container);
}
}
struct RemoveContainerMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for RemoveContainerMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, RemoveContainerRequest, remove_container);
}
}
struct ExecProcessMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for ExecProcessMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, ExecProcessRequest, exec_process);
}
}
struct SignalProcessMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for SignalProcessMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, SignalProcessRequest, signal_process);
}
}
struct WaitProcessMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for WaitProcessMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, WaitProcessRequest, wait_process);
}
}
struct UpdateContainerMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for UpdateContainerMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, UpdateContainerRequest, update_container);
}
}
struct StatsContainerMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for StatsContainerMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, StatsContainerRequest, stats_container);
}
}
struct PauseContainerMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for PauseContainerMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, PauseContainerRequest, pause_container);
}
}
struct ResumeContainerMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for ResumeContainerMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, ResumeContainerRequest, resume_container);
}
}
struct WriteStdinMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for WriteStdinMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, WriteStreamRequest, write_stdin);
}
}
struct ReadStdoutMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for ReadStdoutMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, ReadStreamRequest, read_stdout);
}
}
struct ReadStderrMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for ReadStderrMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, ReadStreamRequest, read_stderr);
}
}
struct CloseStdinMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for CloseStdinMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, CloseStdinRequest, close_stdin);
}
}
struct TtyWinResizeMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for TtyWinResizeMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, TtyWinResizeRequest, tty_win_resize);
}
}
struct UpdateInterfaceMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for UpdateInterfaceMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, UpdateInterfaceRequest, update_interface);
}
}
struct UpdateRoutesMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for UpdateRoutesMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, UpdateRoutesRequest, update_routes);
}
}
struct ListInterfacesMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for ListInterfacesMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, ListInterfacesRequest, list_interfaces);
}
}
struct ListRoutesMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for ListRoutesMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, ListRoutesRequest, list_routes);
}
}
struct AddArpNeighborsMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for AddArpNeighborsMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, AddARPNeighborsRequest, add_arp_neighbors);
}
}
struct GetIpTablesMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for GetIpTablesMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, GetIPTablesRequest, get_ip_tables);
}
}
struct SetIpTablesMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for SetIpTablesMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, SetIPTablesRequest, set_ip_tables);
}
}
struct GetMetricsMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for GetMetricsMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, GetMetricsRequest, get_metrics);
}
}
struct CreateSandboxMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for CreateSandboxMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, CreateSandboxRequest, create_sandbox);
}
}
struct DestroySandboxMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for DestroySandboxMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, DestroySandboxRequest, destroy_sandbox);
}
}
struct OnlineCpuMemMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for OnlineCpuMemMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, OnlineCPUMemRequest, online_cpu_mem);
}
}
struct ReseedRandomDevMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for ReseedRandomDevMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, ReseedRandomDevRequest, reseed_random_dev);
}
}
struct GetGuestDetailsMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for GetGuestDetailsMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, GuestDetailsRequest, get_guest_details);
}
}
struct MemHotplugByProbeMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for MemHotplugByProbeMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, MemHotplugByProbeRequest, mem_hotplug_by_probe);
}
}
struct SetGuestDateTimeMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for SetGuestDateTimeMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, SetGuestDateTimeRequest, set_guest_date_time);
}
}
struct CopyFileMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for CopyFileMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, CopyFileRequest, copy_file);
}
}
struct GetOomEventMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for GetOomEventMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, GetOOMEventRequest, get_oom_event);
}
}
struct AddSwapMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for AddSwapMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, AddSwapRequest, add_swap);
}
}
struct GetVolumeStatsMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for GetVolumeStatsMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, VolumeStatsRequest, get_volume_stats);
}
}
struct ResizeVolumeMethod {
service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for ResizeVolumeMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, agent, ResizeVolumeRequest, resize_volume);
}
}
#[async_trait]
pub trait AgentService: Sync {
async fn create_container(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::CreateContainerRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/CreateContainer is not supported".to_string())))
}
async fn start_container(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::StartContainerRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/StartContainer is not supported".to_string())))
}
async fn remove_container(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::RemoveContainerRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/RemoveContainer is not supported".to_string())))
}
async fn exec_process(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::ExecProcessRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/ExecProcess is not supported".to_string())))
}
async fn signal_process(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::SignalProcessRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/SignalProcess is not supported".to_string())))
}
async fn wait_process(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::WaitProcessRequest) -> ::ttrpc::Result<super::agent::WaitProcessResponse> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/WaitProcess is not supported".to_string())))
}
async fn update_container(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::UpdateContainerRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/UpdateContainer is not supported".to_string())))
}
async fn stats_container(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::StatsContainerRequest) -> ::ttrpc::Result<super::agent::StatsContainerResponse> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/StatsContainer is not supported".to_string())))
}
async fn pause_container(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::PauseContainerRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/PauseContainer is not supported".to_string())))
}
async fn resume_container(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::ResumeContainerRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/ResumeContainer is not supported".to_string())))
}
async fn write_stdin(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::WriteStreamRequest) -> ::ttrpc::Result<super::agent::WriteStreamResponse> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/WriteStdin is not supported".to_string())))
}
async fn read_stdout(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::ReadStreamRequest) -> ::ttrpc::Result<super::agent::ReadStreamResponse> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/ReadStdout is not supported".to_string())))
}
async fn read_stderr(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::ReadStreamRequest) -> ::ttrpc::Result<super::agent::ReadStreamResponse> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/ReadStderr is not supported".to_string())))
}
async fn close_stdin(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::CloseStdinRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/CloseStdin is not supported".to_string())))
}
async fn tty_win_resize(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::TtyWinResizeRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/TtyWinResize is not supported".to_string())))
}
async fn update_interface(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::UpdateInterfaceRequest) -> ::ttrpc::Result<super::types::Interface> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/UpdateInterface is not supported".to_string())))
}
async fn update_routes(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::UpdateRoutesRequest) -> ::ttrpc::Result<super::agent::Routes> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/UpdateRoutes is not supported".to_string())))
}
async fn list_interfaces(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::ListInterfacesRequest) -> ::ttrpc::Result<super::agent::Interfaces> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/ListInterfaces is not supported".to_string())))
}
async fn list_routes(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::ListRoutesRequest) -> ::ttrpc::Result<super::agent::Routes> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/ListRoutes is not supported".to_string())))
}
async fn add_arp_neighbors(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::AddARPNeighborsRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/AddARPNeighbors is not supported".to_string())))
}
async fn get_ip_tables(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::GetIPTablesRequest) -> ::ttrpc::Result<super::agent::GetIPTablesResponse> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/GetIPTables is not supported".to_string())))
}
async fn set_ip_tables(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::SetIPTablesRequest) -> ::ttrpc::Result<super::agent::SetIPTablesResponse> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/SetIPTables is not supported".to_string())))
}
async fn get_metrics(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::GetMetricsRequest) -> ::ttrpc::Result<super::agent::Metrics> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/GetMetrics is not supported".to_string())))
}
async fn create_sandbox(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::CreateSandboxRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/CreateSandbox is not supported".to_string())))
}
async fn destroy_sandbox(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::DestroySandboxRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/DestroySandbox is not supported".to_string())))
}
async fn online_cpu_mem(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::OnlineCPUMemRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/OnlineCPUMem is not supported".to_string())))
}
async fn reseed_random_dev(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::ReseedRandomDevRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/ReseedRandomDev is not supported".to_string())))
}
async fn get_guest_details(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::GuestDetailsRequest) -> ::ttrpc::Result<super::agent::GuestDetailsResponse> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/GetGuestDetails is not supported".to_string())))
}
async fn mem_hotplug_by_probe(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::MemHotplugByProbeRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/MemHotplugByProbe is not supported".to_string())))
}
async fn set_guest_date_time(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::SetGuestDateTimeRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/SetGuestDateTime is not supported".to_string())))
}
async fn copy_file(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::CopyFileRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/CopyFile is not supported".to_string())))
}
async fn get_oom_event(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::GetOOMEventRequest) -> ::ttrpc::Result<super::agent::OOMEvent> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/GetOOMEvent is not supported".to_string())))
}
async fn add_swap(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::AddSwapRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/AddSwap is not supported".to_string())))
}
async fn get_volume_stats(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::VolumeStatsRequest) -> ::ttrpc::Result<super::csi::VolumeStatsResponse> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/GetVolumeStats is not supported".to_string())))
}
async fn resize_volume(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::agent::ResizeVolumeRequest) -> ::ttrpc::Result<super::empty::Empty> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.AgentService/ResizeVolume is not supported".to_string())))
}
}
pub fn create_agent_service(service: Arc<std::boxed::Box<dyn AgentService + Send + Sync>>) -> HashMap <String, Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>> {
let mut methods = HashMap::new();
methods.insert("/grpc.AgentService/CreateContainer".to_string(),
std::boxed::Box::new(CreateContainerMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/StartContainer".to_string(),
std::boxed::Box::new(StartContainerMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/RemoveContainer".to_string(),
std::boxed::Box::new(RemoveContainerMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/ExecProcess".to_string(),
std::boxed::Box::new(ExecProcessMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/SignalProcess".to_string(),
std::boxed::Box::new(SignalProcessMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/WaitProcess".to_string(),
std::boxed::Box::new(WaitProcessMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/UpdateContainer".to_string(),
std::boxed::Box::new(UpdateContainerMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/StatsContainer".to_string(),
std::boxed::Box::new(StatsContainerMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/PauseContainer".to_string(),
std::boxed::Box::new(PauseContainerMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/ResumeContainer".to_string(),
std::boxed::Box::new(ResumeContainerMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/WriteStdin".to_string(),
std::boxed::Box::new(WriteStdinMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/ReadStdout".to_string(),
std::boxed::Box::new(ReadStdoutMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/ReadStderr".to_string(),
std::boxed::Box::new(ReadStderrMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/CloseStdin".to_string(),
std::boxed::Box::new(CloseStdinMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/TtyWinResize".to_string(),
std::boxed::Box::new(TtyWinResizeMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/UpdateInterface".to_string(),
std::boxed::Box::new(UpdateInterfaceMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/UpdateRoutes".to_string(),
std::boxed::Box::new(UpdateRoutesMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/ListInterfaces".to_string(),
std::boxed::Box::new(ListInterfacesMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/ListRoutes".to_string(),
std::boxed::Box::new(ListRoutesMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/AddARPNeighbors".to_string(),
std::boxed::Box::new(AddArpNeighborsMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/GetIPTables".to_string(),
std::boxed::Box::new(GetIpTablesMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/SetIPTables".to_string(),
std::boxed::Box::new(SetIpTablesMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/GetMetrics".to_string(),
std::boxed::Box::new(GetMetricsMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/CreateSandbox".to_string(),
std::boxed::Box::new(CreateSandboxMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/DestroySandbox".to_string(),
std::boxed::Box::new(DestroySandboxMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/OnlineCPUMem".to_string(),
std::boxed::Box::new(OnlineCpuMemMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/ReseedRandomDev".to_string(),
std::boxed::Box::new(ReseedRandomDevMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/GetGuestDetails".to_string(),
std::boxed::Box::new(GetGuestDetailsMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/MemHotplugByProbe".to_string(),
std::boxed::Box::new(MemHotplugByProbeMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/SetGuestDateTime".to_string(),
std::boxed::Box::new(SetGuestDateTimeMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/CopyFile".to_string(),
std::boxed::Box::new(CopyFileMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/GetOOMEvent".to_string(),
std::boxed::Box::new(GetOomEventMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/AddSwap".to_string(),
std::boxed::Box::new(AddSwapMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/GetVolumeStats".to_string(),
std::boxed::Box::new(GetVolumeStatsMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.AgentService/ResizeVolume".to_string(),
std::boxed::Box::new(ResizeVolumeMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods
}

View File

@ -0,0 +1,90 @@
// This file is generated by ttrpc-compiler 0.4.1. Do not edit
// @generated
// https://github.com/Manishearth/rust-clippy/issues/702
#![allow(unknown_lints)]
#![allow(clipto_camel_casepy)]
#![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(unsafe_code)]
#![allow(unused_imports)]
#![allow(unused_results)]
use protobuf::{CodedInputStream, CodedOutputStream, Message};
use std::collections::HashMap;
use std::sync::Arc;
use async_trait::async_trait;
#[derive(Clone)]
pub struct HealthClient {
client: ::ttrpc::r#async::Client,
}
impl HealthClient {
pub fn new(client: ::ttrpc::r#async::Client) -> Self {
HealthClient {
client: client,
}
}
pub async fn check(&mut self, ctx: ttrpc::context::Context, req: &super::health::CheckRequest) -> ::ttrpc::Result<super::health::HealthCheckResponse> {
let mut cres = super::health::HealthCheckResponse::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.Health", "Check", cres);
}
pub async fn version(&mut self, ctx: ttrpc::context::Context, req: &super::health::CheckRequest) -> ::ttrpc::Result<super::health::VersionCheckResponse> {
let mut cres = super::health::VersionCheckResponse::new();
::ttrpc::async_client_request!(self, ctx, req, "grpc.Health", "Version", cres);
}
}
struct CheckMethod {
service: Arc<std::boxed::Box<dyn Health + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for CheckMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, health, CheckRequest, check);
}
}
struct VersionMethod {
service: Arc<std::boxed::Box<dyn Health + Send + Sync>>,
}
#[async_trait]
impl ::ttrpc::r#async::MethodHandler for VersionMethod {
async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<(u32, Vec<u8>)> {
::ttrpc::async_request_handler!(self, ctx, req, health, CheckRequest, version);
}
}
#[async_trait]
pub trait Health: Sync {
async fn check(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::health::CheckRequest) -> ::ttrpc::Result<super::health::HealthCheckResponse> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.Health/Check is not supported".to_string())))
}
async fn version(&self, _ctx: &::ttrpc::r#async::TtrpcContext, _req: super::health::CheckRequest) -> ::ttrpc::Result<super::health::VersionCheckResponse> {
Err(::ttrpc::Error::RpcStatus(::ttrpc::get_status(::ttrpc::Code::NOT_FOUND, "/grpc.Health/Version is not supported".to_string())))
}
}
pub fn create_health(service: Arc<std::boxed::Box<dyn Health + Send + Sync>>) -> HashMap <String, Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>> {
let mut methods = HashMap::new();
methods.insert("/grpc.Health/Check".to_string(),
std::boxed::Box::new(CheckMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods.insert("/grpc.Health/Version".to_string(),
std::boxed::Box::new(VersionMethod{service: service.clone()}) as std::boxed::Box<dyn ::ttrpc::r#async::MethodHandler + Send + Sync>);
methods
}

View File

@ -7,9 +7,14 @@
pub mod agent;
pub mod agent_ttrpc;
#[cfg(feature = "async")]
pub mod agent_ttrpc_async;
pub mod csi;
pub mod empty;
pub mod health;
pub mod health_ttrpc;
#[cfg(feature = "async")]
pub mod health_ttrpc_async;
pub mod oci;
pub mod trans;
pub mod types;

File diff suppressed because it is too large Load Diff

View File

@ -72,16 +72,6 @@ version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "bytes"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c"
dependencies = [
"byteorder",
"iovec",
]
[[package]]
name = "bytes"
version = "1.1.0"
@ -129,7 +119,7 @@ checksum = "1b827f9d9f6c2fff719d25f5d44cbc8d2ef6df1ef00d055c5c14d5dc25529579"
dependencies = [
"libc",
"log",
"nix 0.23.1",
"nix",
"regex",
]
@ -398,15 +388,6 @@ dependencies = [
"libc",
]
[[package]]
name = "iovec"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
dependencies = [
"libc",
]
[[package]]
name = "itertools"
version = "0.10.3"
@ -434,7 +415,7 @@ dependencies = [
"lazy_static",
"libc",
"logging",
"nix 0.23.1",
"nix",
"oci",
"protobuf",
"protocols",
@ -522,19 +503,6 @@ version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a"
[[package]]
name = "nix"
version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5e06129fb611568ef4e868c14b326274959aa70ff7776e9d55323531c374945"
dependencies = [
"bitflags",
"cc",
"cfg-if",
"libc",
"memoffset",
]
[[package]]
name = "nix"
version = "0.23.1"
@ -666,7 +634,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020"
dependencies = [
"bytes 1.1.0",
"bytes",
"prost-derive",
]
@ -676,7 +644,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603"
dependencies = [
"bytes 1.1.0",
"bytes",
"heck",
"itertools",
"log",
@ -707,15 +675,15 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b"
dependencies = [
"bytes 1.1.0",
"bytes",
"prost",
]
[[package]]
name = "protobuf"
version = "2.14.0"
version = "2.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e86d370532557ae7573551a1ec8235a0f8d6cb276c7c9e6aa490b511c447485"
checksum = "cf7e6d18738ecd0902d30d1ad232c9125985a3422929b16c65517b38adc14f96"
dependencies = [
"serde",
"serde_derive",
@ -723,18 +691,18 @@ dependencies = [
[[package]]
name = "protobuf-codegen"
version = "2.14.0"
version = "2.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de113bba758ccf2c1ef816b127c958001b7831136c9bc3f8e9ec695ac4e82b0c"
checksum = "aec1632b7c8f2e620343439a7dfd1f3c47b18906c4be58982079911482b5d707"
dependencies = [
"protobuf",
]
[[package]]
name = "protobuf-codegen-pure"
version = "2.14.0"
version = "2.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d1a4febc73bf0cada1d77c459a0c8e5973179f1cfd5b0f1ab789d45b17b6440"
checksum = "9f8122fdb18e55190c796b088a16bdb70cd7acdcd48f7a8b796b58c62e532cc6"
dependencies = [
"protobuf",
"protobuf-codegen",
@ -744,7 +712,7 @@ dependencies = [
name = "protocols"
version = "0.1.0"
dependencies = [
"async-trait",
"oci",
"protobuf",
"serde",
"serde_json",
@ -858,7 +826,7 @@ dependencies = [
"inotify",
"lazy_static",
"libc",
"nix 0.23.1",
"nix",
"oci",
"path-absolutize",
"protobuf",
@ -1080,7 +1048,7 @@ version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbbf1c778ec206785635ce8ad57fe52b3009ae9e0c9f574a728f3049d3e55838"
dependencies = [
"bytes 1.1.0",
"bytes",
"libc",
"memchr",
"mio",
@ -1102,36 +1070,19 @@ dependencies = [
"syn",
]
[[package]]
name = "tokio-vsock"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e0723fc001950a3b018947b05eeb45014fd2b7c6e8f292502193ab74486bdb6"
dependencies = [
"bytes 0.4.12",
"futures",
"libc",
"tokio",
"vsock",
]
[[package]]
name = "ttrpc"
version = "0.5.2"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66a973ce6d5eaa20c173635b29ffb660dafbc7ef109172c0015ba44e47a23711"
checksum = "0c7d6c992964a013c17814c08d31708d577b0aae44ebadb58755659dd824c2d1"
dependencies = [
"async-trait",
"byteorder",
"futures",
"libc",
"log",
"nix 0.20.2",
"nix",
"protobuf",
"protobuf-codegen-pure",
"thiserror",
"tokio",
"tokio-vsock",
]
[[package]]
@ -1185,16 +1136,6 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "vsock"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e32675ee2b3ce5df274c0ab52d19b28789632406277ca26bffee79a8e27dc133"
dependencies = [
"libc",
"nix 0.23.1",
]
[[package]]
name = "wasi"
version = "0.10.2+wasi-snapshot-preview1"

View File

@ -31,7 +31,7 @@ protobuf = "2.14.0"
nix = "0.23.0"
libc = "0.2.112"
# XXX: Must be the same as the version used by the agent
ttrpc = { version = "0.5.2" }
ttrpc = { version = "0.6.0" }
# For parsing timeouts
humantime = "2.1.0"

View File

@ -561,7 +561,7 @@ fn create_ttrpc_client(
}
};
Ok(ttrpc::client::Client::new(fd))
Ok(ttrpc::Client::new(fd))
}
fn kata_service_agent(

View File

@ -181,11 +181,11 @@ fn connect(name: &str, global_args: clap::ArgMatches) -> Result<()> {
let cfg = Config {
server_address,
bundle_dir,
interactive,
ignore_errors,
timeout_nano,
hybrid_vsock_port,
interactive,
hybrid_vsock,
ignore_errors,
no_auto_values,
};

View File

@ -203,11 +203,7 @@ pub fn get_option(name: &str, options: &mut Options, args: &str) -> Result<Strin
"exec_id" => {
msg = "derived";
match options.get("cid") {
Some(value) => value,
None => "",
}
.into()
options.get("cid").unwrap_or(&"".to_string()).into()
}
_ => "".into(),
};