diff --git a/edgeless_api/proto/messages.proto b/edgeless_api/proto/messages.proto index 61c26149..63a369d7 100644 --- a/edgeless_api/proto/messages.proto +++ b/edgeless_api/proto/messages.proto @@ -461,8 +461,6 @@ message ResourceInstanceSpecification { string resource_class_type = 1; // Resource configuration (depends on the type). map configuration = 2; - // Mapping of the outputs to concrete function/resource instances. - map output_mapping = 3; } // Message containing information provided as response to failed request. diff --git a/edgeless_api/src/coap_impl/resource_configuration.rs b/edgeless_api/src/coap_impl/resource_configuration.rs index 1fb9303f..0a355c96 100644 --- a/edgeless_api/src/coap_impl/resource_configuration.rs +++ b/edgeless_api/src/coap_impl/resource_configuration.rs @@ -8,12 +8,7 @@ impl crate::resource_configuration::ResourceConfigurationAPI anyhow::Result> { - let mut outputs = heapless::Vec::<(&str, edgeless_api_core::instance_id::InstanceId), 16>::new(); let mut configuration = heapless::Vec::<(&str, &str), 16>::new(); - for (key, val) in &instance_specification.output_mapping { - outputs.push((key, *val)).map_err(|_| anyhow::anyhow!("Too many outputs"))?; - } - for (key, val) in &instance_specification.configuration { configuration .push((key, val)) @@ -22,7 +17,6 @@ impl crate::resource_configuration::ResourceConfigurationAPI Some((name.to_string(), val)), - Err(_) => None, - } - }) - .collect(), }) } @@ -33,11 +22,6 @@ impl ResourceConfigurationConverters { crate::grpc_impl::api::ResourceInstanceSpecification { resource_class_type: crate_spec.class_type.clone(), configuration: crate_spec.configuration.clone(), - output_mapping: crate_spec - .output_mapping - .iter() - .map(|(name, id)| (name.to_string(), CommonConverters::serialize_instance_id(id))) - .collect(), } } } diff --git a/edgeless_api/src/resource_configuration.rs b/edgeless_api/src/resource_configuration.rs index 7b8e9405..23f49a4e 100644 --- a/edgeless_api/src/resource_configuration.rs +++ b/edgeless_api/src/resource_configuration.rs @@ -7,8 +7,6 @@ use crate::common::PatchRequest; #[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize)] pub struct ResourceInstanceSpecification { pub class_type: String, - #[serde(skip)] - pub output_mapping: std::collections::HashMap, // XXX pub configuration: std::collections::HashMap, } diff --git a/edgeless_api_core/src/resource_configuration.rs b/edgeless_api_core/src/resource_configuration.rs index 5e4768b4..1a2ba5d4 100644 --- a/edgeless_api_core/src/resource_configuration.rs +++ b/edgeless_api_core/src/resource_configuration.rs @@ -5,7 +5,6 @@ #[derive(Clone, PartialEq, Eq)] pub struct EncodedResourceInstanceSpecification<'a> { pub class_type: &'a str, - pub output_mapping: heapless::Vec<(&'a str, crate::instance_id::InstanceId), 16>, pub configuration: heapless::Vec<(&'a str, &'a str), 16>, } @@ -18,13 +17,6 @@ pub struct EncodedPatchRequest<'a> { impl minicbor::Encode for EncodedResourceInstanceSpecification<'_> { fn encode(&self, e: &mut minicbor::Encoder, _ctx: &mut C) -> Result<(), minicbor::encode::Error> { let mut e = e.str(self.class_type)?; - { - e = e.array(self.output_mapping.len() as u64)?; - for data in &self.output_mapping { - e = e.encode(data)?; - } - } - { e = e.array(self.configuration.len() as u64)?; for data in &self.configuration { @@ -38,20 +30,14 @@ impl minicbor::Encode for EncodedResourceInstanceSpecification<'_> { impl<'b, C> minicbor::Decode<'b, C> for EncodedResourceInstanceSpecification<'b> { fn decode(d: &mut minicbor::Decoder<'b>, _ctx: &mut C) -> Result { let id = d.str()?; - let mut outputs = heapless::Vec::<(&'b str, crate::instance_id::InstanceId), 16>::new(); let mut configuration = heapless::Vec::<(&'b str, &'b str), 16>::new(); - for item in d.array_iter::<(&str, crate::instance_id::InstanceId)>().unwrap().flatten() { - let _ = outputs.push(item); - } - for item in d.array_iter::<(&str, &str)>().unwrap().flatten() { let _ = configuration.push(item); } Ok(EncodedResourceInstanceSpecification { class_type: id, - output_mapping: outputs, configuration, }) } @@ -61,8 +47,6 @@ impl minicbor::CborLen for EncodedResourceInstanceSpecification<'_> { fn cbor_len(&self, ctx: &mut C) -> usize { let mut len: usize = self.class_type.cbor_len(ctx); - len += self.output_mapping[..self.output_mapping.len()].cbor_len(ctx); - len += self.configuration[..self.configuration.len()].cbor_len(ctx); len @@ -136,7 +120,6 @@ mod test { let id = super::EncodedResourceInstanceSpecification { class_type: "class-1", - output_mapping: outputs, configuration, }; diff --git a/edgeless_con/src/controller/controller_task.rs b/edgeless_con/src/controller/controller_task.rs index f3f1fccc..6806318e 100644 --- a/edgeless_con/src/controller/controller_task.rs +++ b/edgeless_con/src/controller/controller_task.rs @@ -638,7 +638,6 @@ impl ControllerTask { .start(edgeless_api::resource_configuration::ResourceInstanceSpecification { class_type: resource.class_type.clone(), configuration: resource.configurations.clone(), - output_mapping: std::collections::HashMap::new(), }) .await; diff --git a/edgeless_embedded/src/resource/mock_sensor.rs b/edgeless_embedded/src/resource/mock_sensor.rs index 58cd1609..ce823b25 100644 --- a/edgeless_embedded/src/resource/mock_sensor.rs +++ b/edgeless_embedded/src/resource/mock_sensor.rs @@ -22,7 +22,7 @@ impl MockSensor { async fn parse_configuration<'a>( data: edgeless_api_core::resource_configuration::EncodedResourceInstanceSpecification<'a>, ) -> Result { - let mut out_id: Option = None; + let out_id: Option = None; if data.class_type != "scd30-sensor" { return Err(edgeless_api_core::common::ErrorResponse { @@ -31,13 +31,6 @@ impl MockSensor { }); } - for (key, val) in data.output_mapping { - if key == "data_out" { - out_id = Some(val); - break; - } - } - // let out_id = match out_id { // Some(val) => val, // None => { diff --git a/edgeless_embedded/src/resource/scd30_sensor.rs b/edgeless_embedded/src/resource/scd30_sensor.rs index 9e074daa..7309de97 100644 --- a/edgeless_embedded/src/resource/scd30_sensor.rs +++ b/edgeless_embedded/src/resource/scd30_sensor.rs @@ -43,7 +43,7 @@ impl SCD30Sensor { async fn parse_configuration<'a>( data: edgeless_api_core::resource_configuration::EncodedResourceInstanceSpecification<'a>, ) -> Result { - let mut out_id: Option = None; + let out_id: Option = None; if data.class_type != "scd30-sensor" { return Err(edgeless_api_core::common::ErrorResponse { @@ -51,14 +51,6 @@ impl SCD30Sensor { detail: None, }); } - - for (key, val) in data.output_mapping { - if key == "data_out" { - out_id = Some(val); - break; - } - } - Ok(SCD30SensorConfiguration { data_out_id: out_id }) } diff --git a/edgeless_node/src/resources/dda/mod.rs b/edgeless_node/src/resources/dda/mod.rs index 66e2c049..0ac3f487 100644 --- a/edgeless_node/src/resources/dda/mod.rs +++ b/edgeless_node/src/resources/dda/mod.rs @@ -102,10 +102,6 @@ impl ResourceConfigurationAPI for D let new_id = edgeless_api::function_instance::InstanceId::new(lck.resource_provider_id.node_id); let dataplane_handle = lck.dataplane_provider.get_handle_for(new_id).await; - // insert the initial output_mapping before the Instance is created - // to avoid data race - lck.mappings.insert(new_id.function_id, instance_specification.output_mapping); - // create the resource let dda_res = match DDAResource::new( self.clone(), diff --git a/edgeless_orc/src/orchestrator/test.rs b/edgeless_orc/src/orchestrator/test.rs index 247d88c9..083616d9 100644 --- a/edgeless_orc/src/orchestrator/test.rs +++ b/edgeless_orc/src/orchestrator/test.rs @@ -349,7 +349,6 @@ fn make_spawn_function_request(class_id: &str) -> edgeless_api::function_instanc fn make_start_resource_request(class_type: &str) -> edgeless_api::resource_configuration::ResourceInstanceSpecification { edgeless_api::resource_configuration::ResourceInstanceSpecification { class_type: class_type.to_string(), - output_mapping: std::collections::HashMap::new(), configuration: std::collections::HashMap::new(), } } diff --git a/edgeless_orc/src/orchestrator_task.rs b/edgeless_orc/src/orchestrator_task.rs index fdae2fcc..5f8f5b70 100644 --- a/edgeless_orc/src/orchestrator_task.rs +++ b/edgeless_orc/src/orchestrator_task.rs @@ -320,8 +320,6 @@ impl OrchestratorTask { .resource_configuration_api() .start(edgeless_api::resource_configuration::ResourceInstanceSpecification { class_type: resource_provider.class_type.clone(), - // [TODO] Issue #94 remove output mapping - output_mapping: std::collections::HashMap::new(), configuration: start_req.configuration.clone(), }) .await diff --git a/edgeless_orc/src/proxy_redis.rs b/edgeless_orc/src/proxy_redis.rs index 35285e89..920acad0 100644 --- a/edgeless_orc/src/proxy_redis.rs +++ b/edgeless_orc/src/proxy_redis.rs @@ -761,7 +761,6 @@ mod test { crate::active_instance::ActiveInstance::Resource( edgeless_api::resource_configuration::ResourceInstanceSpecification { class_type: "res".to_string(), - output_mapping: std::collections::HashMap::new(), configuration: std::collections::HashMap::from([ ("key1".to_string(), "val1".to_string()), ("key2".to_string(), "val2".to_string()),