You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@teaclave.apache.org by GitBox <gi...@apache.org> on 2022/01/20 22:50:16 UTC

[GitHub] [incubator-teaclave] ya0guang opened a new pull request #601: update Rust and c API for cancel_task

ya0guang opened a new pull request #601:
URL: https://github.com/apache/incubator-teaclave/pull/601


   ## Description
   
   - Update Rust and c API for cancel_task
   - Add new tests for SDK
   - Repaired an error in management service
   
   Fixes # (issue)
   
   ## Type of change (select or add applied and delete the others)
   
   - [X] Bug fix (non-breaking change which fixes an issue)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
   - [X] API change with a documentation update
   - [X] Additional test coverage
   - [ ] Code cleanup or just sync with upstream third-party crates
   
   ## How has this been tested?
   
   ## Checklist
   
   - [X] Fork the repo and create your branch from `master`.
   - [X] If you've added code that should be tested, add tests.
   - [X] If you've changed APIs, update the documentation.
   - [ ] Ensure the tests pass (see CI results).
   - [ ] Make sure your code lints/format.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [incubator-teaclave] mssun merged pull request #601: update Rust and c API for cancel_task

Posted by GitBox <gi...@apache.org>.
mssun merged pull request #601:
URL: https://github.com/apache/incubator-teaclave/pull/601


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [incubator-teaclave] bigdata-memory commented on a change in pull request #601: update Rust and c API for cancel_task

Posted by GitBox <gi...@apache.org>.
bigdata-memory commented on a change in pull request #601:
URL: https://github.com/apache/incubator-teaclave/pull/601#discussion_r791019510



##########
File path: services/management/enclave/src/service.rs
##########
@@ -662,17 +662,24 @@ impl TeaclaveManagement for TeaclaveManagementService {
                 self.enqueue_to_db(CANCEL_QUEUE_KEY.as_bytes(), &ts)?;
             }
             _ => {
+                // early cancelation
                 // race will not affect correctness/privacy
-                let task: Task<Cancel> = ts.try_into().map_err(|e| {
+                let mut task: Task<Cancel> = ts.try_into().map_err(|e| {
                     log::warn!("Cancel state error: {:?}", e);
                     TeaclaveManagementServiceError::PermissionDenied
                 })?;
 
                 log::debug!("Canceled Task: {:?}", task);
 
+                task.update_result(TaskResult::Err(TaskFailure {
+                    reason: "Task canceled".to_string(),
+                }))
+                .map_err(|_| TeaclaveManagementServiceError::PermissionDenied)?;
                 let ts: TaskState = task.into();
                 self.write_to_db(&ts)
                     .map_err(|_| TeaclaveManagementServiceError::StorageError)?;
+
+                log::warn!("Canceled Task writtenback");

Review comment:
       For the consistency, please adding `:` thanks.

##########
File path: services/management/enclave/src/service.rs
##########
@@ -662,17 +662,24 @@ impl TeaclaveManagement for TeaclaveManagementService {
                 self.enqueue_to_db(CANCEL_QUEUE_KEY.as_bytes(), &ts)?;
             }
             _ => {
+                // early cancelation
                 // race will not affect correctness/privacy
-                let task: Task<Cancel> = ts.try_into().map_err(|e| {
+                let mut task: Task<Cancel> = ts.try_into().map_err(|e| {
                     log::warn!("Cancel state error: {:?}", e);
                     TeaclaveManagementServiceError::PermissionDenied
                 })?;
 
                 log::debug!("Canceled Task: {:?}", task);
 
+                task.update_result(TaskResult::Err(TaskFailure {
+                    reason: "Task canceled".to_string(),
+                }))
+                .map_err(|_| TeaclaveManagementServiceError::PermissionDenied)?;
                 let ts: TaskState = task.into();
                 self.write_to_db(&ts)
                     .map_err(|_| TeaclaveManagementServiceError::StorageError)?;
+
+                log::warn!("Canceled Task writtenback");

Review comment:
       like `Canceled task: writtenback`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [incubator-teaclave] bigdata-memory commented on a change in pull request #601: update Rust and c API for cancel_task

Posted by GitBox <gi...@apache.org>.
bigdata-memory commented on a change in pull request #601:
URL: https://github.com/apache/incubator-teaclave/pull/601#discussion_r791019510



##########
File path: services/management/enclave/src/service.rs
##########
@@ -662,17 +662,24 @@ impl TeaclaveManagement for TeaclaveManagementService {
                 self.enqueue_to_db(CANCEL_QUEUE_KEY.as_bytes(), &ts)?;
             }
             _ => {
+                // early cancelation
                 // race will not affect correctness/privacy
-                let task: Task<Cancel> = ts.try_into().map_err(|e| {
+                let mut task: Task<Cancel> = ts.try_into().map_err(|e| {
                     log::warn!("Cancel state error: {:?}", e);
                     TeaclaveManagementServiceError::PermissionDenied
                 })?;
 
                 log::debug!("Canceled Task: {:?}", task);
 
+                task.update_result(TaskResult::Err(TaskFailure {
+                    reason: "Task canceled".to_string(),
+                }))
+                .map_err(|_| TeaclaveManagementServiceError::PermissionDenied)?;
                 let ts: TaskState = task.into();
                 self.write_to_db(&ts)
                     .map_err(|_| TeaclaveManagementServiceError::StorageError)?;
+
+                log::warn!("Canceled Task writtenback");

Review comment:
       For the consistency, please adding `:` thanks.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [incubator-teaclave] ya0guang commented on a change in pull request #601: update Rust and c API for cancel_task

Posted by GitBox <gi...@apache.org>.
ya0guang commented on a change in pull request #601:
URL: https://github.com/apache/incubator-teaclave/pull/601#discussion_r791090534



##########
File path: services/management/enclave/src/service.rs
##########
@@ -662,17 +662,24 @@ impl TeaclaveManagement for TeaclaveManagementService {
                 self.enqueue_to_db(CANCEL_QUEUE_KEY.as_bytes(), &ts)?;
             }
             _ => {
+                // early cancelation
                 // race will not affect correctness/privacy
-                let task: Task<Cancel> = ts.try_into().map_err(|e| {
+                let mut task: Task<Cancel> = ts.try_into().map_err(|e| {
                     log::warn!("Cancel state error: {:?}", e);
                     TeaclaveManagementServiceError::PermissionDenied
                 })?;
 
                 log::debug!("Canceled Task: {:?}", task);
 
+                task.update_result(TaskResult::Err(TaskFailure {
+                    reason: "Task canceled".to_string(),
+                }))
+                .map_err(|_| TeaclaveManagementServiceError::PermissionDenied)?;
                 let ts: TaskState = task.into();
                 self.write_to_db(&ts)
                     .map_err(|_| TeaclaveManagementServiceError::StorageError)?;
+
+                log::warn!("Canceled Task writtenback");

Review comment:
       Thanks! Just adde`:`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [incubator-teaclave] bigdata-memory commented on a change in pull request #601: update Rust and c API for cancel_task

Posted by GitBox <gi...@apache.org>.
bigdata-memory commented on a change in pull request #601:
URL: https://github.com/apache/incubator-teaclave/pull/601#discussion_r791021094



##########
File path: services/management/enclave/src/service.rs
##########
@@ -662,17 +662,24 @@ impl TeaclaveManagement for TeaclaveManagementService {
                 self.enqueue_to_db(CANCEL_QUEUE_KEY.as_bytes(), &ts)?;
             }
             _ => {
+                // early cancelation
                 // race will not affect correctness/privacy
-                let task: Task<Cancel> = ts.try_into().map_err(|e| {
+                let mut task: Task<Cancel> = ts.try_into().map_err(|e| {
                     log::warn!("Cancel state error: {:?}", e);
                     TeaclaveManagementServiceError::PermissionDenied
                 })?;
 
                 log::debug!("Canceled Task: {:?}", task);
 
+                task.update_result(TaskResult::Err(TaskFailure {
+                    reason: "Task canceled".to_string(),
+                }))
+                .map_err(|_| TeaclaveManagementServiceError::PermissionDenied)?;
                 let ts: TaskState = task.into();
                 self.write_to_db(&ts)
                     .map_err(|_| TeaclaveManagementServiceError::StorageError)?;
+
+                log::warn!("Canceled Task writtenback");

Review comment:
       like `Canceled task: writtenback`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [incubator-teaclave] ya0guang commented on a change in pull request #601: update Rust and c API for cancel_task

Posted by GitBox <gi...@apache.org>.
ya0guang commented on a change in pull request #601:
URL: https://github.com/apache/incubator-teaclave/pull/601#discussion_r791090534



##########
File path: services/management/enclave/src/service.rs
##########
@@ -662,17 +662,24 @@ impl TeaclaveManagement for TeaclaveManagementService {
                 self.enqueue_to_db(CANCEL_QUEUE_KEY.as_bytes(), &ts)?;
             }
             _ => {
+                // early cancelation
                 // race will not affect correctness/privacy
-                let task: Task<Cancel> = ts.try_into().map_err(|e| {
+                let mut task: Task<Cancel> = ts.try_into().map_err(|e| {
                     log::warn!("Cancel state error: {:?}", e);
                     TeaclaveManagementServiceError::PermissionDenied
                 })?;
 
                 log::debug!("Canceled Task: {:?}", task);
 
+                task.update_result(TaskResult::Err(TaskFailure {
+                    reason: "Task canceled".to_string(),
+                }))
+                .map_err(|_| TeaclaveManagementServiceError::PermissionDenied)?;
                 let ts: TaskState = task.into();
                 self.write_to_db(&ts)
                     .map_err(|_| TeaclaveManagementServiceError::StorageError)?;
+
+                log::warn!("Canceled Task writtenback");

Review comment:
       Thanks! Just adde`:`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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