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:
Florian Klink 2025-05-04 16:53:55 +03:00 committed by clbot
parent 2308cb188f
commit 52e7b5b485
4 changed files with 5 additions and 20 deletions

View file

@ -156,12 +156,9 @@ message BuildRequest {
// A BuildResponse is (one possible) outcome of executing a [BuildRequest]. // A BuildResponse is (one possible) outcome of executing a [BuildRequest].
message BuildResponse { 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. // The outputs that were produced after successfully building.
// They are provided in the same order as specified in the [BuildRequest]. // They are provided in the same order as specified in the [BuildRequest].
repeated Output outputs = 2; repeated Output outputs = 1;
message Output { message Output {
// Output entry produced by the build. It may not contain a name, // Output entry produced by the build. It may not contain a name,

View file

@ -133,9 +133,6 @@ pub struct AdditionalFile {
/// Describes the result of a [BuildRequest]. /// Describes the result of a [BuildRequest].
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct BuildResult { pub struct BuildResult {
/// The original BuildRequest.
pub build_request: BuildRequest,
/// The outputs that were produced after successfully building. /// The outputs that were produced after successfully building.
// They are sorted by the order specified in the build request. // They are sorted by the order specified in the build request.
pub outputs: Vec<BuildOutput>, pub outputs: Vec<BuildOutput>,

View file

@ -86,7 +86,7 @@ where
.map_err(std::io::Error::other)?; .map_err(std::io::Error::other)?;
// assemble a BTreeMap of Nodes to pass into SnixStoreFs. // 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. // NOTE: impl Drop for FuseDaemon unmounts, so if the call is cancelled, umount.
let _fuse_daemon = tokio::task::spawn_blocking({ let _fuse_daemon = tokio::task::spawn_blocking({
let blob_service = self.blob_service.clone(); let blob_service = self.blob_service.clone();
@ -94,7 +94,7 @@ where
let dest = bundle_path.join("inputs"); let dest = bundle_path.join("inputs");
let root_nodes = Box::new(request.inputs.clone()); let root_nodes = Box::new(request.inputs);
move || { move || {
let fs = snix_castore::fs::SnixStoreFs::new( let fs = snix_castore::fs::SnixStoreFs::new(
blob_service, blob_service,
@ -143,7 +143,7 @@ where
// mostly IO bound. // mostly IO bound.
let outputs = futures::future::try_join_all(host_output_paths.into_iter().enumerate().map( let outputs = futures::future::try_join_all(host_output_paths.into_iter().enumerate().map(
|(i, host_output_path)| { |(i, host_output_path)| {
let output_path = request.outputs[i].clone(); let output_path = &request.outputs[i];
let patterns = patterns.clone(); let patterns = patterns.clone();
async move { async move {
debug!(host.path=?host_output_path, output.path=?output_path, "ingesting path"); debug!(host.path=?host_output_path, output.path=?output_path, "ingesting path");
@ -178,10 +178,7 @@ where
)) ))
.await?; .await?;
Ok(BuildResult { Ok(BuildResult { outputs })
build_request: request,
outputs,
})
} }
} }

View file

@ -282,7 +282,6 @@ impl TryFrom<BuildRequest> for crate::buildservice::BuildRequest {
impl From<BuildResult> for BuildResponse { impl From<BuildResult> for BuildResponse {
fn from(value: BuildResult) -> Self { fn from(value: BuildResult) -> Self {
Self { Self {
build_request: Some(value.build_request.into()),
outputs: value outputs: value
.outputs .outputs
.into_iter() .into_iter()
@ -303,11 +302,6 @@ impl TryFrom<BuildResponse> for BuildResult {
fn try_from(value: BuildResponse) -> Result<Self, Self::Error> { fn try_from(value: BuildResponse) -> Result<Self, Self::Error> {
Ok(Self { Ok(Self {
build_request: value
.build_request
.ok_or(ValidateBuildResultError::MissingRequestField)?
.try_into()
.map_err(ValidateBuildResultError::InvalidBuildRequest)?,
outputs: value outputs: value
.outputs .outputs
.into_iter() .into_iter()