From cad12b1787fd89a5f956b7fefabd1c3df6f1875f Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Thu, 17 Nov 2022 16:11:18 +0100 Subject: [PATCH] Add support for `pause` This experiment adds support for running a global shared pause instance side by side to `conmonrs`. The idea is that this instance keeps the required namespaces open and provides them as part of the container creation response to the consumers. Signed-off-by: Sascha Grunert --- .golangci.yml | 2 +- Cargo.lock | 12 + conmon-rs/common/proto/conmon.capnp | 13 + conmon-rs/server/Cargo.toml | 2 + conmon-rs/server/src/config.rs | 5 + conmon-rs/server/src/lib.rs | 1 + conmon-rs/server/src/listener.rs | 2 +- conmon-rs/server/src/pause.rs | 183 +++++ conmon-rs/server/src/rpc.rs | 25 + conmon-rs/server/src/server.rs | 10 + internal/proto/conmon.capnp.go | 1067 ++++++++++++++++++--------- pkg/client/client.go | 67 ++ 12 files changed, 1055 insertions(+), 334 deletions(-) create mode 100644 conmon-rs/server/src/pause.rs diff --git a/.golangci.yml b/.golangci.yml index 59b7a9e043..6cc9719a0d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -102,7 +102,7 @@ linters-settings: cyclop: max-complexity: 20 gocognit: - min-complexity: 30 + min-complexity: 35 nestif: min-complexity: 15 errcheck: diff --git a/Cargo.lock b/Cargo.lock index 7f3277f9d7..fb22e9c0b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -282,6 +282,7 @@ dependencies = [ "multimap", "nix 0.25.0", "notify", + "once_cell", "opentelemetry", "opentelemetry-otlp", "opentelemetry-semantic-conventions", @@ -291,6 +292,7 @@ dependencies = [ "serde", "serde_json", "shadow-rs", + "signal-hook", "strum", "tempfile", "time", @@ -1789,6 +1791,16 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "signal-hook" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d" +dependencies = [ + "libc", + "signal-hook-registry", +] + [[package]] name = "signal-hook-registry" version = "1.4.0" diff --git a/conmon-rs/common/proto/conmon.capnp b/conmon-rs/common/proto/conmon.capnp index 411b9c0bab..b87e4bb9d9 100644 --- a/conmon-rs/common/proto/conmon.capnp +++ b/conmon-rs/common/proto/conmon.capnp @@ -57,6 +57,7 @@ interface Conmon { struct CreateContainerResponse { containerPid @0 :UInt32; + namespacesPath @1 :Text; } createContainer @1 (request: CreateContainerRequest) -> (response: CreateContainerResponse); @@ -120,4 +121,16 @@ interface Conmon { } setWindowSizeContainer @5 (request: SetWindowSizeRequest) -> (response: SetWindowSizeResponse); + + ############################################### + # CreateNamespaces + struct CreateNamespacesRequest { + metadata @0 :Data; + } + + struct CreateNamespacesResponse { + path @0 :Text; + } + + createNamespaces @6 (request: CreateNamespacesRequest) -> (response: CreateNamespacesResponse); } diff --git a/conmon-rs/server/Cargo.toml b/conmon-rs/server/Cargo.toml index 6f24f9e085..128c2fb6d9 100644 --- a/conmon-rs/server/Cargo.toml +++ b/conmon-rs/server/Cargo.toml @@ -22,6 +22,7 @@ memchr = "2.5.0" multimap = "0.8.3" nix = "0.25.0" notify = "5.0.0" +once_cell = "1.16.0" opentelemetry = { version = "0.18.0", features = ["rt-tokio"] } opentelemetry-otlp = "0.11.0" opentelemetry-semantic-conventions = "0.10.0" @@ -31,6 +32,7 @@ sendfd = { version = "0.4.3", features = ["tokio"] } serde = { version = "1.0.147", features = ["derive"] } serde_json = "1.0.87" shadow-rs = "=0.16.1" +signal-hook = "0.3.14" strum = { version = "0.24.1", features = ["derive"] } tempfile = "3.3.0" tokio = { version = "1.21.2", features = ["fs", "io-std", "io-util", "macros", "net", "process", "rt", "rt-multi-thread", "signal", "time"] } diff --git a/conmon-rs/server/src/config.rs b/conmon-rs/server/src/config.rs index 98f99edcfa..2bf8bb6cf3 100644 --- a/conmon-rs/server/src/config.rs +++ b/conmon-rs/server/src/config.rs @@ -33,6 +33,11 @@ pub struct Config { /// Show version information, specify "full" for verbose output. version: Option, + #[get = "pub"] + #[clap(long("pause"), short('p'), value_name("PATH"))] + /// Run the pause process instead of the server. + pause: Option, + #[get = "pub"] #[clap( default_value_t, diff --git a/conmon-rs/server/src/lib.rs b/conmon-rs/server/src/lib.rs index 35645b796e..796f044caa 100644 --- a/conmon-rs/server/src/lib.rs +++ b/conmon-rs/server/src/lib.rs @@ -15,6 +15,7 @@ mod init; mod journal; mod listener; mod oom_watcher; +mod pause; mod rpc; mod server; mod streams; diff --git a/conmon-rs/server/src/listener.rs b/conmon-rs/server/src/listener.rs index 5b8f703a46..b68d95ccbb 100644 --- a/conmon-rs/server/src/listener.rs +++ b/conmon-rs/server/src/listener.rs @@ -73,7 +73,7 @@ pub struct DefaultListener; impl ListenerImpl for DefaultListener { fn bind(&self, path: &Path) -> io::Result { - UnixListener::bind(&path) + UnixListener::bind(path) } fn create_dir_all(&self, path: &Path) -> io::Result<()> { diff --git a/conmon-rs/server/src/pause.rs b/conmon-rs/server/src/pause.rs new file mode 100644 index 0000000000..de06ca8ef3 --- /dev/null +++ b/conmon-rs/server/src/pause.rs @@ -0,0 +1,183 @@ +use anyhow::{bail, Context, Result}; +use getset::{CopyGetters, Getters}; +use libc::pid_t; +use nix::{ + mount::{mount, umount, MsFlags}, + sched::{unshare, CloneFlags}, + sys::signal::{kill, Signal}, + unistd::{fork, ForkResult, Pid}, +}; +use once_cell::sync::OnceCell; +use signal_hook::{consts::TERM_SIGNALS, iterator::Signals}; +use std::{ + env, + fs::{self, File}, + io::Write, + path::{Path, PathBuf}, + process::{exit, Command}, +}; +use strum::{AsRefStr, Display, EnumIter, EnumString, IntoEnumIterator, IntoStaticStr}; +use tracing::{debug, error, info}; +use uuid::Uuid; + +/// The main structure for this module. +#[derive(Debug, CopyGetters, Getters)] +pub struct Pause { + #[get = "pub"] + path: PathBuf, + + #[get_copy] + pid: Pid, +} + +/// The global shared multiple pause instance. +static PAUSE: OnceCell = OnceCell::new(); + +/// The global path for storing bin mounted namespaces. +const PAUSE_PATH: &str = "/var/run/conmonrs"; + +/// The file path for storing the pause PID. +const PAUSE_PID_FILE: &str = ".pause_pid"; + +impl Pause { + /// Retrieve the global instance of pause + pub fn shared() -> Result<&'static Pause> { + PAUSE.get_or_try_init(|| Self::init().context("init pause")) + } + + /// Retrieve the global instance of pause if initialized. + pub fn maybe_shared() -> Option<&'static Pause> { + PAUSE.get() + } + + /// Stop the global pause instance. + pub fn stop(&self) { + info!("Stopping pause"); + for namespace in Namespace::iter() { + if let Err(e) = namespace.umount(self.path()) { + debug!("Unable to umount namespace {namespace}: {:#}", e); + } + } + if let Err(e) = fs::remove_dir_all(self.path()) { + error!( + "Unable to remove pause path {}: {:#}", + self.path().display(), + e + ); + } + + info!("Killing pause PID: {}", self.pid()); + if let Err(e) = kill(self.pid(), Signal::SIGTERM) { + error!("Unable to kill pause PID {}: {:#}", self.pid(), e); + } + } + + /// Initialize a new pause instance. + fn init() -> Result { + debug!("Initializing pause"); + + let path = PathBuf::from(PAUSE_PATH).join(Uuid::new_v4().to_string()); + fs::create_dir_all(&path).context("create base path")?; + + let program = env::args().next().context("no args set")?; + let mut child = Command::new(program) + .arg("-p") + .arg(&path) + .spawn() + .context("run pause")?; + + let status = child.wait().context("wait for pause child")?; + if !status.success() { + bail!("exit status not ok: {status}") + } + + let pid = fs::read_to_string(path.join(PAUSE_PID_FILE)) + .context("read pause PID path")? + .trim() + .parse::() + .context("parse pause PID")?; + info!("Pause PID is: {pid}"); + + Ok(Self { + path, + pid: Pid::from_raw(pid as pid_t), + }) + } + + /// Run a new pause instance. + pub fn run>(path: T) -> Result<()> { + let flags = CloneFlags::CLONE_NEWPID + | CloneFlags::CLONE_NEWIPC + | CloneFlags::CLONE_NEWNET + | CloneFlags::CLONE_NEWUTS; + + unshare(flags).context("unshare with clone flags")?; + + match unsafe { fork().context("forking process")? } { + ForkResult::Parent { child } => { + let mut file = File::create(path.as_ref().join(PAUSE_PID_FILE)) + .context("create pause PID file")?; + write!(file, "{child}").context("write child to pause file")?; + exit(0); + } + ForkResult::Child => (), + } + + for namespace in Namespace::iter() { + namespace + .bind(path.as_ref()) + .context("bind namespace to {path}")?; + } + + let mut signals = Signals::new(TERM_SIGNALS).context("register signals")?; + signals.forever().next().context("no signal number")?; + Ok(()) + } +} + +#[derive( + AsRefStr, Clone, Copy, Debug, Display, EnumIter, EnumString, Eq, IntoStaticStr, PartialEq, +)] +#[strum(serialize_all = "lowercase")] +/// All available linux namespaces. +enum Namespace { + /// The PID namespace. The child process becomes PID 1. + Pid, + + /// IPC namespace. This creates new namespace for System V IPC POSIX message queues and + /// similar. + Ipc, + + /// The network namespace. The namespace is empty and has no conectivity, even localhost + /// network, unless some setup is done afterwards. + Net, + + /// The UTS namespace, which allows to change hostname of the new container. + Uts, +} + +impl Namespace { + /// Bind the namespace to the provided path. + pub fn bind>(&self, path: T) -> Result<()> { + let bind_path = path.as_ref().join(self.as_ref()); + File::create(&bind_path).context("create namespace bind path")?; + let source_path = PathBuf::from("/proc/self/ns").join(self.as_ref()); + + mount( + Some(&source_path), + &bind_path, + None::<&Path>, + MsFlags::MS_BIND, + None::<&[u8]>, + ) + .context("mount namespace")?; + + Ok(()) + } + + /// Umount the namespace. + pub fn umount>(&self, path: T) -> Result<()> { + let bind_path = path.as_ref().join(self.as_ref()); + umount(&bind_path).context("umount namespace") + } +} diff --git a/conmon-rs/server/src/rpc.rs b/conmon-rs/server/src/rpc.rs index 4f3910da01..34fd3b4a8d 100644 --- a/conmon-rs/server/src/rpc.rs +++ b/conmon-rs/server/src/rpc.rs @@ -2,6 +2,7 @@ use crate::{ child::Child, container_io::{ContainerIO, SharedContainerIO}, container_log::ContainerLog, + pause::Pause, server::Server, telemetry::Telemetry, version::Version, @@ -349,4 +350,28 @@ impl conmon::Server for Server { .instrument(debug_span!("promise")), ) } + + /// Create a new set of namespaces. + fn create_namespaces( + &mut self, + params: conmon::CreateNamespacesParams, + mut results: conmon::CreateNamespacesResults, + ) -> Promise<(), capnp::Error> { + debug!("Got a create namespaces request"); + let req = pry!(pry!(params.get()).get_request()); + + let span = debug_span!( + "create_namespaces", + uuid = Uuid::new_v4().to_string().as_str() + ); + let _enter = span.enter(); + pry_err!(Telemetry::set_parent_context(pry!(req.get_metadata()))); + + let pause = pry_err!(Pause::shared()); + + let mut response = results.get().init_response(); + response.set_path(&pause.path().display().to_string()); + + Promise::ok(()) + } } diff --git a/conmon-rs/server/src/server.rs b/conmon-rs/server/src/server.rs index 964678151c..2f98213a9b 100644 --- a/conmon-rs/server/src/server.rs +++ b/conmon-rs/server/src/server.rs @@ -7,6 +7,7 @@ use crate::{ init::{DefaultInit, Init}, journal::Journal, listener::{DefaultListener, Listener}, + pause::Pause, telemetry::Telemetry, version::Version, }; @@ -62,6 +63,11 @@ impl Server { process::exit(0); } + if let Some(path) = server.config().pause() { + Pause::run(path).context("run pause")?; + process::exit(0); + } + server.config().validate().context("validate config")?; Self::init().context("init self")?; @@ -207,6 +213,10 @@ impl Server { } }; + if let Some(pause) = Pause::maybe_shared() { + pause.stop(); + } + debug!("Starting grandchildren cleanup task"); reaper .kill_grandchildren(handled_sig) diff --git a/internal/proto/conmon.capnp.go b/internal/proto/conmon.capnp.go index 06fc36c94e..f97d08481a 100644 --- a/internal/proto/conmon.capnp.go +++ b/internal/proto/conmon.capnp.go @@ -113,6 +113,22 @@ func (c Conmon) SetWindowSizeContainer(ctx context.Context, params func(Conmon_s ans, release := capnp.Client(c).SendCall(ctx, s) return Conmon_setWindowSizeContainer_Results_Future{Future: ans.Future()}, release } +func (c Conmon) CreateNamespaces(ctx context.Context, params func(Conmon_createNamespaces_Params) error) (Conmon_createNamespaces_Results_Future, capnp.ReleaseFunc) { + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0xb737e899dd6633f1, + MethodID: 6, + InterfaceName: "conmon-rs/common/proto/conmon.capnp:Conmon", + MethodName: "createNamespaces", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 1} + s.PlaceArgs = func(s capnp.Struct) error { return params(Conmon_createNamespaces_Params(s)) } + } + ans, release := capnp.Client(c).SendCall(ctx, s) + return Conmon_createNamespaces_Results_Future{Future: ans.Future()}, release +} // String returns a string that identifies this capability for debugging // purposes. Its format should not be depended on: in particular, it @@ -192,6 +208,8 @@ type Conmon_Server interface { ReopenLogContainer(context.Context, Conmon_reopenLogContainer) error SetWindowSizeContainer(context.Context, Conmon_setWindowSizeContainer) error + + CreateNamespaces(context.Context, Conmon_createNamespaces) error } // Conmon_NewServer creates a new Server from an implementation of Conmon_Server. @@ -210,7 +228,7 @@ func Conmon_ServerToClient(s Conmon_Server) Conmon { // This can be used to create a more complicated Server. func Conmon_Methods(methods []server.Method, s Conmon_Server) []server.Method { if cap(methods) == 0 { - methods = make([]server.Method, 0, 6) + methods = make([]server.Method, 0, 7) } methods = append(methods, server.Method{ @@ -285,6 +303,18 @@ func Conmon_Methods(methods []server.Method, s Conmon_Server) []server.Method { }, }) + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0xb737e899dd6633f1, + MethodID: 6, + InterfaceName: "conmon-rs/common/proto/conmon.capnp:Conmon", + MethodName: "createNamespaces", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.CreateNamespaces(ctx, Conmon_createNamespaces{call}) + }, + }) + return methods } @@ -390,6 +420,23 @@ func (c Conmon_setWindowSizeContainer) AllocResults() (Conmon_setWindowSizeConta return Conmon_setWindowSizeContainer_Results(r), err } +// Conmon_createNamespaces holds the state for a server call to Conmon.createNamespaces. +// See server.Call for documentation. +type Conmon_createNamespaces struct { + *server.Call +} + +// Args returns the call's arguments. +func (c Conmon_createNamespaces) Args() Conmon_createNamespaces_Params { + return Conmon_createNamespaces_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c Conmon_createNamespaces) AllocResults() (Conmon_createNamespaces_Results, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return Conmon_createNamespaces_Results(r), err +} + // Conmon_List is a list of Conmon. type Conmon_List = capnp.CapList[Conmon] @@ -446,6 +493,14 @@ func (s Conmon_VersionRequest) Message() *capnp.Message { func (s Conmon_VersionRequest) Segment() *capnp.Segment { return capnp.Struct(s).Segment() } +func (s Conmon_VersionRequest) Verbose() bool { + return capnp.Struct(s).Bit(0) +} + +func (s Conmon_VersionRequest) SetVerbose(v bool) { + capnp.Struct(s).SetBit(0, v) +} + func (s Conmon_VersionRequest) Metadata() ([]byte, error) { p, err := capnp.Struct(s).Ptr(0) return []byte(p.Data()), err @@ -459,14 +514,6 @@ func (s Conmon_VersionRequest) SetMetadata(v []byte) error { return capnp.Struct(s).SetData(0, v) } -func (s Conmon_VersionRequest) Verbose() bool { - return capnp.Struct(s).Bit(0) -} - -func (s Conmon_VersionRequest) SetVerbose(v bool) { - capnp.Struct(s).SetBit(0, v) -} - // Conmon_VersionRequest_List is a list of Conmon_VersionRequest. type Conmon_VersionRequest_List = capnp.StructList[Conmon_VersionRequest] @@ -479,9 +526,9 @@ func NewConmon_VersionRequest_List(s *capnp.Segment, sz int32) (Conmon_VersionRe // Conmon_VersionRequest_Future is a wrapper for a Conmon_VersionRequest promised by a client call. type Conmon_VersionRequest_Future struct{ *capnp.Future } -func (p Conmon_VersionRequest_Future) Struct() (Conmon_VersionRequest, error) { - s, err := p.Future.Struct() - return Conmon_VersionRequest(s), err +func (f Conmon_VersionRequest_Future) Struct() (Conmon_VersionRequest, error) { + p, err := f.Future.Ptr() + return Conmon_VersionRequest(p.Struct()), err } type Conmon_VersionResponse capnp.Struct @@ -531,19 +578,6 @@ func (s Conmon_VersionResponse) Message() *capnp.Message { func (s Conmon_VersionResponse) Segment() *capnp.Segment { return capnp.Struct(s).Segment() } -func (s Conmon_VersionResponse) Metadata() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(8) - return []byte(p.Data()), err -} - -func (s Conmon_VersionResponse) HasMetadata() bool { - return capnp.Struct(s).HasPtr(8) -} - -func (s Conmon_VersionResponse) SetMetadata(v []byte) error { - return capnp.Struct(s).SetData(8, v) -} - func (s Conmon_VersionResponse) ProcessId() uint32 { return capnp.Struct(s).Uint32(0) } @@ -696,6 +730,19 @@ func (s Conmon_VersionResponse) SetCargoTree(v string) error { return capnp.Struct(s).SetText(7, v) } +func (s Conmon_VersionResponse) Metadata() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(8) + return []byte(p.Data()), err +} + +func (s Conmon_VersionResponse) HasMetadata() bool { + return capnp.Struct(s).HasPtr(8) +} + +func (s Conmon_VersionResponse) SetMetadata(v []byte) error { + return capnp.Struct(s).SetData(8, v) +} + // Conmon_VersionResponse_List is a list of Conmon_VersionResponse. type Conmon_VersionResponse_List = capnp.StructList[Conmon_VersionResponse] @@ -708,9 +755,9 @@ func NewConmon_VersionResponse_List(s *capnp.Segment, sz int32) (Conmon_VersionR // Conmon_VersionResponse_Future is a wrapper for a Conmon_VersionResponse promised by a client call. type Conmon_VersionResponse_Future struct{ *capnp.Future } -func (p Conmon_VersionResponse_Future) Struct() (Conmon_VersionResponse, error) { - s, err := p.Future.Struct() - return Conmon_VersionResponse(s), err +func (f Conmon_VersionResponse_Future) Struct() (Conmon_VersionResponse, error) { + p, err := f.Future.Ptr() + return Conmon_VersionResponse(p.Struct()), err } type Conmon_CreateContainerRequest capnp.Struct @@ -760,19 +807,6 @@ func (s Conmon_CreateContainerRequest) Message() *capnp.Message { func (s Conmon_CreateContainerRequest) Segment() *capnp.Segment { return capnp.Struct(s).Segment() } -func (s Conmon_CreateContainerRequest) Metadata() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(8) - return []byte(p.Data()), err -} - -func (s Conmon_CreateContainerRequest) HasMetadata() bool { - return capnp.Struct(s).HasPtr(8) -} - -func (s Conmon_CreateContainerRequest) SetMetadata(v []byte) error { - return capnp.Struct(s).SetData(8, v) -} - func (s Conmon_CreateContainerRequest) Id() (string, error) { p, err := capnp.Struct(s).Ptr(0) return p.Text(), err @@ -848,7 +882,6 @@ func (s Conmon_CreateContainerRequest) NewExitPaths(n int32) (capnp.TextList, er err = capnp.Struct(s).SetPtr(2, l.ToPtr()) return l, err } - func (s Conmon_CreateContainerRequest) OomExitPaths() (capnp.TextList, error) { p, err := capnp.Struct(s).Ptr(3) return capnp.TextList(p.List()), err @@ -872,7 +905,6 @@ func (s Conmon_CreateContainerRequest) NewOomExitPaths(n int32) (capnp.TextList, err = capnp.Struct(s).SetPtr(3, l.ToPtr()) return l, err } - func (s Conmon_CreateContainerRequest) LogDrivers() (Conmon_LogDriver_List, error) { p, err := capnp.Struct(s).Ptr(4) return Conmon_LogDriver_List(p.List()), err @@ -896,7 +928,6 @@ func (s Conmon_CreateContainerRequest) NewLogDrivers(n int32) (Conmon_LogDriver_ err = capnp.Struct(s).SetPtr(4, l.ToPtr()) return l, err } - func (s Conmon_CreateContainerRequest) CleanupCmd() (capnp.TextList, error) { p, err := capnp.Struct(s).Ptr(5) return capnp.TextList(p.List()), err @@ -920,7 +951,6 @@ func (s Conmon_CreateContainerRequest) NewCleanupCmd(n int32) (capnp.TextList, e err = capnp.Struct(s).SetPtr(5, l.ToPtr()) return l, err } - func (s Conmon_CreateContainerRequest) GlobalArgs() (capnp.TextList, error) { p, err := capnp.Struct(s).Ptr(6) return capnp.TextList(p.List()), err @@ -944,7 +974,6 @@ func (s Conmon_CreateContainerRequest) NewGlobalArgs(n int32) (capnp.TextList, e err = capnp.Struct(s).SetPtr(6, l.ToPtr()) return l, err } - func (s Conmon_CreateContainerRequest) CommandArgs() (capnp.TextList, error) { p, err := capnp.Struct(s).Ptr(7) return capnp.TextList(p.List()), err @@ -968,6 +997,18 @@ func (s Conmon_CreateContainerRequest) NewCommandArgs(n int32) (capnp.TextList, err = capnp.Struct(s).SetPtr(7, l.ToPtr()) return l, err } +func (s Conmon_CreateContainerRequest) Metadata() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(8) + return []byte(p.Data()), err +} + +func (s Conmon_CreateContainerRequest) HasMetadata() bool { + return capnp.Struct(s).HasPtr(8) +} + +func (s Conmon_CreateContainerRequest) SetMetadata(v []byte) error { + return capnp.Struct(s).SetData(8, v) +} // Conmon_CreateContainerRequest_List is a list of Conmon_CreateContainerRequest. type Conmon_CreateContainerRequest_List = capnp.StructList[Conmon_CreateContainerRequest] @@ -981,9 +1022,9 @@ func NewConmon_CreateContainerRequest_List(s *capnp.Segment, sz int32) (Conmon_C // Conmon_CreateContainerRequest_Future is a wrapper for a Conmon_CreateContainerRequest promised by a client call. type Conmon_CreateContainerRequest_Future struct{ *capnp.Future } -func (p Conmon_CreateContainerRequest_Future) Struct() (Conmon_CreateContainerRequest, error) { - s, err := p.Future.Struct() - return Conmon_CreateContainerRequest(s), err +func (f Conmon_CreateContainerRequest_Future) Struct() (Conmon_CreateContainerRequest, error) { + p, err := f.Future.Ptr() + return Conmon_CreateContainerRequest(p.Struct()), err } type Conmon_LogDriver capnp.Struct @@ -1079,9 +1120,9 @@ func NewConmon_LogDriver_List(s *capnp.Segment, sz int32) (Conmon_LogDriver_List // Conmon_LogDriver_Future is a wrapper for a Conmon_LogDriver promised by a client call. type Conmon_LogDriver_Future struct{ *capnp.Future } -func (p Conmon_LogDriver_Future) Struct() (Conmon_LogDriver, error) { - s, err := p.Future.Struct() - return Conmon_LogDriver(s), err +func (f Conmon_LogDriver_Future) Struct() (Conmon_LogDriver, error) { + p, err := f.Future.Ptr() + return Conmon_LogDriver(p.Struct()), err } type Conmon_LogDriver_Type uint16 @@ -1129,12 +1170,12 @@ type Conmon_CreateContainerResponse capnp.Struct const Conmon_CreateContainerResponse_TypeID = 0xde3a625e70772b9a func NewConmon_CreateContainerResponse(s *capnp.Segment) (Conmon_CreateContainerResponse, error) { - st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}) + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) return Conmon_CreateContainerResponse(st), err } func NewRootConmon_CreateContainerResponse(s *capnp.Segment) (Conmon_CreateContainerResponse, error) { - st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}) + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) return Conmon_CreateContainerResponse(st), err } @@ -1178,21 +1219,39 @@ func (s Conmon_CreateContainerResponse) SetContainerPid(v uint32) { capnp.Struct(s).SetUint32(0, v) } +func (s Conmon_CreateContainerResponse) NamespacesPath() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Conmon_CreateContainerResponse) HasNamespacesPath() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Conmon_CreateContainerResponse) NamespacesPathBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Conmon_CreateContainerResponse) SetNamespacesPath(v string) error { + return capnp.Struct(s).SetText(0, v) +} + // Conmon_CreateContainerResponse_List is a list of Conmon_CreateContainerResponse. type Conmon_CreateContainerResponse_List = capnp.StructList[Conmon_CreateContainerResponse] // NewConmon_CreateContainerResponse creates a new list of Conmon_CreateContainerResponse. func NewConmon_CreateContainerResponse_List(s *capnp.Segment, sz int32) (Conmon_CreateContainerResponse_List, error) { - l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}, sz) + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}, sz) return capnp.StructList[Conmon_CreateContainerResponse](l), err } // Conmon_CreateContainerResponse_Future is a wrapper for a Conmon_CreateContainerResponse promised by a client call. type Conmon_CreateContainerResponse_Future struct{ *capnp.Future } -func (p Conmon_CreateContainerResponse_Future) Struct() (Conmon_CreateContainerResponse, error) { - s, err := p.Future.Struct() - return Conmon_CreateContainerResponse(s), err +func (f Conmon_CreateContainerResponse_Future) Struct() (Conmon_CreateContainerResponse, error) { + p, err := f.Future.Ptr() + return Conmon_CreateContainerResponse(p.Struct()), err } type Conmon_ExecSyncContainerRequest capnp.Struct @@ -1242,19 +1301,6 @@ func (s Conmon_ExecSyncContainerRequest) Message() *capnp.Message { func (s Conmon_ExecSyncContainerRequest) Segment() *capnp.Segment { return capnp.Struct(s).Segment() } -func (s Conmon_ExecSyncContainerRequest) Metadata() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(2) - return []byte(p.Data()), err -} - -func (s Conmon_ExecSyncContainerRequest) HasMetadata() bool { - return capnp.Struct(s).HasPtr(2) -} - -func (s Conmon_ExecSyncContainerRequest) SetMetadata(v []byte) error { - return capnp.Struct(s).SetData(2, v) -} - func (s Conmon_ExecSyncContainerRequest) Id() (string, error) { p, err := capnp.Struct(s).Ptr(0) return p.Text(), err @@ -1304,7 +1350,6 @@ func (s Conmon_ExecSyncContainerRequest) NewCommand(n int32) (capnp.TextList, er err = capnp.Struct(s).SetPtr(1, l.ToPtr()) return l, err } - func (s Conmon_ExecSyncContainerRequest) Terminal() bool { return capnp.Struct(s).Bit(64) } @@ -1313,6 +1358,19 @@ func (s Conmon_ExecSyncContainerRequest) SetTerminal(v bool) { capnp.Struct(s).SetBit(64, v) } +func (s Conmon_ExecSyncContainerRequest) Metadata() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(2) + return []byte(p.Data()), err +} + +func (s Conmon_ExecSyncContainerRequest) HasMetadata() bool { + return capnp.Struct(s).HasPtr(2) +} + +func (s Conmon_ExecSyncContainerRequest) SetMetadata(v []byte) error { + return capnp.Struct(s).SetData(2, v) +} + // Conmon_ExecSyncContainerRequest_List is a list of Conmon_ExecSyncContainerRequest. type Conmon_ExecSyncContainerRequest_List = capnp.StructList[Conmon_ExecSyncContainerRequest] @@ -1325,9 +1383,9 @@ func NewConmon_ExecSyncContainerRequest_List(s *capnp.Segment, sz int32) (Conmon // Conmon_ExecSyncContainerRequest_Future is a wrapper for a Conmon_ExecSyncContainerRequest promised by a client call. type Conmon_ExecSyncContainerRequest_Future struct{ *capnp.Future } -func (p Conmon_ExecSyncContainerRequest_Future) Struct() (Conmon_ExecSyncContainerRequest, error) { - s, err := p.Future.Struct() - return Conmon_ExecSyncContainerRequest(s), err +func (f Conmon_ExecSyncContainerRequest_Future) Struct() (Conmon_ExecSyncContainerRequest, error) { + p, err := f.Future.Ptr() + return Conmon_ExecSyncContainerRequest(p.Struct()), err } type Conmon_ExecSyncContainerResponse capnp.Struct @@ -1431,9 +1489,9 @@ func NewConmon_ExecSyncContainerResponse_List(s *capnp.Segment, sz int32) (Conmo // Conmon_ExecSyncContainerResponse_Future is a wrapper for a Conmon_ExecSyncContainerResponse promised by a client call. type Conmon_ExecSyncContainerResponse_Future struct{ *capnp.Future } -func (p Conmon_ExecSyncContainerResponse_Future) Struct() (Conmon_ExecSyncContainerResponse, error) { - s, err := p.Future.Struct() - return Conmon_ExecSyncContainerResponse(s), err +func (f Conmon_ExecSyncContainerResponse_Future) Struct() (Conmon_ExecSyncContainerResponse, error) { + p, err := f.Future.Ptr() + return Conmon_ExecSyncContainerResponse(p.Struct()), err } type Conmon_AttachRequest capnp.Struct @@ -1483,19 +1541,6 @@ func (s Conmon_AttachRequest) Message() *capnp.Message { func (s Conmon_AttachRequest) Segment() *capnp.Segment { return capnp.Struct(s).Segment() } -func (s Conmon_AttachRequest) Metadata() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(3) - return []byte(p.Data()), err -} - -func (s Conmon_AttachRequest) HasMetadata() bool { - return capnp.Struct(s).HasPtr(3) -} - -func (s Conmon_AttachRequest) SetMetadata(v []byte) error { - return capnp.Struct(s).SetData(3, v) -} - func (s Conmon_AttachRequest) Id() (string, error) { p, err := capnp.Struct(s).Ptr(0) return p.Text(), err @@ -1558,6 +1603,19 @@ func (s Conmon_AttachRequest) SetStopAfterStdinEof(v bool) { capnp.Struct(s).SetBit(0, v) } +func (s Conmon_AttachRequest) Metadata() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(3) + return []byte(p.Data()), err +} + +func (s Conmon_AttachRequest) HasMetadata() bool { + return capnp.Struct(s).HasPtr(3) +} + +func (s Conmon_AttachRequest) SetMetadata(v []byte) error { + return capnp.Struct(s).SetData(3, v) +} + // Conmon_AttachRequest_List is a list of Conmon_AttachRequest. type Conmon_AttachRequest_List = capnp.StructList[Conmon_AttachRequest] @@ -1570,9 +1628,9 @@ func NewConmon_AttachRequest_List(s *capnp.Segment, sz int32) (Conmon_AttachRequ // Conmon_AttachRequest_Future is a wrapper for a Conmon_AttachRequest promised by a client call. type Conmon_AttachRequest_Future struct{ *capnp.Future } -func (p Conmon_AttachRequest_Future) Struct() (Conmon_AttachRequest, error) { - s, err := p.Future.Struct() - return Conmon_AttachRequest(s), err +func (f Conmon_AttachRequest_Future) Struct() (Conmon_AttachRequest, error) { + p, err := f.Future.Ptr() + return Conmon_AttachRequest(p.Struct()), err } type Conmon_AttachResponse capnp.Struct @@ -1635,9 +1693,9 @@ func NewConmon_AttachResponse_List(s *capnp.Segment, sz int32) (Conmon_AttachRes // Conmon_AttachResponse_Future is a wrapper for a Conmon_AttachResponse promised by a client call. type Conmon_AttachResponse_Future struct{ *capnp.Future } -func (p Conmon_AttachResponse_Future) Struct() (Conmon_AttachResponse, error) { - s, err := p.Future.Struct() - return Conmon_AttachResponse(s), err +func (f Conmon_AttachResponse_Future) Struct() (Conmon_AttachResponse, error) { + p, err := f.Future.Ptr() + return Conmon_AttachResponse(p.Struct()), err } type Conmon_ReopenLogRequest capnp.Struct @@ -1687,19 +1745,6 @@ func (s Conmon_ReopenLogRequest) Message() *capnp.Message { func (s Conmon_ReopenLogRequest) Segment() *capnp.Segment { return capnp.Struct(s).Segment() } -func (s Conmon_ReopenLogRequest) Metadata() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(1) - return []byte(p.Data()), err -} - -func (s Conmon_ReopenLogRequest) HasMetadata() bool { - return capnp.Struct(s).HasPtr(1) -} - -func (s Conmon_ReopenLogRequest) SetMetadata(v []byte) error { - return capnp.Struct(s).SetData(1, v) -} - func (s Conmon_ReopenLogRequest) Id() (string, error) { p, err := capnp.Struct(s).Ptr(0) return p.Text(), err @@ -1718,6 +1763,19 @@ func (s Conmon_ReopenLogRequest) SetId(v string) error { return capnp.Struct(s).SetText(0, v) } +func (s Conmon_ReopenLogRequest) Metadata() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return []byte(p.Data()), err +} + +func (s Conmon_ReopenLogRequest) HasMetadata() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s Conmon_ReopenLogRequest) SetMetadata(v []byte) error { + return capnp.Struct(s).SetData(1, v) +} + // Conmon_ReopenLogRequest_List is a list of Conmon_ReopenLogRequest. type Conmon_ReopenLogRequest_List = capnp.StructList[Conmon_ReopenLogRequest] @@ -1730,9 +1788,9 @@ func NewConmon_ReopenLogRequest_List(s *capnp.Segment, sz int32) (Conmon_ReopenL // Conmon_ReopenLogRequest_Future is a wrapper for a Conmon_ReopenLogRequest promised by a client call. type Conmon_ReopenLogRequest_Future struct{ *capnp.Future } -func (p Conmon_ReopenLogRequest_Future) Struct() (Conmon_ReopenLogRequest, error) { - s, err := p.Future.Struct() - return Conmon_ReopenLogRequest(s), err +func (f Conmon_ReopenLogRequest_Future) Struct() (Conmon_ReopenLogRequest, error) { + p, err := f.Future.Ptr() + return Conmon_ReopenLogRequest(p.Struct()), err } type Conmon_ReopenLogResponse capnp.Struct @@ -1795,9 +1853,9 @@ func NewConmon_ReopenLogResponse_List(s *capnp.Segment, sz int32) (Conmon_Reopen // Conmon_ReopenLogResponse_Future is a wrapper for a Conmon_ReopenLogResponse promised by a client call. type Conmon_ReopenLogResponse_Future struct{ *capnp.Future } -func (p Conmon_ReopenLogResponse_Future) Struct() (Conmon_ReopenLogResponse, error) { - s, err := p.Future.Struct() - return Conmon_ReopenLogResponse(s), err +func (f Conmon_ReopenLogResponse_Future) Struct() (Conmon_ReopenLogResponse, error) { + p, err := f.Future.Ptr() + return Conmon_ReopenLogResponse(p.Struct()), err } type Conmon_SetWindowSizeRequest capnp.Struct @@ -1847,19 +1905,6 @@ func (s Conmon_SetWindowSizeRequest) Message() *capnp.Message { func (s Conmon_SetWindowSizeRequest) Segment() *capnp.Segment { return capnp.Struct(s).Segment() } -func (s Conmon_SetWindowSizeRequest) Metadata() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(1) - return []byte(p.Data()), err -} - -func (s Conmon_SetWindowSizeRequest) HasMetadata() bool { - return capnp.Struct(s).HasPtr(1) -} - -func (s Conmon_SetWindowSizeRequest) SetMetadata(v []byte) error { - return capnp.Struct(s).SetData(1, v) -} - func (s Conmon_SetWindowSizeRequest) Id() (string, error) { p, err := capnp.Struct(s).Ptr(0) return p.Text(), err @@ -1894,6 +1939,19 @@ func (s Conmon_SetWindowSizeRequest) SetHeight(v uint16) { capnp.Struct(s).SetUint16(2, v) } +func (s Conmon_SetWindowSizeRequest) Metadata() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return []byte(p.Data()), err +} + +func (s Conmon_SetWindowSizeRequest) HasMetadata() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s Conmon_SetWindowSizeRequest) SetMetadata(v []byte) error { + return capnp.Struct(s).SetData(1, v) +} + // Conmon_SetWindowSizeRequest_List is a list of Conmon_SetWindowSizeRequest. type Conmon_SetWindowSizeRequest_List = capnp.StructList[Conmon_SetWindowSizeRequest] @@ -1906,9 +1964,9 @@ func NewConmon_SetWindowSizeRequest_List(s *capnp.Segment, sz int32) (Conmon_Set // Conmon_SetWindowSizeRequest_Future is a wrapper for a Conmon_SetWindowSizeRequest promised by a client call. type Conmon_SetWindowSizeRequest_Future struct{ *capnp.Future } -func (p Conmon_SetWindowSizeRequest_Future) Struct() (Conmon_SetWindowSizeRequest, error) { - s, err := p.Future.Struct() - return Conmon_SetWindowSizeRequest(s), err +func (f Conmon_SetWindowSizeRequest_Future) Struct() (Conmon_SetWindowSizeRequest, error) { + p, err := f.Future.Ptr() + return Conmon_SetWindowSizeRequest(p.Struct()), err } type Conmon_SetWindowSizeResponse capnp.Struct @@ -1971,9 +2029,168 @@ func NewConmon_SetWindowSizeResponse_List(s *capnp.Segment, sz int32) (Conmon_Se // Conmon_SetWindowSizeResponse_Future is a wrapper for a Conmon_SetWindowSizeResponse promised by a client call. type Conmon_SetWindowSizeResponse_Future struct{ *capnp.Future } -func (p Conmon_SetWindowSizeResponse_Future) Struct() (Conmon_SetWindowSizeResponse, error) { - s, err := p.Future.Struct() - return Conmon_SetWindowSizeResponse(s), err +func (f Conmon_SetWindowSizeResponse_Future) Struct() (Conmon_SetWindowSizeResponse, error) { + p, err := f.Future.Ptr() + return Conmon_SetWindowSizeResponse(p.Struct()), err +} + +type Conmon_CreateNamespacesRequest capnp.Struct + +// Conmon_CreateNamespacesRequest_TypeID is the unique identifier for the type Conmon_CreateNamespacesRequest. +const Conmon_CreateNamespacesRequest_TypeID = 0x8b5b1693940f607e + +func NewConmon_CreateNamespacesRequest(s *capnp.Segment) (Conmon_CreateNamespacesRequest, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return Conmon_CreateNamespacesRequest(st), err +} + +func NewRootConmon_CreateNamespacesRequest(s *capnp.Segment) (Conmon_CreateNamespacesRequest, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return Conmon_CreateNamespacesRequest(st), err +} + +func ReadRootConmon_CreateNamespacesRequest(msg *capnp.Message) (Conmon_CreateNamespacesRequest, error) { + root, err := msg.Root() + return Conmon_CreateNamespacesRequest(root.Struct()), err +} + +func (s Conmon_CreateNamespacesRequest) String() string { + str, _ := text.Marshal(0x8b5b1693940f607e, capnp.Struct(s)) + return str +} + +func (s Conmon_CreateNamespacesRequest) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (Conmon_CreateNamespacesRequest) DecodeFromPtr(p capnp.Ptr) Conmon_CreateNamespacesRequest { + return Conmon_CreateNamespacesRequest(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s Conmon_CreateNamespacesRequest) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s Conmon_CreateNamespacesRequest) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Conmon_CreateNamespacesRequest) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Conmon_CreateNamespacesRequest) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Conmon_CreateNamespacesRequest) Metadata() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return []byte(p.Data()), err +} + +func (s Conmon_CreateNamespacesRequest) HasMetadata() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Conmon_CreateNamespacesRequest) SetMetadata(v []byte) error { + return capnp.Struct(s).SetData(0, v) +} + +// Conmon_CreateNamespacesRequest_List is a list of Conmon_CreateNamespacesRequest. +type Conmon_CreateNamespacesRequest_List = capnp.StructList[Conmon_CreateNamespacesRequest] + +// NewConmon_CreateNamespacesRequest creates a new list of Conmon_CreateNamespacesRequest. +func NewConmon_CreateNamespacesRequest_List(s *capnp.Segment, sz int32) (Conmon_CreateNamespacesRequest_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[Conmon_CreateNamespacesRequest](l), err +} + +// Conmon_CreateNamespacesRequest_Future is a wrapper for a Conmon_CreateNamespacesRequest promised by a client call. +type Conmon_CreateNamespacesRequest_Future struct{ *capnp.Future } + +func (f Conmon_CreateNamespacesRequest_Future) Struct() (Conmon_CreateNamespacesRequest, error) { + p, err := f.Future.Ptr() + return Conmon_CreateNamespacesRequest(p.Struct()), err +} + +type Conmon_CreateNamespacesResponse capnp.Struct + +// Conmon_CreateNamespacesResponse_TypeID is the unique identifier for the type Conmon_CreateNamespacesResponse. +const Conmon_CreateNamespacesResponse_TypeID = 0x9887a60f577a1ecb + +func NewConmon_CreateNamespacesResponse(s *capnp.Segment) (Conmon_CreateNamespacesResponse, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return Conmon_CreateNamespacesResponse(st), err +} + +func NewRootConmon_CreateNamespacesResponse(s *capnp.Segment) (Conmon_CreateNamespacesResponse, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return Conmon_CreateNamespacesResponse(st), err +} + +func ReadRootConmon_CreateNamespacesResponse(msg *capnp.Message) (Conmon_CreateNamespacesResponse, error) { + root, err := msg.Root() + return Conmon_CreateNamespacesResponse(root.Struct()), err +} + +func (s Conmon_CreateNamespacesResponse) String() string { + str, _ := text.Marshal(0x9887a60f577a1ecb, capnp.Struct(s)) + return str +} + +func (s Conmon_CreateNamespacesResponse) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (Conmon_CreateNamespacesResponse) DecodeFromPtr(p capnp.Ptr) Conmon_CreateNamespacesResponse { + return Conmon_CreateNamespacesResponse(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s Conmon_CreateNamespacesResponse) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s Conmon_CreateNamespacesResponse) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Conmon_CreateNamespacesResponse) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Conmon_CreateNamespacesResponse) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Conmon_CreateNamespacesResponse) Path() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Conmon_CreateNamespacesResponse) HasPath() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Conmon_CreateNamespacesResponse) PathBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Conmon_CreateNamespacesResponse) SetPath(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +// Conmon_CreateNamespacesResponse_List is a list of Conmon_CreateNamespacesResponse. +type Conmon_CreateNamespacesResponse_List = capnp.StructList[Conmon_CreateNamespacesResponse] + +// NewConmon_CreateNamespacesResponse creates a new list of Conmon_CreateNamespacesResponse. +func NewConmon_CreateNamespacesResponse_List(s *capnp.Segment, sz int32) (Conmon_CreateNamespacesResponse_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[Conmon_CreateNamespacesResponse](l), err +} + +// Conmon_CreateNamespacesResponse_Future is a wrapper for a Conmon_CreateNamespacesResponse promised by a client call. +type Conmon_CreateNamespacesResponse_Future struct{ *capnp.Future } + +func (f Conmon_CreateNamespacesResponse_Future) Struct() (Conmon_CreateNamespacesResponse, error) { + p, err := f.Future.Ptr() + return Conmon_CreateNamespacesResponse(p.Struct()), err } type Conmon_version_Params capnp.Struct @@ -2059,11 +2276,10 @@ func NewConmon_version_Params_List(s *capnp.Segment, sz int32) (Conmon_version_P // Conmon_version_Params_Future is a wrapper for a Conmon_version_Params promised by a client call. type Conmon_version_Params_Future struct{ *capnp.Future } -func (p Conmon_version_Params_Future) Struct() (Conmon_version_Params, error) { - s, err := p.Future.Struct() - return Conmon_version_Params(s), err +func (f Conmon_version_Params_Future) Struct() (Conmon_version_Params, error) { + p, err := f.Future.Ptr() + return Conmon_version_Params(p.Struct()), err } - func (p Conmon_version_Params_Future) Request() Conmon_VersionRequest_Future { return Conmon_VersionRequest_Future{Future: p.Future.Field(0, nil)} } @@ -2151,11 +2367,10 @@ func NewConmon_version_Results_List(s *capnp.Segment, sz int32) (Conmon_version_ // Conmon_version_Results_Future is a wrapper for a Conmon_version_Results promised by a client call. type Conmon_version_Results_Future struct{ *capnp.Future } -func (p Conmon_version_Results_Future) Struct() (Conmon_version_Results, error) { - s, err := p.Future.Struct() - return Conmon_version_Results(s), err +func (f Conmon_version_Results_Future) Struct() (Conmon_version_Results, error) { + p, err := f.Future.Ptr() + return Conmon_version_Results(p.Struct()), err } - func (p Conmon_version_Results_Future) Response() Conmon_VersionResponse_Future { return Conmon_VersionResponse_Future{Future: p.Future.Field(0, nil)} } @@ -2243,11 +2458,10 @@ func NewConmon_createContainer_Params_List(s *capnp.Segment, sz int32) (Conmon_c // Conmon_createContainer_Params_Future is a wrapper for a Conmon_createContainer_Params promised by a client call. type Conmon_createContainer_Params_Future struct{ *capnp.Future } -func (p Conmon_createContainer_Params_Future) Struct() (Conmon_createContainer_Params, error) { - s, err := p.Future.Struct() - return Conmon_createContainer_Params(s), err +func (f Conmon_createContainer_Params_Future) Struct() (Conmon_createContainer_Params, error) { + p, err := f.Future.Ptr() + return Conmon_createContainer_Params(p.Struct()), err } - func (p Conmon_createContainer_Params_Future) Request() Conmon_CreateContainerRequest_Future { return Conmon_CreateContainerRequest_Future{Future: p.Future.Field(0, nil)} } @@ -2335,11 +2549,10 @@ func NewConmon_createContainer_Results_List(s *capnp.Segment, sz int32) (Conmon_ // Conmon_createContainer_Results_Future is a wrapper for a Conmon_createContainer_Results promised by a client call. type Conmon_createContainer_Results_Future struct{ *capnp.Future } -func (p Conmon_createContainer_Results_Future) Struct() (Conmon_createContainer_Results, error) { - s, err := p.Future.Struct() - return Conmon_createContainer_Results(s), err +func (f Conmon_createContainer_Results_Future) Struct() (Conmon_createContainer_Results, error) { + p, err := f.Future.Ptr() + return Conmon_createContainer_Results(p.Struct()), err } - func (p Conmon_createContainer_Results_Future) Response() Conmon_CreateContainerResponse_Future { return Conmon_CreateContainerResponse_Future{Future: p.Future.Field(0, nil)} } @@ -2427,11 +2640,10 @@ func NewConmon_execSyncContainer_Params_List(s *capnp.Segment, sz int32) (Conmon // Conmon_execSyncContainer_Params_Future is a wrapper for a Conmon_execSyncContainer_Params promised by a client call. type Conmon_execSyncContainer_Params_Future struct{ *capnp.Future } -func (p Conmon_execSyncContainer_Params_Future) Struct() (Conmon_execSyncContainer_Params, error) { - s, err := p.Future.Struct() - return Conmon_execSyncContainer_Params(s), err +func (f Conmon_execSyncContainer_Params_Future) Struct() (Conmon_execSyncContainer_Params, error) { + p, err := f.Future.Ptr() + return Conmon_execSyncContainer_Params(p.Struct()), err } - func (p Conmon_execSyncContainer_Params_Future) Request() Conmon_ExecSyncContainerRequest_Future { return Conmon_ExecSyncContainerRequest_Future{Future: p.Future.Field(0, nil)} } @@ -2519,11 +2731,10 @@ func NewConmon_execSyncContainer_Results_List(s *capnp.Segment, sz int32) (Conmo // Conmon_execSyncContainer_Results_Future is a wrapper for a Conmon_execSyncContainer_Results promised by a client call. type Conmon_execSyncContainer_Results_Future struct{ *capnp.Future } -func (p Conmon_execSyncContainer_Results_Future) Struct() (Conmon_execSyncContainer_Results, error) { - s, err := p.Future.Struct() - return Conmon_execSyncContainer_Results(s), err +func (f Conmon_execSyncContainer_Results_Future) Struct() (Conmon_execSyncContainer_Results, error) { + p, err := f.Future.Ptr() + return Conmon_execSyncContainer_Results(p.Struct()), err } - func (p Conmon_execSyncContainer_Results_Future) Response() Conmon_ExecSyncContainerResponse_Future { return Conmon_ExecSyncContainerResponse_Future{Future: p.Future.Field(0, nil)} } @@ -2611,11 +2822,10 @@ func NewConmon_attachContainer_Params_List(s *capnp.Segment, sz int32) (Conmon_a // Conmon_attachContainer_Params_Future is a wrapper for a Conmon_attachContainer_Params promised by a client call. type Conmon_attachContainer_Params_Future struct{ *capnp.Future } -func (p Conmon_attachContainer_Params_Future) Struct() (Conmon_attachContainer_Params, error) { - s, err := p.Future.Struct() - return Conmon_attachContainer_Params(s), err +func (f Conmon_attachContainer_Params_Future) Struct() (Conmon_attachContainer_Params, error) { + p, err := f.Future.Ptr() + return Conmon_attachContainer_Params(p.Struct()), err } - func (p Conmon_attachContainer_Params_Future) Request() Conmon_AttachRequest_Future { return Conmon_AttachRequest_Future{Future: p.Future.Field(0, nil)} } @@ -2703,11 +2913,10 @@ func NewConmon_attachContainer_Results_List(s *capnp.Segment, sz int32) (Conmon_ // Conmon_attachContainer_Results_Future is a wrapper for a Conmon_attachContainer_Results promised by a client call. type Conmon_attachContainer_Results_Future struct{ *capnp.Future } -func (p Conmon_attachContainer_Results_Future) Struct() (Conmon_attachContainer_Results, error) { - s, err := p.Future.Struct() - return Conmon_attachContainer_Results(s), err +func (f Conmon_attachContainer_Results_Future) Struct() (Conmon_attachContainer_Results, error) { + p, err := f.Future.Ptr() + return Conmon_attachContainer_Results(p.Struct()), err } - func (p Conmon_attachContainer_Results_Future) Response() Conmon_AttachResponse_Future { return Conmon_AttachResponse_Future{Future: p.Future.Field(0, nil)} } @@ -2795,11 +3004,10 @@ func NewConmon_reopenLogContainer_Params_List(s *capnp.Segment, sz int32) (Conmo // Conmon_reopenLogContainer_Params_Future is a wrapper for a Conmon_reopenLogContainer_Params promised by a client call. type Conmon_reopenLogContainer_Params_Future struct{ *capnp.Future } -func (p Conmon_reopenLogContainer_Params_Future) Struct() (Conmon_reopenLogContainer_Params, error) { - s, err := p.Future.Struct() - return Conmon_reopenLogContainer_Params(s), err +func (f Conmon_reopenLogContainer_Params_Future) Struct() (Conmon_reopenLogContainer_Params, error) { + p, err := f.Future.Ptr() + return Conmon_reopenLogContainer_Params(p.Struct()), err } - func (p Conmon_reopenLogContainer_Params_Future) Request() Conmon_ReopenLogRequest_Future { return Conmon_ReopenLogRequest_Future{Future: p.Future.Field(0, nil)} } @@ -2887,11 +3095,10 @@ func NewConmon_reopenLogContainer_Results_List(s *capnp.Segment, sz int32) (Conm // Conmon_reopenLogContainer_Results_Future is a wrapper for a Conmon_reopenLogContainer_Results promised by a client call. type Conmon_reopenLogContainer_Results_Future struct{ *capnp.Future } -func (p Conmon_reopenLogContainer_Results_Future) Struct() (Conmon_reopenLogContainer_Results, error) { - s, err := p.Future.Struct() - return Conmon_reopenLogContainer_Results(s), err +func (f Conmon_reopenLogContainer_Results_Future) Struct() (Conmon_reopenLogContainer_Results, error) { + p, err := f.Future.Ptr() + return Conmon_reopenLogContainer_Results(p.Struct()), err } - func (p Conmon_reopenLogContainer_Results_Future) Response() Conmon_ReopenLogResponse_Future { return Conmon_ReopenLogResponse_Future{Future: p.Future.Field(0, nil)} } @@ -2979,11 +3186,10 @@ func NewConmon_setWindowSizeContainer_Params_List(s *capnp.Segment, sz int32) (C // Conmon_setWindowSizeContainer_Params_Future is a wrapper for a Conmon_setWindowSizeContainer_Params promised by a client call. type Conmon_setWindowSizeContainer_Params_Future struct{ *capnp.Future } -func (p Conmon_setWindowSizeContainer_Params_Future) Struct() (Conmon_setWindowSizeContainer_Params, error) { - s, err := p.Future.Struct() - return Conmon_setWindowSizeContainer_Params(s), err +func (f Conmon_setWindowSizeContainer_Params_Future) Struct() (Conmon_setWindowSizeContainer_Params, error) { + p, err := f.Future.Ptr() + return Conmon_setWindowSizeContainer_Params(p.Struct()), err } - func (p Conmon_setWindowSizeContainer_Params_Future) Request() Conmon_SetWindowSizeRequest_Future { return Conmon_SetWindowSizeRequest_Future{Future: p.Future.Field(0, nil)} } @@ -3071,168 +3277,365 @@ func NewConmon_setWindowSizeContainer_Results_List(s *capnp.Segment, sz int32) ( // Conmon_setWindowSizeContainer_Results_Future is a wrapper for a Conmon_setWindowSizeContainer_Results promised by a client call. type Conmon_setWindowSizeContainer_Results_Future struct{ *capnp.Future } -func (p Conmon_setWindowSizeContainer_Results_Future) Struct() (Conmon_setWindowSizeContainer_Results, error) { - s, err := p.Future.Struct() - return Conmon_setWindowSizeContainer_Results(s), err +func (f Conmon_setWindowSizeContainer_Results_Future) Struct() (Conmon_setWindowSizeContainer_Results, error) { + p, err := f.Future.Ptr() + return Conmon_setWindowSizeContainer_Results(p.Struct()), err } - func (p Conmon_setWindowSizeContainer_Results_Future) Response() Conmon_SetWindowSizeResponse_Future { return Conmon_SetWindowSizeResponse_Future{Future: p.Future.Field(0, nil)} } -const schema_ffaaf7385bc4adad = "x\xda\xb4X\x7f\x8c\x14W\x1d\xff~\xdf\xec\xde\xec\x9d" + - "\xdc\xed\xbe\xce^,\x97\x92C\x02\x0d\xbf\xda\x03\x96Z" + - "\xb8\x1c\xb9;\x8e\x0b\x82\xa0;\xbbP\x0d\xb4\xa4\xc3\xee" + - "\xe3n\xe8\xee\xcc\xde\xcc,wG\xdb\x00-\xc4Rm" + - "\x15\x821\x90\x92P\xb5M\xc1\"\xc5Z\xac\xa8M\xb0" + - "%*\x16-$mm\x13\x7fT\xc4\"1\xd5\xc66" + - "\x82A\xc7\xbc\x99\x9d\x1f\xb7wi\xf7\xee\xf4\xbf\xdb\xcf" + - "|\xe6\xfb\xde\xfb\xbc\xef\x8f\xcf\xdc\x82\xa3u]\x91\x85" + - "\x8d'\x1a\x80\xc8\x0fD\xebl\xf3\x9da\xe3\xe9\xc3+" + - "\x1f\x06:\x0f\x01\xa2(\x02\xa4\x96Eg\x10@i}" + - "\xb4\x13\xd0\xde\xf3\x97\xcf\x9dZ\xff\xf0\xdf\x8e\x84\x09\xe5" + - "\xe8\"Nx\xcc!\x1c\xdcx\xe5\xbe\xdeU\xf1or" + - "\x82\xfd~j\xcbo\x0f^\xb9\xf3\x07\x10\xe1\xbc\x93\xd1" + - "\xab(\x9d\x8f\x8a \xd83O\xbc|\xe1\xd1\x8e\xb6c" + - "\xe10G\xa37\xf10g\x9c0\x83\xf7\xfe\xfc\xc4v" + - "\xf9\xf2\xb3c\x84y'z\x11\xa5\x7f;a\xa4\x15\x0b" + - "~\xf8Fj\xeeq\x90\xe7a\x88\xe6\xc6{\x8b\xf3>" + - "\x8c\x8a\x00\xd2\xfb\xd1A@{\xf1\x93\xcf\x9fz\xfc\xbd" + - "\xa1\xefr6\xa9f\xcbu\xc7PR\xeb>\x09 \x0d" + - "\xd4\x9d\x00\xb4\xef\xbfp\xf5\x99\xc7\xbf\xdc\xfdBul" + - "\xc2\xd9\xf5\"!\xd2,\x91\xc7\xfe\x94\xf8.\x84\x9e\xd3" + - "\x99\x82}\xfc\xf8+\x1b\x97\xfc\xf3\x98\x0d\x80\xa9\xeb\xe2" + - "\x06\x94\x1aco\x02\xa4\xb0\xfeK(\xd1\x06\x11\xc0>" + - "w\xeah\xfb\xbf.\x0d\x9e\xae\x0e^\xcf\x83_\xaf\xbf" + - "\x89HS9/\xd5\xdc\xa0\x13@;\xb1\xf1\xd7\xcb\xfe" + - "\xba\xe9\xcfg\xc3r\xd1\xc6\x16.\xd7\x9cF.\xd7\xbb" + - "\xca\x8fH\xef\xf9\xc2\xcf\xc2\x84\xb5\x8d\xab9Au\x09" + - "\x7f\xfa\xcf\xd6\xbeR\xdb\xaba\xc2\xde\xc6\x8b\x08(\x1d" + - "v\x08\xd7\x9a_\xfaFK\xc7\xe9_\x85\x09?q\x97" + - "x\xdd!\xb4t_X\x1c\xd7V\xbe6\xf2F\\9" + - "\xae7\xfe\x11\xa5\xe6&.\x07m\xe2R\xdf\xd8\xd3\xb1" + - "s\xda\xb47\xde\x1aS\xbc\x81\xa6\xb9D\xda\xe7\xb0\x1f" + - "k\xe2\xe2\x1d\x9a7X\xda\xb4\xb9\xfdwUl\xe7\xb6" + - "\xd5x\x0b\x91\xf6\xc69yO\x9c\xef\xe3F\xfb\x8d\x97" + - "\x8et\x94~_\x1d\xdaa\x1f\x8d\x9fC\xe9,g\xa7" + - "\xce\xc4[\x11\xd0^_ZIo\xcd4\xfd!|\xae" + - "\xcb\x89\x0c?\x17R\x1eo\xc1\xfd+\x8fnR\xa5K" + - "a\xc2,\xfa6Wf\xa9C\xf8\xb4\xf4\xf2s\xda\xbe" + - "\xab\x97\xc3\x84{\xe8\\\x1e\xa1\xec\x10\xcelL\xa5\xdf" + - "\xbct\xeb\xdf\x81\xdeA\x82$\x03L}\x9d^D\xe9" + - "$\xe5{?N[\x01\xed\x0b\xef\xb5>\xfb\xcb\xcb\x9f" + - "\xfd\xc7\x98\xd7~\x9c\xbe\x8d\xd2/8;u\x96\xde\xc9" + - "\xaf\xfd\xe9\x81o}\xed\xda\x0c\xfaAu\xc2\x0a\x9c3" + - "59\x83HK\x93\xfc\xcf;\x92\xceQ_\x0d\x84\xae\x15" + - "y7\xe1\x17\xd5\x85v\xae\xa2>Vt\x84.\xb4\xbd" + - "\x99\x84\x9e\xbaht\xa1\xed\xf5\xdc0\xd3\xf0e\xabP" + - "\x05\xc6\xa9\xe6\x08\x89zt\xad\xd3}\xa5\x0b\xc7\xdb\xe8" + - "\xab\x13(\xd4<\xe7{u.\xcd\xc2\x16\x80\xect\x14" + - "0;\x1f+\xfd\x88\xe3sp\x03@v6\xc7\x17#" + - "A\x14\x9cj\x97\x16\xe2j\x80\xec\x02\x0ewpz\xc4" + - "\xadxi).\x02\xc8.\xe6x\x17\xc7\xa3$\x89\x11" + - "\x00i\x19f\x00\xb2\x1d\x1c\xff\"\xc7\xeb\x84$F\x01" + - "\xa4\xf5\xb8\x15 \xbb\x8e\xe3%\x8e\x8b\x91$\xd6\x01H" + - "Eg\xd9\x02\xc7\x1f\xe1x,\x9aD\xc7\x9e9\xf8n" + - "\x8e\x1f\xe1x}]\x12c\x00\xd2a\x07\x7f\x82\xe3/" + - "r\xbcALb=\x80\xf4\x02n\x06\xc8~\x9f\xe3\xaf" + - "!\xc1D,\x89\x0d\x00\xd2yg\xfb\xafr\xf878" + - "\xa27\xd9\x9b\xcbZ\xbe\xc0\xd2\x0a\x08A\x93\xb5-f" + - "\x14UM)\xf0\x9eT\x99\x1e\xad\xa6\x95W5\x7f\x96" + - "\xb0!\xd5J+V?\xa0\x89M\x80i\x01\x9d\x97\x9b" + - "\x00m]/\xf6\xf2\xa7\x10W\xac\xfeQO\x0b^\x19" + - "\x0b\x86\xff,\x11vx\x0e+W`\x8aV.\xf5\x80" + - "P\xccWG\xe8+\xe8\x9b\x95B\xb7\x01B\xdf\xa8\xe8" + - "<9\x14-\xdf\x0d\xa21\xfa\xe1Gu\xda\x898\x88" + - "\x0c3\xcb\x05\xa1V\xf7\xe3\xb7\xce*\x1b\x11\xabae" + - "3<\xb8\xaa,\x8c\x09\xf0\xf1\x1e\xc6o\xc8\x13\xf00" + - "\x95\xc2\xaf\xdd0\xf9\xc3h\x02&37\xb2x\xc7\xa9" + - "\xb1?\xd2&\xe70\x07\xca\"3\xab\xddVK\xe0\xb6" + - "\x128\xdam\x85kj\xb2\x896\xc6\x14\x0bL/7" + - "+\x15%\x94\xd5\x811\xf1\\V\xd8\x97\xf8.\xab\xc8" + - "\xc1~\x01e\x8b;\x98\xe9\xae[\x19\xe0o\x97\x04\x94" + - "\x1f n=\xf7\xe8yG\xc7\x08\x10\x8c\x00v\x9aV" + - "^/[\xde\x09\xf8Of\x18\xfe\x81,\xb5\xc8\xf2\x9f" + - "/[\xa1\x1e1\xb96\xcd/Rp\x8f\x18\xba\xec\xad" + - "\xa1\xcb\xceU\xc8\x107\xd2j\x1ec@06AC" + - "^\x19\xe2|\xb1\xa4\x7f\xc7\x0f\xf2;\x1e\x12P\xde\x1d" + - "L\x04\xbak\x03\x80\xbcS@\xf9+\\;\xe2\x0a\xba" + - "\xd7\x00\x90\x1f\x11P>@\x10#\xae\x9e\xfb\xf6\x03\xc8" + - "\x07\x04\x94\x8f\x10L\x08\xce\x1c\xa0\x87\xb9\xc6O\x08(" + - "?32CL=w\x1f\xb3\xaa\xba\xae3C\x99i" + - "B\xab\xaak\xabBdK/uo\xb1\x18\x1aY\xde" + - "\x83{u\xdcR\x93\xa7\x9fDgq\xca\xce\xc2\x1a\xcb" + - "\xcewx\x93\xe8.\xe3+t\xdf\xe2\xfeo\xbec\xd3" + - "J\xdc\xa8\xe9\xfb\xd9\xb7\xbc\x138\xa9g`\x8d\xdb\xd7" + - "\x0d\x97\xd0\xcds'\x99\xa2\x17\x01\xfc\xdc&F\xa6\xac" + - "\xf1\xdaZ\xa5Y\xcc\xd8\xa2\xe4\x90M\xec\x931TN" + - "\xb3}\xdbS\xef\xf8\x92\x187\x02I\xf4\xbfp$\x8a" + - "\xcb\x01\xb2S8|3\x06\x1f9R3\xce\x00\xc8&" + - "8~\x8bc{\x88k{\xa6b;@6\xc9\xf1\xe9" + - "\x8e\xedq\xd3]\x9a\xe6\x84\xbf\x85\xe3\xb3\x1d\xdb\x13q" + - "m\xcf,\x87\x1f\xb8-1\xea\xda\x9e9\x8e]\xf1\xdd" + - "\x16\x8d\xd5\xb9\xb6g\xa1c\x93\x02\xbbU/\xba\xb6g" + - "\xa9\x13\x7f\x09\xc7WT\xec\x0dw=\xdd\x8e\xbd\xe9\xe2" + - "\xf0\x1a$h\x97\x0c=\xc7Ls\x15\xa0\xdf$<\xfb" + - "\xea\x15\x95h)}\xde\xdf\x9d\\T\xd5\x0aY\"\xb5" + - "\x90_\xa1X\x80\xcc\xa7X\x8a\xd1\xc7\x02\x8aQ6-" + - "\xae4\x88\xa1\x98vN1\xfa\xf4\xbb\x98\x01qs\x14" + - "\xbc\xce`\xa1x\xff\x8f\x11\x11L\xad\xb1;\x9a\xf79" + - ";\xb2\xa1U&\xc4^\x9e\xef\xbb\xdd\xe6E#]n" + - "G\x0bw\xaf\x84\xebl\xe9S\x1c\xfb\xb6\x80\xf2s#" + - ";\x1aOY\xbdleA`9\xef\xe3|G\xc5\x8e" + - "U\x1b\xb11\xec\xe5\xa4\x05\xa96\x0e5\xbb\x15\xff\x03" + - "y\x02\xadd\xf4\x7f\xe22\xcc\x8c\xd7\xfe\x1f1\xffC" + - "{\x02kW\xfd3\xc3\x0b\x9bF\xfco\x00\x00\x00\xff" + - "\xff\x9e\x9f\xe5\xa3" +type Conmon_createNamespaces_Params capnp.Struct + +// Conmon_createNamespaces_Params_TypeID is the unique identifier for the type Conmon_createNamespaces_Params. +const Conmon_createNamespaces_Params_TypeID = 0x8b4c03a0662a38dc + +func NewConmon_createNamespaces_Params(s *capnp.Segment) (Conmon_createNamespaces_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return Conmon_createNamespaces_Params(st), err +} + +func NewRootConmon_createNamespaces_Params(s *capnp.Segment) (Conmon_createNamespaces_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return Conmon_createNamespaces_Params(st), err +} + +func ReadRootConmon_createNamespaces_Params(msg *capnp.Message) (Conmon_createNamespaces_Params, error) { + root, err := msg.Root() + return Conmon_createNamespaces_Params(root.Struct()), err +} + +func (s Conmon_createNamespaces_Params) String() string { + str, _ := text.Marshal(0x8b4c03a0662a38dc, capnp.Struct(s)) + return str +} + +func (s Conmon_createNamespaces_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (Conmon_createNamespaces_Params) DecodeFromPtr(p capnp.Ptr) Conmon_createNamespaces_Params { + return Conmon_createNamespaces_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s Conmon_createNamespaces_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s Conmon_createNamespaces_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Conmon_createNamespaces_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Conmon_createNamespaces_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Conmon_createNamespaces_Params) Request() (Conmon_CreateNamespacesRequest, error) { + p, err := capnp.Struct(s).Ptr(0) + return Conmon_CreateNamespacesRequest(p.Struct()), err +} + +func (s Conmon_createNamespaces_Params) HasRequest() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Conmon_createNamespaces_Params) SetRequest(v Conmon_CreateNamespacesRequest) error { + return capnp.Struct(s).SetPtr(0, capnp.Struct(v).ToPtr()) +} + +// NewRequest sets the request field to a newly +// allocated Conmon_CreateNamespacesRequest struct, preferring placement in s's segment. +func (s Conmon_createNamespaces_Params) NewRequest() (Conmon_CreateNamespacesRequest, error) { + ss, err := NewConmon_CreateNamespacesRequest(capnp.Struct(s).Segment()) + if err != nil { + return Conmon_CreateNamespacesRequest{}, err + } + err = capnp.Struct(s).SetPtr(0, capnp.Struct(ss).ToPtr()) + return ss, err +} + +// Conmon_createNamespaces_Params_List is a list of Conmon_createNamespaces_Params. +type Conmon_createNamespaces_Params_List = capnp.StructList[Conmon_createNamespaces_Params] + +// NewConmon_createNamespaces_Params creates a new list of Conmon_createNamespaces_Params. +func NewConmon_createNamespaces_Params_List(s *capnp.Segment, sz int32) (Conmon_createNamespaces_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[Conmon_createNamespaces_Params](l), err +} + +// Conmon_createNamespaces_Params_Future is a wrapper for a Conmon_createNamespaces_Params promised by a client call. +type Conmon_createNamespaces_Params_Future struct{ *capnp.Future } + +func (f Conmon_createNamespaces_Params_Future) Struct() (Conmon_createNamespaces_Params, error) { + p, err := f.Future.Ptr() + return Conmon_createNamespaces_Params(p.Struct()), err +} +func (p Conmon_createNamespaces_Params_Future) Request() Conmon_CreateNamespacesRequest_Future { + return Conmon_CreateNamespacesRequest_Future{Future: p.Future.Field(0, nil)} +} + +type Conmon_createNamespaces_Results capnp.Struct + +// Conmon_createNamespaces_Results_TypeID is the unique identifier for the type Conmon_createNamespaces_Results. +const Conmon_createNamespaces_Results_TypeID = 0x8aef91973dc8a4f5 + +func NewConmon_createNamespaces_Results(s *capnp.Segment) (Conmon_createNamespaces_Results, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return Conmon_createNamespaces_Results(st), err +} + +func NewRootConmon_createNamespaces_Results(s *capnp.Segment) (Conmon_createNamespaces_Results, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return Conmon_createNamespaces_Results(st), err +} + +func ReadRootConmon_createNamespaces_Results(msg *capnp.Message) (Conmon_createNamespaces_Results, error) { + root, err := msg.Root() + return Conmon_createNamespaces_Results(root.Struct()), err +} + +func (s Conmon_createNamespaces_Results) String() string { + str, _ := text.Marshal(0x8aef91973dc8a4f5, capnp.Struct(s)) + return str +} + +func (s Conmon_createNamespaces_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (Conmon_createNamespaces_Results) DecodeFromPtr(p capnp.Ptr) Conmon_createNamespaces_Results { + return Conmon_createNamespaces_Results(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s Conmon_createNamespaces_Results) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s Conmon_createNamespaces_Results) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Conmon_createNamespaces_Results) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Conmon_createNamespaces_Results) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Conmon_createNamespaces_Results) Response() (Conmon_CreateNamespacesResponse, error) { + p, err := capnp.Struct(s).Ptr(0) + return Conmon_CreateNamespacesResponse(p.Struct()), err +} + +func (s Conmon_createNamespaces_Results) HasResponse() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Conmon_createNamespaces_Results) SetResponse(v Conmon_CreateNamespacesResponse) error { + return capnp.Struct(s).SetPtr(0, capnp.Struct(v).ToPtr()) +} + +// NewResponse sets the response field to a newly +// allocated Conmon_CreateNamespacesResponse struct, preferring placement in s's segment. +func (s Conmon_createNamespaces_Results) NewResponse() (Conmon_CreateNamespacesResponse, error) { + ss, err := NewConmon_CreateNamespacesResponse(capnp.Struct(s).Segment()) + if err != nil { + return Conmon_CreateNamespacesResponse{}, err + } + err = capnp.Struct(s).SetPtr(0, capnp.Struct(ss).ToPtr()) + return ss, err +} + +// Conmon_createNamespaces_Results_List is a list of Conmon_createNamespaces_Results. +type Conmon_createNamespaces_Results_List = capnp.StructList[Conmon_createNamespaces_Results] + +// NewConmon_createNamespaces_Results creates a new list of Conmon_createNamespaces_Results. +func NewConmon_createNamespaces_Results_List(s *capnp.Segment, sz int32) (Conmon_createNamespaces_Results_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[Conmon_createNamespaces_Results](l), err +} + +// Conmon_createNamespaces_Results_Future is a wrapper for a Conmon_createNamespaces_Results promised by a client call. +type Conmon_createNamespaces_Results_Future struct{ *capnp.Future } + +func (f Conmon_createNamespaces_Results_Future) Struct() (Conmon_createNamespaces_Results, error) { + p, err := f.Future.Ptr() + return Conmon_createNamespaces_Results(p.Struct()), err +} +func (p Conmon_createNamespaces_Results_Future) Response() Conmon_CreateNamespacesResponse_Future { + return Conmon_CreateNamespacesResponse_Future{Future: p.Future.Field(0, nil)} +} + +const schema_ffaaf7385bc4adad = "x\xda\xb4X{\x8c\x1b\xd5\xf5>\xe7^\xdb\xe3\x0d\xbb" + + "x/\xe3<~+\xf8-\x8d\x12\x14\xc2#\x8fMK" + + "\x886\xda]\x92(M\x9aR\x8f\x9d@E(bb" + + "\xdf\xec:\xd83\xde\x991\xc9\x86\xd2\x10 *\x09\x8f" + + "64\x88.\"Rh\x01AJ\x0a\x94BIZ!" + + "\xf1\x12(\x90\x96\x8dTZP\xdf4\xe5\xa1\x02E%" + + "\"T\xb4S\xdd;\x9e\x87\x1d\x17\xbc\xbb\xed\x7f\xf6\x99" + + "o\xce9\xf7\xdcs\xbf\xf3\xdd\x99_P\xfac\x0b:" + + "R\xed@\xb4[\xe2\x09\xd7\xfe\xe3\x88u\xff\xde\x957" + + "\x00;\x07\x01\xe2\xa8\x00\xf4\xbc\x1b\x9fI\x00\xd5x\xa2" + + "\x0f\xd0=~\xef\x8bK\xef\xdc\xfd\xfe\xae(`vB" + + "\x02\x96J\xc0o\x16\xcf\xdd\xb8\x8f\xae\xb99\x0a\xd0\x13" + + "]\x020\"\x01\xdf\xb82\xb5\xe7;\xd3\xd6K\x80\xfb" + + "A\xcf\xc6\xdf\x8e\xbeu\xc1Oj\xc0\xd1D\x17Q\x0f" + + "&\x14\x00\xf5q\x09~\xe9\xff\xb7^\x9a\xba\xff\x9b\xdf" + + "m\x06~-1\x93\xa8\x1fK\xf0q\x09\xde\xf1\xf6\xc5" + + "O\xac\xbb\xe1\xfd}\xd1\xd0S\x95\x85\"\xf4y\x8a\x00" + + "\x8c\xae\x7f\xeb\xaa\x15\xabR\xdf\xab\xf7\x16\x138My" + + "\x07\xd5\xb2\xa2\x00ug=\xfc\xec\xd8\xae\xdey\xfb\xa3" + + "nV)\xa7\x097\xbat\xb3\xf9\xca\x17\x1f\xde\xaa\x1d" + + "{\xa8\x89\x9b\xed\xcaQT\xf7J7\xea\xf2\xf9\x07_" + + "\xed\x99{\x00\xb4s\xf0\xa4\xdcG\x04\xee\x0eE\xe4\xbe" + + "[\xd9\x0c\xe8.\xba\xe7\xb1'n{o\xcb\x0f\x05\x9a" + + "4\xa2?P\xf6\xa3\xda\x96\x9c\x0e\xa0\xb2\xe4\xc3\x80\xee" + + "5c\xefb\xec~\xe7X\x140\xaa" + + "\xce\x15\x1e\x1e\x95\x80\xa7\xd7\xf7d~\xf5\xc6Y\x7f\x03" + + "\xf6y\x12v\x19`\xcf\x98z\x14\xd5wU\x91\xfb\xdb" + + "j7\xa0;\xf6^\xf7C/\x1d\xfb\xd2\xdf\x9b\xee\xfb" + + "\xdb\xea\xeb\xa8\xc6\xd3\xe2'\xa6/\x10\xfb~\xff\xf0\xf7" + + "\xbf}b&\xfb\xb0\xb1c\xa9\xc0\xac\x9b6\x93\xa8\xd5" + + "i\xe2\xe7\xf04\xb9\xd4'\xef\xda\xf3\xad\xe7\x16\xae\xfc" + + "0\x9a\xe8\xde\xe9\xf2T=>]$\xfa3\xdc\x7f\xca" + + "\xe5\x9b\xde:\x11\x05\xfcr\xba\\\xc9\xbb\x12p\xe2\x9e" + + "\x1f\xf4\\w\xe4\xb1\x8f\x9b\x1c;6c\x0aQ\x17\xcc" + + "P`\x9e\x9b7\x8d\xb2i\x9cg)\xf6\xbc\xbcY." + + "\x9b\xc6\xbc\x8ae:\xe6<\xcf~~^\xaf\x18\x95%" + + "\xcb\xbc?|\x0b\xcf\xe7F\x8c\xfc2\xd3p\xf4\xa2\xc1" + + "\xadY\x19\xddR\xf4\xb2\xad\xc5h\x0c \x86\x00\xac\xe3" + + "\"\x00-IQK\x13\xdcf\xf1\xe1*\xb7\x1d\xec\x0c" + + "W\x0f\x88\x9d\x80\xe3\x0a\x9b\xb7\xb8\xee\xf0\x8b\xf52\xb7" + + "+z\x9e\xdb\xb3\xb2\xdc\xae*%\xa7.\xecj\x00\xad" + + "\x9d\xa26\x83\xa0kq\xbbb\x1a6\x07\x00\xec\x0c9" + + "\xf1\xbf\x11:\xa3[:me\xc1\x01mO \xea\xb2" + + "\x86\xa8Y\xe1\x95\xdaN\x06\xf1?-\xb9\xcc\x1d\xbd\xa0" + + ";\xbaXr\x07\x10\xec\x98tH\xbbb*\x86\xcd\x1b" + + "b\xce\x0d\x17\x9b\xaa\xe8\xce\x10\xb6\x03\xc1\xf6q\x06\xb3" + + "\xb8Y\xe1\xc6\x1as0l\xa4,\xef\xb6\xab-oi" + + "0\x98\x1a\x8a\x9bh!x\xd6\x0f.\x96\x982\xbd%" + + "\x8e+}\xddq\xf4\xfcP\xdd!\xd0\xcb\xd8BO\x04" + + "l7\x81\xb4\x07d\xd0\xacW\x06\xac\xcb\xb9\x95\xd7/" + + "\xe1\x96]4\x0d\xd9I6\xcaNJ\x06\xe9\x9e-\xd2" + + "\x9dEQ\x9bO\x101\x8d\xc2v\x9e\xa8\xfe\xb9\x14\xb5" + + "\xc5\x04\xb7]\xcd\xad\x0d\xa6\xcd\x11\x81\xa0 \xa7O\xeb" + + "\xb6x\x0b\xd9\xac1\x07\x97[\xa9\xe2\xd5\xdc\xd2b\x18" + + "\xe5\\\x9c\x9bZ;R\xe1Z{\x90\xdb\x0a\xd1q\xfd" + + "\x14\xb55an\xab\x84m9E-C\x90\x11L#" + + "\x01`_\x16\x8b\xf8\"Em-\xc1\x943R\xe1\x98" + + "\x0a\x1d\x03b\x0a\xea;v[Y\xdf\x92+n\xe5\xd8" + + "\x06\x04\xdb\xc6\xd9\xc19\xee\\Z4\x0a\xe6f\xe1\xc1" + + "+\xaa\x03\xa2\xa8\x9dA\xe2z\x17\x80v9Em(" + + "L\x9c/\x04\xd0\xae\xa4\xa8\x95\"\x89\x17\x97\x00h\x05" + + "\x8aZ\x85 \xa3\x98F\x0a\xc0\xca\xa2\xfc%\x8a\xda\x16" + + "\x82\xb4X\xf0\x93\xee\xde\\,8C\xa8\x00A\x05\xb0" + + "o\x88\x17\x07\x87\x1c\xff\xef\xa7nK\xec\xb3VEM" + + "C\xebE\x0cu\x18\x1b\xde\x1a\xce86|}(t" + + "\xd8\xf0\xa1p4\xb2j6\x1c\xfa\xac\xfaLH\xf5l" + + "\xe4p(\x1e\xd8\xf6\xa3a\xff\xb3\x9dVD\x15\xee\xdc" + + "\x1a\x11$;wEd\xe7\xad\xb7\x87\xd2\x8d\xed\xde\x1f" + + "\x19iw\xfc(\"\x8cG\x9f\x89\x08\xdf\xbd\x87]\xbf" + + "\xd9\xa1\xcf\xdb\x99\xc0@}\x16\xf1\xe8.8\xc2Y\x1f" + + "(\x1b\xb3x5\x07\xb4\\\x1f\x13\xf7A\xfe\xcb+\x1a" + + "\xc7\xa0\xdf\x00\xe0\xfa\x8fH\xe4Y\xed\xc4\xba\xfe\x09\x86" + + "n/V\xf0\xbf\xcf\xf3\xeb\xfa\xcc\x84\x83\xa1\xc3\xa8\xcd" + + "w\xe47\x1f\xfa\xdd\x97\x92\xfe\x1a\xcdv\xb7\xe7\xd6\xa7" + + "\xf6x\xdd8\xb1\x1dh\xca\xf9\x92c\xb5\xd3i\x1c " + + "\x10\x9a\xe8\xcb*6v\x11\x10\xf6\xbc\x82\xa1>A_" + + "l\xb2\x83\xd7\x03a\x8f*H\x82[\x11\xfa\x1a\x85\xdd" + + "w;\x10v\x8f\x82\xe1m\x01}\x1d\xcc\xee\x10\xef\xdd" + + "\xaa`,\x10g\xe8\xdfL\xd8\xf6\xbb\x80\xb0k\x15\x8c" + + "\x07\xaa\x18}\x0d\xc8\x86\x0f\x01ae\x05\x13\xc1\x1d\x0a" + + "\xfd\xdb\x16\xd3w\x01a_S\x04q\x89\x8d\xefG7" + + "_\xdbM\xac\xed\x0b\xf4\xa3\xeb\xeb\x19\xf4w\x0b\xad~" + + "t}z\x8f\"\xad`\x1bjP\xca\x05\xd4\xae+\xf9" + + "2\xd3\xe8\xf3^\x09\xe2]\xac\xa3_]\x80~\x1c\xef" + + "\xa4il\xd3\x08{\x9f\xeb\x13\x8d:\x1b\xbb\x00rg" + + "\"\xc5\xdc\xb9H\x90\xd5\xc8F=\x1b/\x03\xc8\xcd\x11" + + "\xf6EH\x10\x89\xa4\x1bu\x01\xae\x06\xc8\xcd\x17\xe6^" + + "\x0c\x19G\xbd\x10\x17\x02\xe4\x16\x09{\xbf\xb0\xc7H\x1a" + + "c\x00\xeaR\xcc\x02\xe4z\x85\xfd\xab\xc2\x1e\xa7i\x8c" + + "\x03\xa8\xebp\x13@n\xad\xb0W\x84=\x11Kc\x02" + + "@-\xcb\xb0%a\xbfI\xd8\x95xZhSu\x87" + + "\xb4\xdf(\xec\xfb\x84=\x99Hc\x12@\xdd+\xedw" + + "\x0b\xfb\x93\xc2\xde\xa6\xa4\xb1M\\hq\x03@\xee\xc7" + + "\xc2\xfe\x8a\xb0OI\xa6q\x0a\x80zD\xe6\xff\xb2\xb0" + + "\xff\x1a\xeb\xc8\xd1\xddP5\x0a%\x9e\xd1\x81F\x84\x89" + + "\xc3\xadr\xd1\xd0K\x82\x14k\xf3\xab\xdbv\x0aE#" + + "\x98f|K\xd1\xc9\xe8\xce\x10\xa0\x8d\xa7\x02f(\xca" + + "\x97O\x05tM\xb3\xbcB<\x85\x94\xee\x0c\x9d\xf4\xb4" + + "\xe4\xb3\x05\xb5\x82g\x9d\xd1K\x83D\xe5K\\7\xaa" + + "\x95e@\xcb\x85F\x0f\x83%s\x83^\x1a\xb0\x80\x0e" + + "\x9e\xe4]t\x87n\x14\x06@\xb1N~8Y\xbd\xd7" + + "\xa8a\x84\xa4.\xd1V\xf5W\xc0\xdd\x0dB&\xd9B" + + "d;::\x1bD\x94\x0d\xf0\xd9**\x98\x08\x13P" + + "Q5>h]\xb2\x05\xd3p\xc2\x97\x87\x89\xd68\x98" + + "\xa9\x93\xd3\xb8\xc3U\x85\xdb\x8dz\xaf+\xd4{\xac\x99" + + "\xe0\x8b\x1e\xaa\xc9vZ\x93i\x19\xea\xee\xa8^Z\x1d" + + "j#?\xa7:i\xe4\xeb\xa5\xb20\x0eQ\xd4\x1c\xc1" + + "^gzziX\xbc]\xa1\xa8}\x9dx\x07z\x99" + + "Y\x90\x85\x8c\x01\xc1\x18`\x9f\xed\x14\xcc\xaa\xe3\xaf@" + + "\xfc\xe5\x96\x15,\xc8)\x96y\xe1+U'B\x12\x93" + + "#j\xb1\x93\xd4[b\xa4\xee\x9b\x00\xb49\x14\xb5E" + + "\xe1\x12\x17l\x05\xd0\xe6S\xd4z\x89\x0c)\x1d@\xca" + + "\xca\x14\x0b\x98\x04\x82I@\xd7\xa8\x8dh\xe8\xe3v\xa6" + + "\xd9\xa5k<\x17\x88\x9a\xb2\x10\x99\xa5\x83\xcc\xae\x15\x1d" + + "\xb1\x85\xa2vc\xa4#\xb6_\x06\xa0]GQ\xbbE" + + "T\xdf\x1b\x1fl\xa7\x05\xa0\xddDQ\xdbC\x10\xa9W" + + "\xfc\xdd\xb7\x03h{(j\xfb\xc4\xdc\xa0rn\xb0\xbd" + + "bG\xee\xa6\xa8=P\xdfO\xb6\x99\xbf\x8a;\x0d$" + + "-'1\xb7m\xe8.\x9a\xc6\xaa\x08\xd81+\x03\x1b" + + "\x1d\x8eVNP\xf6\x0a\x137\xb6t\x09\x99\x04\x11\xc9" + + "S\xea`\x8b\xa74P\xa4\x93 \xa3\xf1\xf1B \xc9" + + "'\xc0HM.\xde\x19=e\xb5\xf4\x05'\x90\xe8\x13" + + "X\xa9/\xab\xad\xf3\xd7\x8eT\xd0\xfb\xa6 \xbb)~" + + "\x14 \xe8zbe\xab\x868\x89\xab\x0c\x87[\x1b\xf5" + + "<\xf2\x89\xddq#\x87oN \x93\xda\xa4\x8eI\x0a" + + "\xdd\x90\xc6\xe0\xfc\xa9\x0c/\x02\xc8\xb5\x0b\xf3\x0c\x0cY" + + "F\x9d\x8a3\x01r\x9d\xc2~\xba\x94I\xc4\x93I\xff" + + "\x87K\x00ria?\x13\xc3vW\xcf\x90\xeeO\x17" + + "\xf69R&\xc5<\x994[\xe2Cu\x96\x88{2" + + "\xe9l)o\x02u\xc6\x94\x84'\x93\x16HY\x15\xca" + + "\xb3\xa4\xe2\xc9\xa4\x0b\xa5\xff\xc5\xc2\xbe\\\xca\xa4\xa4'" + + "\x93\x06\xa4\x1c\xea\x17\xf65H\xd0\xadXf\x9e\xdb\xf6" + + "*\xc0\x80?|\x15\xec\x9f*\xc5\xd1\x07\xfd\xdf}\xa2" + + "\xaaE'\"\xa1\x8a\xa5\xc2r\xdd\x01\xe4\x01\xc4\xd1\xad" + + "A\x1eB\xac\xaa\xed\x88R\x83\x12\xf1\xe9\xe6uk\xd0" + + "\xbc\x84[\x90\xb2O2\xaf\xb5x\xc4\xdf\xffb\xa2\x84" + + "S\xae9\xa75\xa7\xb4\xda@\xd9)\x1a\xfe\xc6\x1a}" + + "\xd1~\x8f\xd3\xa2\xf4\xe5kav\x9f0\xdeKQ{" + + "\xa4\x9e\xd3D\xd3\x9aU'\x07\x94\xe7\xfd\xef\x09\xdbj" + + "\xfa\xadQ\xb95\xd1\xa3\x93\xaeH\xa3\xd2hY\xde\x04" + + "W\xfa\x09\x90\xc9\xc9_\x83\xb3\xdcN\xb5\xfe\x11/\xf8" + + "40\x81\xd8\x0d\xdf_|\xb7\x19\xc4\x7f\x07\x00\x00\xff" + + "\xff\xd92\xd47" func init() { schemas.Register(schema_ffaaf7385bc4adad, 0x83479da67279e173, + 0x8aef91973dc8a4f5, + 0x8b4c03a0662a38dc, + 0x8b5b1693940f607e, + 0x9887a60f577a1ecb, 0xa0ef8355b64ee985, 0xa20f49456be85b99, 0xaa2f3c8ad1c3af24, diff --git a/pkg/client/client.go b/pkg/client/client.go index 9d7b2d423a..b49fa03b65 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -646,6 +646,9 @@ const ( type CreateContainerResponse struct { // PID is the container process identifier. PID uint32 + + // NamespacesPath is the base path where the namespaces are mounted. + NamespacesPath string } // CreateContainer can be used to create a new running container instance. @@ -1004,3 +1007,67 @@ func (c *ConmonClient) metadataBytes(ctx context.Context) ([]byte, error) { return metadata, nil } + +// CreateaNamespacesConfig is the configuration for calling the +// CreateNamespaces method. +type CreateaNamespacesConfig struct{} + +// CreateaNamespacesResponse is the response of the CreateNamespaces method. +type CreateaNamespacesResponse struct { + // Path is the base path to the namespaces directory. + Path string +} + +// CreateNamespaces can be used to create a new set of namespaces. +func (c *ConmonClient) CreateNamespaces( + ctx context.Context, cfg *CreateaNamespacesConfig, +) (*CreateaNamespacesResponse, error) { + ctx, span := c.startSpan(ctx, "CreateNamespaces") + if span != nil { + defer span.End() + } + + conn, err := c.newRPCConn() + if err != nil { + return nil, fmt.Errorf("create RPC connection: %w", err) + } + defer conn.Close() + client := proto.Conmon(conn.Bootstrap(ctx)) + + future, free := client.CreateNamespaces(ctx, func(p proto.Conmon_createNamespaces_Params) error { + req, err := p.NewRequest() + if err != nil { + return fmt.Errorf("create request: %w", err) + } + + metadata, err := c.metadataBytes(ctx) + if err != nil { + return fmt.Errorf("get metadata: %w", err) + } + if err := req.SetMetadata(metadata); err != nil { + return fmt.Errorf("set metadata: %w", err) + } + + return nil + }) + defer free() + + result, err := future.Struct() + if err != nil { + return nil, fmt.Errorf("create result: %w", err) + } + + response, err := result.Response() + if err != nil { + return nil, fmt.Errorf("set response: %w", err) + } + + path, err := response.Path() + if err != nil { + return nil, fmt.Errorf("set path: %w", err) + } + + return &CreateaNamespacesResponse{ + Path: path, + }, nil +}