Skip to content

Commit

Permalink
rename upgrade to persist
Browse files Browse the repository at this point in the history
  • Loading branch information
rklaehn committed Aug 14, 2024
1 parent 322008e commit 2209c07
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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.
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.
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(())
}

0 comments on commit 2209c07

Please sign in to comment.