mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-07 08:27:12 +00:00
Rename blob read parameters from id to blob_hash
Finish the blob-hash vocabulary unification at the defining signatures: RunStoreBackend::read_blob, RunStoreHandle, LocalRunStoreBackend, the HTTP backend impl, RunDatabase::read_blob, and BlobStore::read/exists all said `id`, which kept re-teaching the old vocabulary at every impl site and inlay hint. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
a52e2c3334
commit
f1c00a167e
7 changed files with 20 additions and 17 deletions
|
|
@ -1018,11 +1018,11 @@ impl RunStoreBackend for HttpRunStore {
|
|||
.await
|
||||
}
|
||||
|
||||
async fn read_blob(&self, id: &BlobHash) -> Result<Option<bytes::Bytes>> {
|
||||
async fn read_blob(&self, blob_hash: &BlobHash) -> Result<Option<bytes::Bytes>> {
|
||||
self.with_retries("read run blob", || {
|
||||
let client = self.client.clone_for_reuse();
|
||||
let run_id = self.run_id;
|
||||
let blob_hash = *id;
|
||||
let blob_hash = *blob_hash;
|
||||
async move { client.read_run_blob(&run_id, &blob_hash).await }
|
||||
})
|
||||
.await
|
||||
|
|
|
|||
|
|
@ -56,12 +56,12 @@ impl BlobStore {
|
|||
Ok(id)
|
||||
}
|
||||
|
||||
pub async fn read(&self, id: &BlobHash) -> Result<Option<Bytes>> {
|
||||
Ok(self.repo.get(id).await?.map(|blob| blob.0))
|
||||
pub async fn read(&self, blob_hash: &BlobHash) -> Result<Option<Bytes>> {
|
||||
Ok(self.repo.get(blob_hash).await?.map(|blob| blob.0))
|
||||
}
|
||||
|
||||
pub async fn exists(&self, id: &BlobHash) -> Result<bool> {
|
||||
self.repo.exists(id).await
|
||||
pub async fn exists(&self, blob_hash: &BlobHash) -> Result<bool> {
|
||||
self.repo.exists(blob_hash).await
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -561,8 +561,8 @@ impl RunDatabase {
|
|||
self.inner.blob_store.write(data).await
|
||||
}
|
||||
|
||||
pub async fn read_blob(&self, id: &BlobHash) -> Result<Option<Bytes>> {
|
||||
self.inner.blob_store.read(id).await
|
||||
pub async fn read_blob(&self, blob_hash: &BlobHash) -> Result<Option<Bytes>> {
|
||||
self.inner.blob_store.read(blob_hash).await
|
||||
}
|
||||
|
||||
pub async fn state(&self) -> Result<RunProjection> {
|
||||
|
|
|
|||
|
|
@ -398,8 +398,11 @@ mod tests {
|
|||
Ok(blob_hash)
|
||||
}
|
||||
|
||||
async fn read_blob(&self, id: &fabro_types::BlobHash) -> anyhow::Result<Option<Bytes>> {
|
||||
Ok(self.blobs.lock().await.get(id).cloned())
|
||||
async fn read_blob(
|
||||
&self,
|
||||
blob_hash: &fabro_types::BlobHash,
|
||||
) -> anyhow::Result<Option<Bytes>> {
|
||||
Ok(self.blobs.lock().await.get(blob_hash).cloned())
|
||||
}
|
||||
|
||||
async fn read_run_log(&self) -> anyhow::Result<Option<Vec<u8>>> {
|
||||
|
|
|
|||
|
|
@ -1328,7 +1328,7 @@ mod tests {
|
|||
Ok(BlobHash::new(data))
|
||||
}
|
||||
|
||||
async fn read_blob(&self, _id: &BlobHash) -> Result<Option<Bytes>> {
|
||||
async fn read_blob(&self, _blob_hash: &BlobHash) -> Result<Option<Bytes>> {
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1823,7 +1823,7 @@ mod tests {
|
|||
Ok(BlobHash::new(data))
|
||||
}
|
||||
|
||||
async fn read_blob(&self, _id: &BlobHash) -> Result<Option<Bytes>> {
|
||||
async fn read_blob(&self, _blob_hash: &BlobHash) -> Result<Option<Bytes>> {
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ pub trait RunStoreBackend: Send + Sync {
|
|||
async fn list_events(&self) -> Result<Vec<EventEnvelope>>;
|
||||
async fn append_run_event(&self, event: &RunEvent) -> Result<()>;
|
||||
async fn write_blob(&self, data: &[u8]) -> Result<BlobHash>;
|
||||
async fn read_blob(&self, id: &BlobHash) -> Result<Option<Bytes>>;
|
||||
async fn read_blob(&self, blob_hash: &BlobHash) -> Result<Option<Bytes>>;
|
||||
async fn read_run_log(&self) -> Result<Option<Vec<u8>>>;
|
||||
}
|
||||
|
||||
|
|
@ -50,8 +50,8 @@ impl RunStoreHandle {
|
|||
self.backend.write_blob(data).await
|
||||
}
|
||||
|
||||
pub async fn read_blob(&self, id: &BlobHash) -> Result<Option<Bytes>> {
|
||||
self.backend.read_blob(id).await
|
||||
pub async fn read_blob(&self, blob_hash: &BlobHash) -> Result<Option<Bytes>> {
|
||||
self.backend.read_blob(blob_hash).await
|
||||
}
|
||||
|
||||
pub async fn read_run_log(&self) -> Result<Option<Vec<u8>>> {
|
||||
|
|
@ -98,9 +98,9 @@ impl RunStoreBackend for LocalRunStoreBackend {
|
|||
.map_err(anyhow::Error::from)
|
||||
}
|
||||
|
||||
async fn read_blob(&self, id: &BlobHash) -> Result<Option<Bytes>> {
|
||||
async fn read_blob(&self, blob_hash: &BlobHash) -> Result<Option<Bytes>> {
|
||||
self.run_store
|
||||
.read_blob(id)
|
||||
.read_blob(blob_hash)
|
||||
.await
|
||||
.map_err(anyhow::Error::from)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue