tvl-depot/tvix/store/src/dummy_directory_service.rs
Florian Klink 319c03f634 feat(tvix/store): add logging with tracing
This uses [tracing](https://github.com/tokio-rs/tracing) for logs/
tracing.

Annotate all method handlers with an instrument macro, and warn! a
message for them being unimplemented.

Co-Authored-By: Márton Boros <martonboros@gmail.com>
Change-Id: Id42a41db33782d82abfb8dc0e49a8915000e5d89
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7665
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2022-12-30 20:25:09 +00:00

35 lines
1 KiB
Rust

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};
use tracing::{instrument, warn};
const NOT_IMPLEMENTED_MSG: &str = "not implemented";
pub struct DummyDirectoryService {}
#[tonic::async_trait]
impl DirectoryService for DummyDirectoryService {
type GetStream = ReceiverStream<Result<Directory>>;
#[instrument(skip(self))]
async fn get(
&self,
_request: Request<GetDirectoryRequest>,
) -> Result<Response<Self::GetStream>, Status> {
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>> {
warn!(NOT_IMPLEMENTED_MSG);
Err(Status::unimplemented(NOT_IMPLEMENTED_MSG))
}
}