Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add call_foreign function #84

Closed
wants to merge 34 commits into from
Closed

Add call_foreign function #84

wants to merge 34 commits into from

Conversation

Gsantomaggio
Copy link
Contributor

Signed-off-by: Gabriele Santomaggio g.santomaggio@gmail.com

Tested using:

 let compress = String::from_utf8(vec![b'a'; 20]);
            match compress {
                Ok(v) => {
                    let res = self.call_foreign_function("compress", Some(v.as_ref()));
                    info!("[foreign_test] compress {:?}", res);
                    let resw = self.call_foreign_function("uncompress", Some(res.unwrap().as_ref()));

                    info!("[foreign_test] uncompress {:?}", resw);

                }
                Err(_) => {}
            }

result:

[foreign_test] compress Some([120, 156, 75, 76, 196, 4, 0, 79, 166, 7, 149])
[foreign_test] uncompress Some([97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97])

@zhenjunMa
Copy link

I also need this feature

@PiotrSikora could you please review this PR?

@PiotrSikora
Copy link
Member

This is blocked on #64, since there were no foreign functions in ABI v0.1.0, which Rust SDK implements. It should be merged over the next few days, and then this can be revived.

(Sorry, I was sure I mentioned this before, but I don't see my comment.)

@jcruger-godaddy
Copy link

Seems this can be considered now? Thanks for your work @PiotrSikora

@Gsantomaggio
Copy link
Contributor Author

Hi @PiotrSikora
Is there something I can do? ( I Opened this PR)
Thank you

@PiotrSikora
Copy link
Member

Hi @Gsantomaggio! Sorry for the delay. It looks fine, but I wanted to run some tests and use it with existing foreign functions before merging it. Unfortunately, I'm still wrapped in restarting work on C++ Host (which has a much bigger lead-time) and fixing some recent regressions, and I didn't have time to get back to Rust SDK yet. Hopefully, I'll be able to do that next week.

@PiotrSikora PiotrSikora added this to the v0.2.0 milestone Apr 5, 2022
Copy link
Member

@PiotrSikora PiotrSikora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few suggestions (nits + NotFound), but it looks good otherwise.

Thanks and again sorry for the delay!

src/hostcalls.rs Outdated Show resolved Hide resolved
src/hostcalls.rs Outdated Show resolved Hide resolved
src/hostcalls.rs Outdated Show resolved Hide resolved
src/hostcalls.rs Outdated Show resolved Hide resolved
src/traits.rs Outdated Show resolved Hide resolved
src/traits.rs Outdated Show resolved Hide resolved
Gsantomaggio and others added 22 commits April 5, 2022 16:09
Signed-off-by: Gabriele Santomaggio <g.santomaggio@gmail.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Co-authored-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Co-authored-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Co-authored-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Co-authored-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Co-authored-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
While there, add support for generating BUILD files
with Bazel using @cargo_raze//:raze.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Rei Shimizu <Shikugawa@gmail.com>
Signed-off-by: Shikugawa <Shikugawa@gmail.com>
While there, unify style and unwrap errors in gRPC traits.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
PiotrSikora and others added 12 commits April 5, 2022 16:10
Partially addresses #25.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Found by clippy's needless_borrow check.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Yaroslav Skopets <yaroslav@tetrate.io>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Fixes issues with addlicense requiring Go v1.16+.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Martijn Swaagman <martijn@swaagman.online>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Martijn Swaagman <martijn@swaagman.online>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Martijn Swaagman <martijn@swaagman.online>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Martijn Swaagman <martijn@swaagman.online>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
@Gsantomaggio
Copy link
Contributor Author

That's interesting, I followed the DCO instruction. but something went wrong.
I am going to close this PR will open another one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants