about summary refs log tree commit diff
path: root/tvix/build/src/buildservice/dummy.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-01-15T16·43+0200
committerclbot <clbot@tvl.fyi>2024-01-15T18·25+0000
commit4fb4fc263d31e207f0fc842f17e98ca276094e00 (patch)
tree08941afd4ff3c8d62768980f94a80a9a1b019ab8 /tvix/build/src/buildservice/dummy.rs
parent9fd15ba506c86cd4c1d84aa43d5f3767e02761db (diff)
feat(tvix/build): add BuildService trait r/7383
Also provide a dummy implementation that just fails on any build that's
requested.

Change-Id: I0df743a730c5331ec9ce6e97a966abe18ce067f5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10627
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/build/src/buildservice/dummy.rs')
-rw-r--r--tvix/build/src/buildservice/dummy.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tvix/build/src/buildservice/dummy.rs b/tvix/build/src/buildservice/dummy.rs
new file mode 100644
index 000000000000..d20444755e73
--- /dev/null
+++ b/tvix/build/src/buildservice/dummy.rs
@@ -0,0 +1,19 @@
+use tonic::async_trait;
+use tracing::instrument;
+
+use super::BuildService;
+use crate::proto::{Build, BuildRequest};
+
+#[derive(Default)]
+pub struct DummyBuildService {}
+
+#[async_trait]
+impl BuildService for DummyBuildService {
+    #[instrument(skip(self), ret, err)]
+    async fn do_build(&self, _request: BuildRequest) -> std::io::Result<Build> {
+        Err(std::io::Error::new(
+            std::io::ErrorKind::Other,
+            "builds are not supported with DummyBuildService",
+        ))
+    }
+}