about summary refs log tree commit diff
path: root/tvix/build/src
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/build/src')
-rw-r--r--tvix/build/src/buildservice/dummy.rs19
-rw-r--r--tvix/build/src/buildservice/mod.rs12
-rw-r--r--tvix/build/src/lib.rs1
3 files changed, 32 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",
+        ))
+    }
+}
diff --git a/tvix/build/src/buildservice/mod.rs b/tvix/build/src/buildservice/mod.rs
new file mode 100644
index 000000000000..cd0b7eb5d70f
--- /dev/null
+++ b/tvix/build/src/buildservice/mod.rs
@@ -0,0 +1,12 @@
+use tonic::async_trait;
+
+use crate::proto::{Build, BuildRequest};
+
+mod dummy;
+pub use dummy::DummyBuildService;
+
+#[async_trait]
+pub trait BuildService: Send + Sync {
+    /// TODO: document
+    async fn do_build(&self, request: BuildRequest) -> std::io::Result<Build>;
+}
diff --git a/tvix/build/src/lib.rs b/tvix/build/src/lib.rs
index febacec69e03..b173657e431c 100644
--- a/tvix/build/src/lib.rs
+++ b/tvix/build/src/lib.rs
@@ -1 +1,2 @@
+pub mod buildservice;
 pub mod proto;