Skip to content

Commit

Permalink
Add some comments to the code
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenperera committed Feb 2, 2024
1 parent 3ca6689 commit e88df36
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions async-nats/src/jetstream/kv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@ impl Store {
let entry = self.entry(key.as_ref()).await?;

match entry {
// key does not exist update with 0 revision to create it.
None => Ok(self.update(key, value, 0).await?),

// deleted or Purged key, we can create it again.
Some(Entry {
operation: Operation::Delete | Operation::Purge,
..
Expand All @@ -252,6 +255,7 @@ impl Store {
Ok(revision)
}

// key already exists.
Some(_) => Err(CreateError::new(CreateErrorKind::AlreadyExists)),
}
}
Expand Down

0 comments on commit e88df36

Please sign in to comment.