From 6e945389acd741a62b74f42a4dc6167918ce8d05 Mon Sep 17 00:00:00 2001 From: Ruediger Klaehn Date: Wed, 14 Aug 2024 17:44:39 +0300 Subject: [PATCH] rename upgrade to persist --- iroh/src/client/blobs.rs | 1 - iroh/src/client/blobs/batch.rs | 8 ++++---- iroh/tests/batch.rs | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/iroh/src/client/blobs.rs b/iroh/src/client/blobs.rs index 8d9c358979..1b12df08b3 100644 --- a/iroh/src/client/blobs.rs +++ b/iroh/src/client/blobs.rs @@ -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; diff --git a/iroh/src/client/blobs/batch.rs b/iroh/src/client/blobs/batch.rs index 5a0eb0086e..eb8df9938c 100644 --- a/iroh/src/client/blobs/batch.rs +++ b/iroh/src/client/blobs/batch.rs @@ -410,7 +410,7 @@ impl Batch { } /// Upgrade a temp tag to a persistent tag. - pub async fn upgrade(&self, tt: TempTag) -> Result { + pub async fn persist(&self, tt: TempTag) -> Result { let tag = self .0 .rpc @@ -424,7 +424,7 @@ impl Batch { } /// Upgrade a temp tag to a persistent tag with a specific name. - 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 { @@ -441,9 +441,9 @@ impl Batch { /// an automatically generated name. pub async fn upgrade_with_opts(&self, tt: TempTag, opts: SetTagOption) -> Result { 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) } } diff --git a/iroh/tests/batch.rs b/iroh/tests/batch.rs index aaf9fbe542..8b852b03c7 100644 --- a/iroh/tests/batch.rs +++ b/iroh/tests/batch.rs @@ -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(()) }