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

[RustFBP][Edge] can't find crate for ... #336

Open
dmichiels opened this issue Oct 10, 2018 · 1 comment
Open

[RustFBP][Edge] can't find crate for ... #336

dmichiels opened this issue Oct 10, 2018 · 1 comment

Comments

@dmichiels
Copy link
Contributor

Steps to reproduce

The idea here is to use a crate in an edge, like cardano_storage.
In a edge file, trying to do :

use cardano_storage::{Storage};

lead to

unresolved import `cardano_storage`

and if we add

extern crate cardano_storage;

we get

 can't find crate for `cardano_storage`

expected behaviour

the code compiles cleanly

Solutions?

RustFBP level

The problem is that for the moment, the edges are all in the "rustfbp" compilation. So if we want to add crate in an edge, we will need to compile RustFBP with the external crate.
This solution also means we will need to compile RustFBP with all the nodes we will use, no way to add a new node while a program is running. Not very dynamic.

The node level

In the past, we used to put all the content of the edge's files on the top of the agent, so that each agent will have to import the external crate needed by the edges. It can lead to some "boiler-plate" and "strange" dependency management.

The edge level

Perhaps it is possible to consider each edge as an entire crate? its will manage its own dependencies. The agent will do :

extern crate cardano_blockchain;
use cardano_blockchain::*;

agent!{
    input( in: CardanoBlockchain)
....

This seems the cleaner solution, even more that we can clean the "boilerplate" import with a macro like the racketone :

edge!(cardano_blockchain);

But it also mean we will have more library to manage (one more for each edge), and also the compilation of the different external crates of each edge (which can be manage with nix, xin, cargo workspace, ...).

The problem with the node level and edge level

We put all the edge declaration at the rustFBP level in this commit, because we had problem with multiple compilation of the RustFBP crate shared by the agent, when connected them together.
It is possible to have another solution, that use "raw pointer", because we now the nodes can be connected (it is the same struct, compiled with the same version of everything). I have a POC of that.

@sjmackenzie
Copy link
Member

Okay, yeah best to settle on using cardano_c bindings in rkt-fbp. Once xin comes into place we can look at the issue of these rustfbp moving pieces more clearly.

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

No branches or pull requests

2 participants