refactor(snix/build): drop build_request from Build{Result,Response}
Back when initially working on this, having all info about the Build in one struct seemed a good idea for some future CI interface, but right now this simply raises more questions and is quite theoretic. Let's drop it for now, we can reintroduce it, or other request methods when we get to it. Change-Id: I105a8d5ae8bd7e0d5f8ee3e7edf2597100b43119 Reviewed-on: https://cl.snix.dev/c/snix/+/30425 Autosubmit: Florian Klink <flokli@flokli.de> Tested-by: besadii Reviewed-by: Vova Kryachko <v.kryachko@gmail.com>
This commit is contained in:
		
							parent
							
								
									2308cb188f
								
							
						
					
					
						commit
						52e7b5b485
					
				
					 4 changed files with 5 additions and 20 deletions
				
			
		|  | @ -156,12 +156,9 @@ message BuildRequest { | |||
| 
 | ||||
| // A BuildResponse is (one possible) outcome of executing a [BuildRequest]. | ||||
| message BuildResponse { | ||||
|   // The orginal build request producing the build. | ||||
|   BuildRequest build_request = 1; // <- TODO: define hashing scheme for BuildRequest, refer to it by hash? | ||||
| 
 | ||||
|   // The outputs that were produced after successfully building. | ||||
|   // They are provided in the same order as specified in the [BuildRequest]. | ||||
|   repeated Output outputs = 2; | ||||
|   repeated Output outputs = 1; | ||||
| 
 | ||||
|   message Output { | ||||
|     // Output entry produced by the build. It may not contain a name, | ||||
|  |  | |||
|  | @ -133,9 +133,6 @@ pub struct AdditionalFile { | |||
| /// Describes the result of a [BuildRequest].
 | ||||
| #[derive(Debug, Clone, PartialEq)] | ||||
| pub struct BuildResult { | ||||
|     /// The original BuildRequest.
 | ||||
|     pub build_request: BuildRequest, | ||||
| 
 | ||||
|     /// The outputs that were produced after successfully building.
 | ||||
|     // They are sorted by the order specified in the build request.
 | ||||
|     pub outputs: Vec<BuildOutput>, | ||||
|  |  | |||
|  | @ -86,7 +86,7 @@ where | |||
|             .map_err(std::io::Error::other)?; | ||||
| 
 | ||||
|         // assemble a BTreeMap of Nodes to pass into SnixStoreFs.
 | ||||
|         let patterns = ReferencePattern::new(request.refscan_needles.clone()); | ||||
|         let patterns = ReferencePattern::new(request.refscan_needles); | ||||
|         // NOTE: impl Drop for FuseDaemon unmounts, so if the call is cancelled, umount.
 | ||||
|         let _fuse_daemon = tokio::task::spawn_blocking({ | ||||
|             let blob_service = self.blob_service.clone(); | ||||
|  | @ -94,7 +94,7 @@ where | |||
| 
 | ||||
|             let dest = bundle_path.join("inputs"); | ||||
| 
 | ||||
|             let root_nodes = Box::new(request.inputs.clone()); | ||||
|             let root_nodes = Box::new(request.inputs); | ||||
|             move || { | ||||
|                 let fs = snix_castore::fs::SnixStoreFs::new( | ||||
|                     blob_service, | ||||
|  | @ -143,7 +143,7 @@ where | |||
|         // mostly IO bound.
 | ||||
|         let outputs = futures::future::try_join_all(host_output_paths.into_iter().enumerate().map( | ||||
|             |(i, host_output_path)| { | ||||
|                 let output_path = request.outputs[i].clone(); | ||||
|                 let output_path = &request.outputs[i]; | ||||
|                 let patterns = patterns.clone(); | ||||
|                 async move { | ||||
|                     debug!(host.path=?host_output_path, output.path=?output_path, "ingesting path"); | ||||
|  | @ -178,10 +178,7 @@ where | |||
|         )) | ||||
|         .await?; | ||||
| 
 | ||||
|         Ok(BuildResult { | ||||
|             build_request: request, | ||||
|             outputs, | ||||
|         }) | ||||
|         Ok(BuildResult { outputs }) | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -282,7 +282,6 @@ impl TryFrom<BuildRequest> for crate::buildservice::BuildRequest { | |||
| impl From<BuildResult> for BuildResponse { | ||||
|     fn from(value: BuildResult) -> Self { | ||||
|         Self { | ||||
|             build_request: Some(value.build_request.into()), | ||||
|             outputs: value | ||||
|                 .outputs | ||||
|                 .into_iter() | ||||
|  | @ -303,11 +302,6 @@ impl TryFrom<BuildResponse> for BuildResult { | |||
| 
 | ||||
|     fn try_from(value: BuildResponse) -> Result<Self, Self::Error> { | ||||
|         Ok(Self { | ||||
|             build_request: value | ||||
|                 .build_request | ||||
|                 .ok_or(ValidateBuildResultError::MissingRequestField)? | ||||
|                 .try_into() | ||||
|                 .map_err(ValidateBuildResultError::InvalidBuildRequest)?, | ||||
|             outputs: value | ||||
|                 .outputs | ||||
|                 .into_iter() | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue