apache / incubator-teaclave

Apache Teaclave (incubating) is an open source universal secure computing platform, making computation on privacy-sensitive data safe and simple.
https://teaclave.apache.org
Apache License 2.0
759 stars 158 forks source link

A little idea about arranging the project structure #236

Open sammyne opened 4 years ago

sammyne commented 4 years ago

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)

|-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

Pro:

Just some personal ideas ~

mssun commented 4 years ago

Thanks, I suggest we can discuss this proposal in several aspects:

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.

sammyne commented 4 years ago

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 😄 @mssun

mssun commented 4 years ago

I see. Okay, then it seems that the compilation time won't be changed.