Skip to content

Commit 8a46488

Browse files
authored
Rename DownloadBlobContent → DownloadBlob (#3117)
## Motivation When I addressed #3108 (comment), I only renamed `UploadBlobContent` to `UploadBlob`. `DownloadBlobContent` has a name inconsistent with that now. ## Proposal Rename `DownloadBlobContent` to `DownloadBlob`. ## Test Plan (Only renaming.) ## Release Plan - Nothing to do / These changes follow the usual release cycle. ## Links - Original discussion: #3108 (comment) - [reviewer checklist](https://github.com/linera-io/linera-protocol/blob/main/CONTRIBUTING.md#reviewer-checklist)
1 parent 27923c7 commit 8a46488

File tree

13 files changed

+30
-34
lines changed

13 files changed

+30
-34
lines changed

linera-core/src/node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ pub trait ValidatorNode {
106106
// certificate using this blob.
107107
async fn upload_blob(&self, content: BlobContent) -> Result<BlobId, NodeError>;
108108

109-
async fn download_blob_content(&self, blob_id: BlobId) -> Result<BlobContent, NodeError>;
109+
async fn download_blob(&self, blob_id: BlobId) -> Result<BlobContent, NodeError>;
110110

111111
async fn download_certificate(
112112
&self,

linera-core/src/remote_node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ impl<N: ValidatorNode> RemoteNode<N> {
242242

243243
#[instrument(level = "trace")]
244244
async fn try_download_blob(&self, blob_id: BlobId) -> Option<Blob> {
245-
match self.node.download_blob_content(blob_id).await {
245+
match self.node.download_blob(blob_id).await {
246246
Ok(blob) => {
247247
let blob = Blob::new(blob);
248248
if blob.id() != blob_id {

linera-core/src/unit_tests/test_utils.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,9 @@ where
184184
.await
185185
}
186186

187-
async fn download_blob_content(&self, blob_id: BlobId) -> Result<BlobContent, NodeError> {
188-
self.spawn_and_receive(move |validator, sender| {
189-
validator.do_download_blob_content(blob_id, sender)
190-
})
191-
.await
187+
async fn download_blob(&self, blob_id: BlobId) -> Result<BlobContent, NodeError> {
188+
self.spawn_and_receive(move |validator, sender| validator.do_download_blob(blob_id, sender))
189+
.await
192190
}
193191

194192
async fn download_certificate(
@@ -477,7 +475,7 @@ where
477475
sender.send(result)
478476
}
479477

480-
async fn do_download_blob_content(
478+
async fn do_download_blob(
481479
self,
482480
blob_id: BlobId,
483481
sender: oneshot::Sender<Result<BlobContent, NodeError>>,

linera-rpc/proto/rpc.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ service ValidatorNode {
6262
rpc GetGenesisConfigHash(google.protobuf.Empty) returns (CryptoHash);
6363

6464
// Downloads a blob content.
65-
rpc DownloadBlobContent(BlobId) returns (BlobContent);
65+
rpc DownloadBlob(BlobId) returns (BlobContent);
6666

6767
// Uploads a blob content. Returns an error if the validator has not seen a
6868
// certificate using this blob.

linera-rpc/src/client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,12 @@ impl ValidatorNode for Client {
181181
})
182182
}
183183

184-
async fn download_blob_content(&self, blob_id: BlobId) -> Result<BlobContent, NodeError> {
184+
async fn download_blob(&self, blob_id: BlobId) -> Result<BlobContent, NodeError> {
185185
Ok(match self {
186-
Client::Grpc(grpc_client) => grpc_client.download_blob_content(blob_id).await?,
186+
Client::Grpc(grpc_client) => grpc_client.download_blob(blob_id).await?,
187187

188188
#[cfg(with_simple_network)]
189-
Client::Simple(simple_client) => simple_client.download_blob_content(blob_id).await?,
189+
Client::Simple(simple_client) => simple_client.download_blob(blob_id).await?,
190190
})
191191
}
192192

linera-rpc/src/grpc/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,9 @@ impl ValidatorNode for GrpcClient {
354354
}
355355

356356
#[instrument(target = "grpc_client", skip(self), err, fields(address = self.address))]
357-
async fn download_blob_content(&self, blob_id: BlobId) -> Result<BlobContent, NodeError> {
357+
async fn download_blob(&self, blob_id: BlobId) -> Result<BlobContent, NodeError> {
358358
let req = api::BlobId::try_from(blob_id)?;
359-
Ok(client_delegate!(self, download_blob_content, req)?.try_into()?)
359+
Ok(client_delegate!(self, download_blob, req)?.try_into()?)
360360
}
361361

362362
#[instrument(target = "grpc_client", skip_all, err, fields(address = self.address))]

linera-rpc/src/message.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub enum RpcMessage {
3434
LiteCertificate(Box<HandleLiteCertRequest<'static>>),
3535
ChainInfoQuery(Box<ChainInfoQuery>),
3636
UploadBlob(Box<BlobContent>),
37-
DownloadBlobContent(Box<BlobId>),
37+
DownloadBlob(Box<BlobId>),
3838
DownloadConfirmedBlock(Box<CryptoHash>),
3939
DownloadCertificates(Vec<CryptoHash>),
4040
BlobLastUsedBy(Box<BlobId>),
@@ -49,7 +49,7 @@ pub enum RpcMessage {
4949
VersionInfoResponse(Box<VersionInfo>),
5050
GenesisConfigHashResponse(Box<CryptoHash>),
5151
UploadBlobResponse(Box<BlobId>),
52-
DownloadBlobContentResponse(Box<BlobContent>),
52+
DownloadBlobResponse(Box<BlobContent>),
5353
DownloadConfirmedBlockResponse(Box<ConfirmedBlock>),
5454
DownloadCertificatesResponse(Vec<ConfirmedBlockCertificate>),
5555
BlobLastUsedByResponse(Box<CryptoHash>),
@@ -83,8 +83,8 @@ impl RpcMessage {
8383
| GenesisConfigHashResponse(_)
8484
| UploadBlob(_)
8585
| UploadBlobResponse(_)
86-
| DownloadBlobContent(_)
87-
| DownloadBlobContentResponse(_)
86+
| DownloadBlob(_)
87+
| DownloadBlobResponse(_)
8888
| DownloadConfirmedBlock(_)
8989
| DownloadConfirmedBlockResponse(_)
9090
| DownloadCertificates(_)
@@ -109,7 +109,7 @@ impl RpcMessage {
109109
VersionInfoQuery
110110
| GenesisConfigHashQuery
111111
| UploadBlob(_)
112-
| DownloadBlobContent(_)
112+
| DownloadBlob(_)
113113
| DownloadConfirmedBlock(_)
114114
| BlobLastUsedBy(_)
115115
| MissingBlobIds(_)
@@ -127,7 +127,7 @@ impl RpcMessage {
127127
| VersionInfoResponse(_)
128128
| GenesisConfigHashResponse(_)
129129
| UploadBlobResponse(_)
130-
| DownloadBlobContentResponse(_)
130+
| DownloadBlobResponse(_)
131131
| DownloadConfirmedBlockResponse(_)
132132
| BlobLastUsedByResponse(_)
133133
| MissingBlobIdsResponse(_)
@@ -162,7 +162,7 @@ impl TryFrom<RpcMessage> for BlobContent {
162162
type Error = NodeError;
163163
fn try_from(message: RpcMessage) -> Result<Self, Self::Error> {
164164
match message {
165-
RpcMessage::DownloadBlobContentResponse(blob) => Ok(*blob),
165+
RpcMessage::DownloadBlobResponse(blob) => Ok(*blob),
166166
RpcMessage::Error(error) => Err(*error),
167167
_ => Err(NodeError::UnexpectedMessage),
168168
}

linera-rpc/src/simple/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ impl ValidatorNode for SimpleClient {
166166
self.query(RpcMessage::UploadBlob(Box::new(content))).await
167167
}
168168

169-
async fn download_blob_content(&self, blob_id: BlobId) -> Result<BlobContent, NodeError> {
170-
self.query(RpcMessage::DownloadBlobContent(Box::new(blob_id)))
169+
async fn download_blob(&self, blob_id: BlobId) -> Result<BlobContent, NodeError> {
170+
self.query(RpcMessage::DownloadBlob(Box::new(blob_id)))
171171
.await
172172
}
173173

linera-rpc/src/simple/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,8 @@ where
350350
| RpcMessage::VersionInfoResponse(_)
351351
| RpcMessage::GenesisConfigHashQuery
352352
| RpcMessage::GenesisConfigHashResponse(_)
353-
| RpcMessage::DownloadBlobContent(_)
354-
| RpcMessage::DownloadBlobContentResponse(_)
353+
| RpcMessage::DownloadBlob(_)
354+
| RpcMessage::DownloadBlobResponse(_)
355355
| RpcMessage::DownloadConfirmedBlock(_)
356356
| RpcMessage::DownloadConfirmedBlockResponse(_)
357357
| RpcMessage::BlobLastUsedBy(_)

linera-rpc/tests/snapshots/format__format.yaml.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ RpcMessage:
802802
NEWTYPE:
803803
TYPENAME: BlobContent
804804
7:
805-
DownloadBlobContent:
805+
DownloadBlob:
806806
NEWTYPE:
807807
TYPENAME: BlobId
808808
8:
@@ -852,7 +852,7 @@ RpcMessage:
852852
NEWTYPE:
853853
TYPENAME: BlobId
854854
20:
855-
DownloadBlobContentResponse:
855+
DownloadBlobResponse:
856856
NEWTYPE:
857857
TYPENAME: BlobContent
858858
21:

0 commit comments

Comments
 (0)