about summary refs log tree commit diff
path: root/tvix/store/src
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-03-10T14·13+0100
committerclbot <clbot@tvl.fyi>2023-03-10T16·15+0000
commitceb9d670bf94dec47df2d49fe9ece6bf293efd27 (patch)
treed9b4737ceb19969e99385996742c97d4fc8f153c /tvix/store/src
parent3506d3bd0ebbbcd907d3cd627d8dd828171fd6d1 (diff)
refactor(tvix/store): rename C to DS, client to directory_service r/5949
This matches the semantics in other gRPC wrappers.

Change-Id: I505c901aa77a58deab216316d08542877b0b2c14
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8247
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Diffstat (limited to 'tvix/store/src')
-rw-r--r--tvix/store/src/proto/grpc_directoryservice_wrapper.rs20
1 files changed, 11 insertions, 9 deletions
diff --git a/tvix/store/src/proto/grpc_directoryservice_wrapper.rs b/tvix/store/src/proto/grpc_directoryservice_wrapper.rs
index 00e219c6e56d..049b1571c23f 100644
--- a/tvix/store/src/proto/grpc_directoryservice_wrapper.rs
+++ b/tvix/store/src/proto/grpc_directoryservice_wrapper.rs
@@ -8,18 +8,20 @@ use tonic::{async_trait, Request, Response, Status, Streaming};
 use tracing::{debug, info_span, instrument, warn};
 
 pub struct GRPCDirectoryServiceWrapper<C: DirectoryService> {
-    client: C,
+    directory_service: C,
 }
 
-impl<C: DirectoryService> From<C> for GRPCDirectoryServiceWrapper<C> {
-    fn from(value: C) -> Self {
-        Self { client: value }
+impl<DS: DirectoryService> From<DS> for GRPCDirectoryServiceWrapper<DS> {
+    fn from(value: DS) -> Self {
+        Self {
+            directory_service: value,
+        }
     }
 }
 
 #[async_trait]
-impl<C: DirectoryService + Send + Sync + Clone + 'static>
-    proto::directory_service_server::DirectoryService for GRPCDirectoryServiceWrapper<C>
+impl<DS: DirectoryService + Send + Sync + Clone + 'static>
+    proto::directory_service_server::DirectoryService for GRPCDirectoryServiceWrapper<DS>
 {
     type GetStream = ReceiverStream<tonic::Result<proto::Directory, Status>>;
 
@@ -32,7 +34,7 @@ impl<C: DirectoryService + Send + Sync + Clone + 'static>
 
         let req_inner = request.into_inner();
 
-        let client = self.client.clone();
+        let client = self.directory_service.clone();
 
         // kick off an async thread
         task::spawn(async move {
@@ -201,7 +203,7 @@ impl<C: DirectoryService + Send + Sync + Clone + 'static>
             // check if the directory already exists in the database. We can skip
             // inserting if it's already there, as that'd be a no-op.
             match self
-                .client
+                .directory_service
                 .get(&proto::get_directory_request::ByWhat::Digest(dgst.to_vec()))
             {
                 Err(e) => {
@@ -212,7 +214,7 @@ impl<C: DirectoryService + Send + Sync + Clone + 'static>
                 Ok(Some(_)) => {}
                 // insert if it doesn't already exist
                 Ok(None) => {
-                    self.client.put(directory)?;
+                    self.directory_service.put(directory)?;
                 }
             }
         }