Simpify Config transmission mode
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
This commit is contained in:
parent
620ce26d59
commit
db4e648261
|
|
@ -19,5 +19,5 @@ mod service;
|
|||
use crate::service::Service;
|
||||
|
||||
fn main() {
|
||||
containerd_shim::run::<Service>("io.containerd.runc.v2", Vec::new())
|
||||
containerd_shim::run::<Service>("io.containerd.runc.v2", None)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,5 +79,5 @@ impl shim::Task for Service {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
shim::run::<Service>("io.containerd.empty.v1", Vec::new())
|
||||
shim::run::<Service>("io.containerd.empty.v1", None)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ pub trait Shim {
|
|||
}
|
||||
|
||||
/// Shim entry point that must be invoked from `main`.
|
||||
pub fn run<T>(runtime_id: &str, opts: Vec<fn(&mut Config)>)
|
||||
pub fn run<T>(runtime_id: &str, opts:Option<Config>)
|
||||
where
|
||||
T: Shim + Send + Sync + 'static,
|
||||
{
|
||||
|
|
@ -196,7 +196,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
fn bootstrap<T>(runtime_id: &str, opts: Vec<fn(&mut Config)>) -> Result<()>
|
||||
fn bootstrap<T>(runtime_id: &str, opts: Option<Config>) -> Result<()>
|
||||
where
|
||||
T: Shim + Send + Sync + 'static,
|
||||
{
|
||||
|
|
@ -208,8 +208,7 @@ where
|
|||
let publisher = publisher::RemotePublisher::new(&ttrpc_address)?;
|
||||
|
||||
// Create shim instance
|
||||
let mut config = Config::default();
|
||||
opts.iter().for_each(|f| f(&mut config));
|
||||
let mut config = opts.unwrap_or_else(Config::default);
|
||||
|
||||
// Setup signals
|
||||
let signals = setup_signals(&config);
|
||||
|
|
|
|||
Loading…
Reference in New Issue