You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by ms...@apache.org on 2020/06/04 00:09:54 UTC

[incubator-teaclave] branch master updated: Add docs for the file agent and examples directory (#335)

This is an automated email from the ASF dual-hosted git repository.

mssun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git


The following commit(s) were added to refs/heads/master by this push:
     new 52ee432  Add docs for the file agent and examples directory (#335)
52ee432 is described below

commit 52ee4329ad0903d3aa9cf8a9a1575c16f0df18ed
Author: Mingshen Sun <bo...@mssun.me>
AuthorDate: Wed Jun 3 17:09:45 2020 -0700

    Add docs for the file agent and examples directory (#335)
---
 README.md                                        |  2 ++
 examples/README.md                               | 24 +++++++++++++++++++++++-
 file_agent/README.md                             | 17 +++++++++++++++++
 tests/functional/enclave/src/frontend_service.rs |  8 ++++----
 4 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index 97f38f8..56774d1 100644
--- a/README.md
+++ b/README.md
@@ -51,6 +51,8 @@ platform, making computation on privacy-sensitive data safe and simple.
 - [Configurations in Teaclave](config)
 - [Data Center Attestation Service](dcap)
 - [Dockerfile and Compose File](docker)
+- [Examples](examples)
+- [File Agent](file_agent)
 - [Function Executors](executor)
 - [Keys and Certificates](keys)
 - [RPC](rpc)
diff --git a/examples/README.md b/examples/README.md
index 1e107f5..861d719 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -1 +1,23 @@
-examples
+---
+permalink: /examples
+---
+
+# Examples
+
+In this directory, we implement some examples to illustrate how to register
+input/output data for a function, create and invoke a task and get execution
+results with the Teclave's client SDK in both single and multi-party setups.
+
+Before trying these examples, please make sure all services in the Teaclave
+platform has been properly launched. Also, for examples implemented in Python,
+don't forget to set the `PYTHONPATH` to the `sdk` path so that the scripts can
+successfully import the `teaclave` module.
+
+For instance, use the following command to invoke an echo function in Teaclave:
+
+```
+$ PYTHONPATH=../../sdk/python python3 builtin_echo.py 'Hello, Teaclave!'
+```
+
+Please checkout the sources of these examples to learn more about the process of
+invoking a function in Teaclave.
diff --git a/file_agent/README.md b/file_agent/README.md
new file mode 100644
index 0000000..a288eb2
--- /dev/null
+++ b/file_agent/README.md
@@ -0,0 +1,17 @@
+---
+permalink: /file-agent
+---
+
+# File Agent
+
+The file agent is a component in the execution service. The main function is to
+handle file downloading/uploading from and to various storage service providers
+(e.g., AWS S3).
+
+Before executing a task, the execution service will use the file agent to
+prepare any registered input files comes with the task. For example, the
+registered file input could be a presigned URL from AWS S3. The file agent will
+download and prepare the file in local. With these files in the local storage,
+the executor can finally invoke the function. Similarly, after the task is
+successfully executed, the file agent will help to upload the output files to
+a remote file storage like S3.
diff --git a/tests/functional/enclave/src/frontend_service.rs b/tests/functional/enclave/src/frontend_service.rs
index 1ad2352..9a7f6c6 100644
--- a/tests/functional/enclave/src/frontend_service.rs
+++ b/tests/functional/enclave/src/frontend_service.rs
@@ -58,13 +58,13 @@ fn test_update_input_file() {
     let cmac = FileAuthTag::mock();
     let crypto_info = FileCrypto::default();
 
-    let request = RegisterInputFileRequest::new(url.clone(), cmac, crypto_info);
+    let request = RegisterInputFileRequest::new(url, cmac, crypto_info);
     let response = authorized_client().register_input_file(request);
     assert!(response.is_ok());
 
     let old_data_id = response.unwrap().data_id;
     let new_url = Url::parse("https://external-storage.com/filepath-new?presigned_token").unwrap();
-    let update_request = UpdateInputFileRequest::new(old_data_id.clone(), new_url.clone());
+    let update_request = UpdateInputFileRequest::new(old_data_id.clone(), new_url);
     let update_response = authorized_client().update_input_file(update_request);
     assert!(update_response.is_ok());
     assert!(old_data_id != update_response.unwrap().data_id);
@@ -89,13 +89,13 @@ fn test_update_output_file() {
     let url = Url::parse("https://external-storage.com/filepath?presigned_token").unwrap();
     let crypto_info = FileCrypto::default();
 
-    let request = RegisterOutputFileRequest::new(url.clone(), crypto_info);
+    let request = RegisterOutputFileRequest::new(url, crypto_info);
     let response = authorized_client().register_output_file(request);
     assert!(response.is_ok());
 
     let old_data_id = response.unwrap().data_id;
     let new_url = Url::parse("https://external-storage.com/filepath-new?presigned_token").unwrap();
-    let update_request = UpdateOutputFileRequest::new(old_data_id.clone(), new_url.clone());
+    let update_request = UpdateOutputFileRequest::new(old_data_id.clone(), new_url);
     let update_response = authorized_client().update_output_file(update_request);
     assert!(update_response.is_ok());
     assert!(old_data_id != update_response.unwrap().data_id);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org