about summary refs log tree commit diff
path: root/tvix/store/src/dummy_directory_service.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2022-12-28T15·40+0100
committerflokli <flokli@flokli.de>2022-12-30T15·21+0000
commit58f5ff2c173b6c64e3ffb1d2cd4d840e0dcf38c3 (patch)
treeaf3e28b373a54e50b3e72a803eae779a633a9f20 /tvix/store/src/dummy_directory_service.rs
parentd22a9c8610f2cd1bf0e021ec1f46e6200ed4a28f (diff)
feat(tvix/store): initial dummy implementation r/5554
This replaces the hello world example from tvix-store with an actual
gRPC endpoint, implementing all of BlobService, DirectoryService and
PathInfoService.

All RPC methods currently respond with the unimplemented gRPC status.

Co-Authored-By: Márton Boros <martonboros@gmail.com>
Change-Id: Ieba333cca44dc1e3f2ffbe676ba7a99e672b9bfb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7664
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/store/src/dummy_directory_service.rs')
-rw-r--r--tvix/store/src/dummy_directory_service.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tvix/store/src/dummy_directory_service.rs b/tvix/store/src/dummy_directory_service.rs
new file mode 100644
index 000000000000..e9b54d85afd4
--- /dev/null
+++ b/tvix/store/src/dummy_directory_service.rs
@@ -0,0 +1,28 @@
+use tokio_stream::wrappers::ReceiverStream;
+
+use crate::proto::directory_service_server::DirectoryService;
+use crate::proto::Directory;
+use crate::proto::GetDirectoryRequest;
+use crate::proto::PutDirectoryResponse;
+use tonic::{Request, Response, Result, Status, Streaming};
+
+pub struct DummyDirectoryService {}
+
+#[tonic::async_trait]
+impl DirectoryService for DummyDirectoryService {
+    type GetStream = ReceiverStream<Result<Directory>>;
+
+    async fn get(
+        &self,
+        _request: Request<GetDirectoryRequest>,
+    ) -> Result<Response<Self::GetStream>, Status> {
+        Err(Status::unimplemented("not implemented"))
+    }
+
+    async fn put(
+        &self,
+        _request: Request<Streaming<Directory>>,
+    ) -> Result<Response<PutDirectoryResponse>> {
+        Err(Status::unimplemented("not implemented"))
+    }
+}