Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(iroh)!: Blob batch PR, attempt 3 #2545

Merged
merged 20 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename upgrade to persist
  • Loading branch information
rklaehn committed Aug 14, 2024
commit 6e945389acd741a62b74f42a4dc6167918ce8d05
1 change: 0 additions & 1 deletion iroh/src/client/blobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,6 @@ pub enum DownloadMode {
mod tests {
use super::*;

use anyhow::Context as _;
use iroh_blobs::hashseq::HashSeq;
use iroh_net::NodeId;
use rand::RngCore;
Expand Down
8 changes: 4 additions & 4 deletions iroh/src/client/blobs/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ impl Batch {
}

/// Upgrade a temp tag to a persistent tag.
rklaehn marked this conversation as resolved.
Show resolved Hide resolved
pub async fn upgrade(&self, tt: TempTag) -> Result<Tag> {
pub async fn persist(&self, tt: TempTag) -> Result<Tag> {
let tag = self
.0
.rpc
Expand All @@ -424,7 +424,7 @@ impl Batch {
}

/// Upgrade a temp tag to a persistent tag with a specific name.
rklaehn marked this conversation as resolved.
Show resolved Hide resolved
pub async fn upgrade_to(&self, tt: TempTag, tag: Tag) -> Result<()> {
pub async fn persist_to(&self, tt: TempTag, tag: Tag) -> Result<()> {
self.0
.rpc
.rpc(tags::SetRequest {
Expand All @@ -441,9 +441,9 @@ impl Batch {
/// an automatically generated name.
pub async fn upgrade_with_opts(&self, tt: TempTag, opts: SetTagOption) -> Result<Tag> {
match opts {
SetTagOption::Auto => self.upgrade(tt).await,
SetTagOption::Auto => self.persist(tt).await,
SetTagOption::Named(tag) => {
self.upgrade_to(tt, tag.clone()).await?;
self.persist_to(tt, tag.clone()).await?;
Ok(tag)
}
}
Expand Down
2 changes: 1 addition & 1 deletion iroh/tests/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,6 @@ async fn wrong_batch() -> anyhow::Result<()> {
let tag = batch.add_bytes(data).await?;
drop(batch);
let batch = client.batch().await?;
assert!(batch.upgrade(tag).await.is_err());
assert!(batch.persist(tag).await.is_err());
Ok(())
}
Loading