Skip to content

Commit 0b6baa5

Browse files
committed
Rename commit_blob to commit_payload
Since we don't write a blob object anymore is may be confusing to continue calling this "commit_blob". Signed-off-by: J Robert Ray <[email protected]>
1 parent b1ce770 commit 0b6baa5

File tree

13 files changed

+37
-37
lines changed

13 files changed

+37
-37
lines changed

crates/spfs-cli/main/src/cmd_write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl CmdWrite {
5555
None => Box::pin(tokio::io::BufReader::new(tokio::io::stdin())),
5656
};
5757

58-
let digest = repo.commit_blob(reader).await?;
58+
let digest = repo.commit_payload(reader).await?;
5959

6060
tracing::info!(%digest, "created");
6161
for tag in self.tags.iter() {

crates/spfs/src/check_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ async fn check_missing_annotation_blob(#[future] tmprepo: TempRepo) {
258258
let tmprepo = tmprepo.await;
259259

260260
let blob = tmprepo
261-
.commit_blob(Box::pin(b"this is some data".as_slice()))
261+
.commit_payload(Box::pin(b"this is some data".as_slice()))
262262
.await
263263
.unwrap();
264264

crates/spfs/src/commit.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub struct WriteToRepositoryBlobHasher<'repo> {
5353
#[tonic::async_trait]
5454
impl BlobHasher for WriteToRepositoryBlobHasher<'_> {
5555
async fn hash_blob(&self, reader: Pin<Box<dyn BlobRead>>) -> Result<encoding::Digest> {
56-
self.repo.commit_blob(reader).await
56+
self.repo.commit_payload(reader).await
5757
}
5858
}
5959

@@ -297,7 +297,7 @@ where
297297
.into_bytes();
298298
let reader =
299299
Box::pin(tokio::io::BufReader::new(std::io::Cursor::new(content)));
300-
self.repo.commit_blob(reader).await?
300+
self.repo.commit_payload(reader).await?
301301
} else {
302302
let file = tokio::fs::File::open(&local_path).await.map_err(|err| {
303303
// TODO: add better message for file missing
@@ -308,7 +308,7 @@ where
308308
)
309309
})?;
310310
let reader = Box::pin(tokio::io::BufReader::new(file));
311-
self.repo.commit_blob(reader).await?
311+
self.repo.commit_payload(reader).await?
312312
};
313313
if created != entry.object {
314314
return Err(Error::String(format!(

crates/spfs/src/runtime/storage.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ impl Storage {
10631063
/// Create a new blob payload to hold the given string value
10641064
pub(crate) async fn create_blob_for_string(&self, payload: String) -> Result<Digest> {
10651065
self.inner
1066-
.commit_blob(Box::pin(std::io::Cursor::new(payload.into_bytes())))
1066+
.commit_payload(Box::pin(std::io::Cursor::new(payload.into_bytes())))
10671067
.await
10681068
}
10691069

@@ -1261,7 +1261,7 @@ impl Storage {
12611261
let (_, config_digest) = tokio::try_join!(
12621262
self.inner.write_object(&platform),
12631263
self.inner
1264-
.commit_blob(Box::pin(std::io::Cursor::new(config_data.into_bytes())),)
1264+
.commit_payload(Box::pin(std::io::Cursor::new(config_data.into_bytes())),)
12651265
)?;
12661266

12671267
tokio::try_join!(

crates/spfs/src/storage/fallback/repository_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ async fn test_proxy_payload_repair(tmpdir: tempfile::TempDir) {
2626
);
2727

2828
let digest = primary
29-
.commit_blob(Box::pin(b"some data".as_slice()))
29+
.commit_payload(Box::pin(b"some data".as_slice()))
3030
.await
3131
.unwrap();
3232

3333
secondary
34-
.commit_blob(Box::pin(b"some data".as_slice()))
34+
.commit_payload(Box::pin(b"some data".as_slice()))
3535
.await
3636
.unwrap();
3737

crates/spfs/src/storage/fs/renderer_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async fn test_render_manifest(
4848
.await
4949
.unwrap();
5050
storage
51-
.commit_blob(Box::pin(tokio::io::BufReader::new(data)))
51+
.commit_payload(Box::pin(tokio::io::BufReader::new(data)))
5252
.await
5353
.unwrap();
5454
}

crates/spfs/src/storage/payload.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub trait PayloadStorage: Sync + Send {
2828
///
2929
/// It is unsafe to write payload data without also creating a blob
3030
/// to track that payload in the database. Usually, its better to
31-
/// call [`super::RepositoryExt::commit_blob`] instead.
31+
/// call [`super::RepositoryExt::commit_payload`] instead.
3232
async unsafe fn write_data(
3333
&self,
3434
reader: Pin<Box<dyn BlobRead>>,

crates/spfs/src/storage/payload_test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ async fn test_payloads_iter(
9999

100100
let mut expected = vec![
101101
tmprepo
102-
.commit_blob(reader_0)
102+
.commit_payload(reader_0)
103103
.await
104104
.expect("failed to write payload data"),
105105
tmprepo
106-
.commit_blob(reader_1)
106+
.commit_payload(reader_1)
107107
.await
108108
.expect("failed to write payload data"),
109109
tmprepo
110-
.commit_blob(reader_2)
110+
.commit_payload(reader_2)
111111
.await
112112
.expect("failed to write payload data"),
113113
];

crates/spfs/src/storage/proxy/repository_test.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async fn test_proxy_payload_read_through(tmpdir: tempfile::TempDir) {
2626
.unwrap();
2727

2828
let digest = secondary
29-
.commit_blob(Box::pin(b"some data".as_slice()))
29+
.commit_payload(Box::pin(b"some data".as_slice()))
3030
.await
3131
.unwrap();
3232

@@ -56,7 +56,7 @@ async fn test_proxy_object_read_through(tmpdir: tempfile::TempDir) {
5656
.unwrap();
5757

5858
let payload = secondary
59-
.commit_blob(Box::pin(b"some data".as_slice()))
59+
.commit_payload(Box::pin(b"some data".as_slice()))
6060
.await
6161
.unwrap();
6262

@@ -86,7 +86,7 @@ async fn test_proxy_tag_read_through(tmpdir: tempfile::TempDir) {
8686
.unwrap();
8787

8888
let payload = secondary
89-
.commit_blob(Box::pin(b"some data".as_slice()))
89+
.commit_payload(Box::pin(b"some data".as_slice()))
9090
.await
9191
.unwrap();
9292
let tag_spec = crate::tracking::TagSpec::parse("spfs-test/proxy-read-through").unwrap();
@@ -114,7 +114,7 @@ async fn test_proxy_tag_ls(tmpdir: tempfile::TempDir) {
114114
.unwrap();
115115

116116
let payload1 = primary
117-
.commit_blob(Box::pin(b"some data".as_slice()))
117+
.commit_payload(Box::pin(b"some data".as_slice()))
118118
.await
119119
.unwrap();
120120
let tag_spec = crate::tracking::TagSpec::parse("spfs-test/proxy-read-through").unwrap();
@@ -126,7 +126,7 @@ async fn test_proxy_tag_ls(tmpdir: tempfile::TempDir) {
126126
.unwrap();
127127

128128
let payload2 = secondary
129-
.commit_blob(Box::pin(b"some data".as_slice()))
129+
.commit_payload(Box::pin(b"some data".as_slice()))
130130
.await
131131
.unwrap();
132132
secondary.push_tag(&tag_spec, &payload2).await.unwrap();
@@ -163,7 +163,7 @@ async fn test_proxy_tag_ls_config_for_primary_only(tmpdir: tempfile::TempDir) {
163163
.unwrap();
164164

165165
let payload1 = primary
166-
.commit_blob(Box::pin(b"some data".as_slice()))
166+
.commit_payload(Box::pin(b"some data".as_slice()))
167167
.await
168168
.unwrap();
169169
let tag_spec = crate::tracking::TagSpec::parse("spfs-test/proxy-read-through").unwrap();
@@ -175,7 +175,7 @@ async fn test_proxy_tag_ls_config_for_primary_only(tmpdir: tempfile::TempDir) {
175175
.unwrap();
176176

177177
let payload2 = secondary
178-
.commit_blob(Box::pin(b"some data".as_slice()))
178+
.commit_payload(Box::pin(b"some data".as_slice()))
179179
.await
180180
.unwrap();
181181
let tag_spec2 = crate::tracking::TagSpec::parse("spfs-test/proxy-read-through2").unwrap();
@@ -223,7 +223,7 @@ async fn test_proxy_tag_find(tmpdir: tempfile::TempDir) {
223223
.unwrap();
224224

225225
let payload1 = primary
226-
.commit_blob(Box::pin(b"some data".as_slice()))
226+
.commit_payload(Box::pin(b"some data".as_slice()))
227227
.await
228228
.unwrap();
229229
let tag_spec = crate::tracking::TagSpec::parse("spfs-test/proxy-read-through").unwrap();
@@ -235,7 +235,7 @@ async fn test_proxy_tag_find(tmpdir: tempfile::TempDir) {
235235
.unwrap();
236236

237237
let payload2 = secondary
238-
.commit_blob(Box::pin(b"some data".as_slice()))
238+
.commit_payload(Box::pin(b"some data".as_slice()))
239239
.await
240240
.unwrap();
241241
secondary.push_tag(&tag_spec, &payload2).await.unwrap();
@@ -271,7 +271,7 @@ async fn test_proxy_tag_find_for_primary_only(tmpdir: tempfile::TempDir) {
271271
.unwrap();
272272

273273
let payload1 = primary
274-
.commit_blob(Box::pin(b"some data".as_slice()))
274+
.commit_payload(Box::pin(b"some data".as_slice()))
275275
.await
276276
.unwrap();
277277
let tag_spec = crate::tracking::TagSpec::parse("spfs-test/proxy-read-through").unwrap();
@@ -283,7 +283,7 @@ async fn test_proxy_tag_find_for_primary_only(tmpdir: tempfile::TempDir) {
283283
.unwrap();
284284

285285
let payload2 = secondary
286-
.commit_blob(Box::pin(b"some data".as_slice()))
286+
.commit_payload(Box::pin(b"some data".as_slice()))
287287
.await
288288
.unwrap();
289289
let tag_spec2 = crate::tracking::TagSpec::parse("spfs-test/proxy-read-through2").unwrap();
@@ -322,7 +322,7 @@ async fn test_proxy_tag_iter_streams(tmpdir: tempfile::TempDir) {
322322
.unwrap();
323323

324324
let payload1 = primary
325-
.commit_blob(Box::pin(b"some data".as_slice()))
325+
.commit_payload(Box::pin(b"some data".as_slice()))
326326
.await
327327
.unwrap();
328328
let tag_spec = crate::tracking::TagSpec::parse("spfs-test/proxy-read-through").unwrap();
@@ -334,7 +334,7 @@ async fn test_proxy_tag_iter_streams(tmpdir: tempfile::TempDir) {
334334
.unwrap();
335335

336336
let payload2 = secondary
337-
.commit_blob(Box::pin(b"some data".as_slice()))
337+
.commit_payload(Box::pin(b"some data".as_slice()))
338338
.await
339339
.unwrap();
340340
secondary.push_tag(&tag_spec, &payload2).await.unwrap();
@@ -370,7 +370,7 @@ async fn test_proxy_tag_iter_streams_for_primary_only(tmpdir: tempfile::TempDir)
370370
.unwrap();
371371

372372
let payload1 = primary
373-
.commit_blob(Box::pin(b"some data".as_slice()))
373+
.commit_payload(Box::pin(b"some data".as_slice()))
374374
.await
375375
.unwrap();
376376
let tag_spec = crate::tracking::TagSpec::parse("spfs-test/proxy-read-through").unwrap();
@@ -382,7 +382,7 @@ async fn test_proxy_tag_iter_streams_for_primary_only(tmpdir: tempfile::TempDir)
382382
.unwrap();
383383

384384
let payload2 = secondary
385-
.commit_blob(Box::pin(b"some data".as_slice()))
385+
.commit_payload(Box::pin(b"some data".as_slice()))
386386
.await
387387
.unwrap();
388388
let tag_spec2 = crate::tracking::TagSpec::parse("spfs-test/proxy-read-through2").unwrap();

crates/spfs/src/storage/repository.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ impl<T> Repository for T where
118118

119119
#[async_trait]
120120
pub trait RepositoryExt: super::PayloadStorage + graph::DatabaseExt {
121-
/// Commit the data from 'reader' as a blob in this repository
122-
async fn commit_blob(&self, reader: Pin<Box<dyn BlobRead>>) -> Result<encoding::Digest> {
121+
/// Commit the data from 'reader' as a payload in this repository
122+
async fn commit_payload(&self, reader: Pin<Box<dyn BlobRead>>) -> Result<encoding::Digest> {
123123
// Safety: it is unsafe to write data without also creating a blob
124124
// to track that payload, which is exactly what this function is doing
125125
let (digest, size) = unsafe { self.write_data(reader).await? };

0 commit comments

Comments
 (0)