diff options
Diffstat (limited to 'tvix/store/src')
-rw-r--r-- | tvix/store/src/dummy_blob_service.rs | 15 | ||||
-rw-r--r-- | tvix/store/src/dummy_directory_service.rs | 11 | ||||
-rw-r--r-- | tvix/store/src/dummy_path_info_service.rs | 15 | ||||
-rw-r--r-- | tvix/store/src/main.rs | 10 |
4 files changed, 42 insertions, 9 deletions
diff --git a/tvix/store/src/dummy_blob_service.rs b/tvix/store/src/dummy_blob_service.rs index 7731ea3344e3..690f6bde3869 100644 --- a/tvix/store/src/dummy_blob_service.rs +++ b/tvix/store/src/dummy_blob_service.rs @@ -7,6 +7,9 @@ use crate::proto::PutBlobResponse; use crate::proto::ReadBlobRequest; use crate::proto::StatBlobRequest; use tonic::{Request, Response, Result, Status, Streaming}; +use tracing::{instrument, warn}; + +const NOT_IMPLEMENTED_MSG: &str = "not implemented"; pub struct DummyBlobService {} @@ -14,21 +17,27 @@ pub struct DummyBlobService {} impl BlobService for DummyBlobService { type ReadStream = ReceiverStream<Result<BlobChunk>>; + #[instrument(skip(self))] async fn stat(&self, _request: Request<StatBlobRequest>) -> Result<Response<BlobMeta>> { - Err(Status::unimplemented("not implemented")) + warn!(NOT_IMPLEMENTED_MSG); + Err(Status::unimplemented(NOT_IMPLEMENTED_MSG)) } + #[instrument(skip(self))] async fn read( &self, _request: Request<ReadBlobRequest>, ) -> Result<Response<Self::ReadStream>, Status> { - Err(Status::unimplemented("not implemented")) + warn!(NOT_IMPLEMENTED_MSG); + Err(Status::unimplemented(NOT_IMPLEMENTED_MSG)) } + #[instrument(skip(self, _request))] async fn put( &self, _request: Request<Streaming<BlobChunk>>, ) -> Result<Response<PutBlobResponse>> { - Err(Status::unimplemented("not implemented")) + warn!(NOT_IMPLEMENTED_MSG); + Err(Status::unimplemented(NOT_IMPLEMENTED_MSG)) } } diff --git a/tvix/store/src/dummy_directory_service.rs b/tvix/store/src/dummy_directory_service.rs index e9b54d85afd4..183f146b5814 100644 --- a/tvix/store/src/dummy_directory_service.rs +++ b/tvix/store/src/dummy_directory_service.rs @@ -5,6 +5,9 @@ use crate::proto::Directory; use crate::proto::GetDirectoryRequest; use crate::proto::PutDirectoryResponse; use tonic::{Request, Response, Result, Status, Streaming}; +use tracing::{instrument, warn}; + +const NOT_IMPLEMENTED_MSG: &str = "not implemented"; pub struct DummyDirectoryService {} @@ -12,17 +15,21 @@ pub struct DummyDirectoryService {} impl DirectoryService for DummyDirectoryService { type GetStream = ReceiverStream<Result<Directory>>; + #[instrument(skip(self))] async fn get( &self, _request: Request<GetDirectoryRequest>, ) -> Result<Response<Self::GetStream>, Status> { - Err(Status::unimplemented("not implemented")) + warn!(NOT_IMPLEMENTED_MSG); + Err(Status::unimplemented(NOT_IMPLEMENTED_MSG)) } + #[instrument(skip(self, _request))] async fn put( &self, _request: Request<Streaming<Directory>>, ) -> Result<Response<PutDirectoryResponse>> { - Err(Status::unimplemented("not implemented")) + warn!(NOT_IMPLEMENTED_MSG); + Err(Status::unimplemented(NOT_IMPLEMENTED_MSG)) } } diff --git a/tvix/store/src/dummy_path_info_service.rs b/tvix/store/src/dummy_path_info_service.rs index 3bc99ad334d9..93359377f3dc 100644 --- a/tvix/store/src/dummy_path_info_service.rs +++ b/tvix/store/src/dummy_path_info_service.rs @@ -4,23 +4,32 @@ use crate::proto::GetPathInfoRequest; use crate::proto::Node; use crate::proto::PathInfo; use tonic::{Request, Response, Result, Status}; +use tracing::{instrument, warn}; pub struct DummyPathInfoService {} +const NOT_IMPLEMENTED_MSG: &str = "not implemented"; + #[tonic::async_trait] impl PathInfoService for DummyPathInfoService { + #[instrument(skip(self))] async fn get(&self, _request: Request<GetPathInfoRequest>) -> Result<Response<PathInfo>> { - Err(Status::unimplemented("not implemented")) + warn!(NOT_IMPLEMENTED_MSG); + Err(Status::unimplemented(NOT_IMPLEMENTED_MSG)) } + #[instrument(skip(self))] async fn put(&self, _request: Request<PathInfo>) -> Result<Response<PathInfo>> { - Err(Status::unimplemented("not implemented")) + warn!(NOT_IMPLEMENTED_MSG); + Err(Status::unimplemented(NOT_IMPLEMENTED_MSG)) } + #[instrument(skip(self))] async fn calculate_nar( &self, _request: Request<Node>, ) -> Result<Response<CalculateNarResponse>> { - Err(Status::unimplemented("not implemented")) + warn!(NOT_IMPLEMENTED_MSG); + Err(Status::unimplemented(NOT_IMPLEMENTED_MSG)) } } diff --git a/tvix/store/src/main.rs b/tvix/store/src/main.rs index b28c3fdeefe8..d9261fc34d6e 100644 --- a/tvix/store/src/main.rs +++ b/tvix/store/src/main.rs @@ -7,6 +7,7 @@ use crate::proto::FILE_DESCRIPTOR_SET; use clap::Parser; use tonic::{transport::Server, Result}; +use tracing::{info, Level}; mod dummy_blob_service; mod dummy_directory_service; @@ -23,6 +24,9 @@ mod tests; struct Cli { #[clap(long, short = 'l')] listen_address: Option<String>, + + #[clap(long)] + log_level: Option<Level>, } #[tokio::main] @@ -34,6 +38,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { .parse() .unwrap(); + let level = cli.log_level.unwrap_or(Level::INFO); + let subscriber = tracing_subscriber::fmt().with_max_level(level).finish(); + tracing::subscriber::set_global_default(subscriber).ok(); + let mut server = Server::builder(); let blob_service = dummy_blob_service::DummyBlobService {}; @@ -53,7 +61,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { router = router.add_service(reflection_svc); } - println!("tvix-store listening on {}", listen_address); + info!("tvix-store listening on {}", listen_address); router.serve(listen_address).await?; |