|
2 | 2 | //!
|
3 | 3 | //! The purpose of tags is to mark information as important to prevent it
|
4 | 4 | //! from being garbage-collected (if the garbage collector is turned on).
|
5 |
| -//! Currently this is used for blobs. |
6 | 5 | //!
|
7 |
| -//! The main entry point is the [`Client`]. |
| 6 | +//! A tag has a name that is an arbitrary byte string. In many cases this will be |
| 7 | +//! a valid UTF8 string, but there are also use cases where it is useful to have |
| 8 | +//! non string data like integer ids in the tag name. |
| 9 | +//! |
| 10 | +//! Tags point to a [`HashAndFormat`]. |
| 11 | +//! |
| 12 | +//! A tag can point to a hash with format [`BlobFormat::Raw`]. In that case it will |
| 13 | +//! protect *just this blob* from being garbage-collected. |
8 | 14 | //!
|
9 |
| -//! [`Client::list`] can be used to list all tags. |
10 |
| -//! [`Client::list_hash_seq`] can be used to list all tags with a hash_seq format. |
| 15 | +//! It can also point to a hash in format [`BlobFormat::HashSeq`]. In that case it will |
| 16 | +//! protect the blob itself and all hashes in the blob (the blob must be just a sequence of hashes). |
| 17 | +//! Using this format it is possible to protect a large number of blobs with a single tag. |
11 | 18 | //!
|
12 |
| -//! [`Client::delete`] can be used to delete a tag. |
| 19 | +//! Tags can be created, read, renamed and deleted. Tags *do not* have to correspond to |
| 20 | +//! already existing data. It is perfectly valid to create a tag for data you don't have yet. |
| 21 | +//! |
| 22 | +//! The main entry point is the [`Client`]. |
13 | 23 | use std::ops::{Bound, RangeBounds};
|
14 | 24 |
|
15 | 25 | use anyhow::Result;
|
@@ -221,9 +231,9 @@ where
|
221 | 231 | stream.next().await.transpose()
|
222 | 232 | }
|
223 | 233 |
|
224 |
| - /// Rename a tag |
| 234 | + /// Rename a tag atomically |
225 | 235 | ///
|
226 |
| - /// This is done in steps, so it is not atomic! |
| 236 | + /// If the tag does not exist, this will return an error. |
227 | 237 | pub async fn rename(&self, from: impl AsRef<[u8]>, to: impl AsRef<[u8]>) -> Result<()> {
|
228 | 238 | let from = from.as_ref();
|
229 | 239 | let to = to.as_ref();
|
|
0 commit comments