blob: 690f6bde386953ebaf3fd882574bfdabf54ea8d2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
use tokio_stream::wrappers::ReceiverStream;
use crate::proto::blob_service_server::BlobService;
use crate::proto::BlobChunk;
use crate::proto::BlobMeta;
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 {}
#[tonic::async_trait]
impl BlobService for DummyBlobService {
type ReadStream = ReceiverStream<Result<BlobChunk>>;
#[instrument(skip(self))]
async fn stat(&self, _request: Request<StatBlobRequest>) -> Result<Response<BlobMeta>> {
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> {
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>> {
warn!(NOT_IMPLEMENTED_MSG);
Err(Status::unimplemented(NOT_IMPLEMENTED_MSG))
}
}
|