You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@teaclave.apache.org by Sammy <no...@github.com> on 2020/03/10 14:09:16 UTC

[apache/incubator-teaclave] A little idea about arranging the project structure (#236)

Currently, compiling the project relies heavily on the cmake, rendering CMakeLists.txt so large. That's not so friendly for starters to play with it.

It would be nice if the the CMakeLists.txt is slimmed down, delegating part of its job to cargo workspaces, which would make the CMakeLists.txt easier to understand.

Therefore comes the proposal of arranging the project structure as follows (only `examples`, `services` folders is of interest)


```text
|-teaclave
    |-...
    |-examples  // A CARGO WORKSPACE 
        |-CMakeLists.txt // passing env variables to help building examples
        |-Cargo.toml    // just list the examples of interest, and exclude any dislikes
    |-...
    |-services
        |-apps  // A CARGO WORKSPACE, gathering all untrusted applications driven by enclaves
            |-CMakeLists.txt // passing env variables to help building apps
            |-Cargo.toml    // lists all apps
            |-access_control    // the app part of the access control service 
            |-authentication    // the app part of the authentication service
            |-execution         // the app part of the execution service
            |-frontend          // the app part of frontend service
            |-management        // the app part of the management service
            |-scheduler         // the app part of the scheduler service
            |-storage           // the app part of the storage service
        |-enclaves  // A CARGO WORKSPACE,  gathering all trusted enclaves
            |-CMakeLists.txt // passing env variables to help building enclaves
            |-Cargo.toml    // lists all enclaves
            |-access_control    // the enclave part of the access control service 
            |-authentication    // the enclave part of the authentication service
            |-execution         // the enclave part of the execution service
            |-frontend          // the enclave part of frontend service
            |-management        // the enclave part of the management service
            |-scheduler         // the enclave part of the scheduler service
            |-storage           // the enclave part of the storage service
```

Pro:
- Crates serving similar functions are categorized into the same workspace
- It's clear to see the trusted and untrusted parts
- The utility cmake function like `add_cargo_build_target` can be removed
- Some utility scripts such as `setup_cmake_tomls` and `parse_cargo_package.py` can be removed
- The Cargo.*.toml in cmake/tomls designated for the virtual cargo workspaces now go into the actual 
    place, rather than the ones built indirectly by cmake
- Delegating some jobs from cmake to cargo should make the CMakeLists.txt not so large, which is 
    good for guys interested to dig into the project

Just some personal ideas ~

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave/issues/236

Re: [apache/incubator-teaclave] A little idea about arranging the project structure (#236)

Posted by Mingshen Sun <no...@github.com>.
I see. Okay, then it seems that the compilation time won't be changed.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave/issues/236#issuecomment-597452652

Re: [apache/incubator-teaclave] A little idea about arranging the project structure (#236)

Posted by Sammy <no...@github.com>.
Under every relevant folders (services/tests), the **cmake targets** to build enclaves should depend on the ones to build apps, and this dependency is achieved through CMakeLists.txt in the services/tests folders.


So I don't get the following point~

> For the current proposal, I believe the tests apps/enclaves will be compiled separately, resulting compiling same crates twice

Help me out, please 😄 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave/issues/236#issuecomment-597405757

Re: [apache/incubator-teaclave] A little idea about arranging the project structure (#236)

Posted by Mingshen Sun <no...@github.com>.
Thanks, I suggest we can discuss this proposal in several aspects:
  - readability
  - complexity of the building system (maintenance, adding/deleting new services, etc.)
  - compilation time

I also added test in your proposal:

```
|-teaclave
    |-...
    |-examples  // A CARGO WORKSPACE 
        |-CMakeLists.txt // passing env variables to help building examples
        |-Cargo.toml    // just list the examples of interest, and exclude any dislikes
        |-hello-world   // examples
        |-...
    |-...
    |-services
        |-apps  // A CARGO WORKSPACE, gathering all untrusted applications driven by enclaves
            |-CMakeLists.txt // passing env variables to help building apps
            |-Cargo.toml    // lists all apps
            |-access_control    // the app part of the access control service 
            |-authentication    // the app part of the authentication service
            |-execution         // the app part of the execution service
            |-frontend          // the app part of frontend service
            |-management        // the app part of the management service
            |-scheduler         // the app part of the scheduler service
            |-storage           // the app part of the storage service
        |-enclaves  // A CARGO WORKSPACE,  gathering all trusted enclaves
            |-CMakeLists.txt // passing env variables to help building enclaves
            |-Cargo.toml    // lists all enclaves
            |-access_control    // the enclave part of the access control service 
            |-authentication    // the enclave part of the authentication service
            |-execution         // the enclave part of the execution service
            |-frontend          // the enclave part of frontend service
            |-management        // the enclave part of the management service
            |-scheduler         // the enclave part of the scheduler service
            |-storage           // the enclave part of the storage service
        |-proto
    |-tests
        |-apps            
            |-CMakeLists.txt
            |-Cargo.toml
            |-functional
            |-integration
            |-unit
        |-enclaves
            |-CMakeLists.txt
            |-Cargo.toml
            |-functional
            |-integration
            |-unit
        |-fixtures
        |-...

```

The only draw back for me is code of same service are separated in two different places. Another important issue we need to take consideration is the compilation performance. We don't want to see any downgrade on the compilation time caused by multiple compilation. For the current proposal, I believe the tests apps/enclaves will be compiled separately, resulting compiling same crates twice.

In terms of our building system with cmake, I'm not sure whether this will make it more simpler. I can imagine that our previous workarounds with symlinks can be removed.

Overall, I'm okay with the new directory organization. However, since this is a major changes of a lot of files, I'd like to suggest to put this change on hold before we finished all service implementations to avoid potential merging conflicts.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave/issues/236#issuecomment-597331077