containerd / ttrpc-rust

Rust implementation of ttrpc (GRPC for low-memory environments)
Apache License 2.0
195 stars 45 forks source link

Windows support #132

Closed mxpv closed 1 year ago

mxpv commented 2 years ago

There is a desire to get Windows support in https://github.com/containerd/rust-extensions/issues/4. Since the shim crate mainly depends on ttrpc-rust, I think it make sense to add windows support / CI checks here first. Opening issue mainly for tracking (unfortunately I don't have proper environment to implement this).

jsturtevant commented 1 year ago

I am going to start to look into this

jsturtevant commented 1 year ago

the proto source generation works:

protoc --rust_out=. --ttrpc_out=. --plugin=protoc-gen-ttrpc=C:\Users\user\.cargo\bin\ttrpc_rust_plugin.exe .\oci.proto

Building doesn't not mainly due to the nix package

cargo build
Some errors have detailed explanations: E0412, E0422, E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `ttrpc` due to 58 previous errors
jsturtevant commented 1 year ago

Confirmed the programmatic approach to source generate works as well.

jsturtevant commented 1 year ago

After looking into this a bit, It looks like the current approach in this library mostly uses some form of *nix Domain sockets:

https://github.com/containerd/ttrpc-rust/blob/af10ad4eddc2e5d474d28d871ba8a8814cca3cfa/src/lib.rs#L29-L39

My first idea was to use Windows Unix Domain Socket compatibility to make the integration fairly straightforward.

After looking into a bit more (and talking with @cpuguy83) I realized that Containerd on Windows doesn't currently support UDS only named pipes on Windows, which is one of the big use cases for this library.

My current thoughts are to use https://github.com/tokio-rs/mio to integrate support for named pipes first. I choose library as there is already a indirect dependency through tokio package. Later if there was desire for other use cases beyond Containerd (where is strictly windows named pipes) we could use https://github.com/Azure/mio-uds-windows or https://github.com/tokio-rs/mio/pull/1610 to integrate the UDS support.

@cpuguy83 @mxpv thoughts? I am new to Rust and these projects so if there is another direction, I should take let me know otherwise I will take a go at this and see what it looks like.

jsturtevant commented 1 year ago

quick update, I got the sync project working on windows. I am cleaning it up and adding a build step and should have something to share for feedback soon