feat(tvix/build): add BuildService trait
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
This commit is contained in:
parent
9fd15ba506
commit
4fb4fc263d
6 changed files with 38 additions and 0 deletions
1
tvix/Cargo.lock
generated
1
tvix/Cargo.lock
generated
|
@ -3291,6 +3291,7 @@ dependencies = [
|
||||||
"tonic 0.10.2",
|
"tonic 0.10.2",
|
||||||
"tonic-build",
|
"tonic-build",
|
||||||
"tonic-reflection",
|
"tonic-reflection",
|
||||||
|
"tracing",
|
||||||
"tvix-castore",
|
"tvix-castore",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -10246,6 +10246,10 @@ rec {
|
||||||
packageId = "tonic-reflection";
|
packageId = "tonic-reflection";
|
||||||
optional = true;
|
optional = true;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
name = "tracing";
|
||||||
|
packageId = "tracing";
|
||||||
|
}
|
||||||
{
|
{
|
||||||
name = "tvix-castore";
|
name = "tvix-castore";
|
||||||
packageId = "tvix-castore";
|
packageId = "tvix-castore";
|
||||||
|
|
|
@ -10,6 +10,7 @@ prost = "0.12.1"
|
||||||
thiserror = "1.0.56"
|
thiserror = "1.0.56"
|
||||||
tonic = "0.10.2"
|
tonic = "0.10.2"
|
||||||
tvix-castore = { path = "../castore" }
|
tvix-castore = { path = "../castore" }
|
||||||
|
tracing = "0.1.37"
|
||||||
|
|
||||||
[dependencies.tonic-reflection]
|
[dependencies.tonic-reflection]
|
||||||
optional = true
|
optional = true
|
||||||
|
|
19
tvix/build/src/buildservice/dummy.rs
Normal file
19
tvix/build/src/buildservice/dummy.rs
Normal file
|
@ -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",
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
12
tvix/build/src/buildservice/mod.rs
Normal file
12
tvix/build/src/buildservice/mod.rs
Normal file
|
@ -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>;
|
||||||
|
}
|
|
@ -1 +1,2 @@
|
||||||
|
pub mod buildservice;
|
||||||
pub mod proto;
|
pub mod proto;
|
||||||
|
|
Loading…
Reference in a new issue