Skip to content

Commit

Permalink
docs(core): add the description of version parameter for operator (#5144
Browse files Browse the repository at this point in the history
)
  • Loading branch information
meteorgan authored Nov 26, 2024
1 parent 4444330 commit 5834e28
Showing 1 changed file with 106 additions and 0 deletions.
106 changes: 106 additions & 0 deletions core/src/types/operator/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,24 @@ impl Operator {
/// # }
/// ```
///
/// ## `version`
///
/// Set `version` for this `stat` request.
///
/// This feature can be used to retrieve the metadata of a specific version of the given path
///
/// If the version doesn't exist, an error with kind [`ErrorKind::NotFound`] will be returned.
///
/// ```no_run
/// # use opendal::Result;
/// # use opendal::Operator;
///
/// # async fn test(op: Operator, version: &str) -> Result<()> {
/// let mut metadata = op.stat_with("path/to/file").version(version).await?;
/// # Ok(())
/// # }
/// ```
///
/// # Examples
///
/// ## Get metadata while `ETag` matches
Expand Down Expand Up @@ -547,6 +565,24 @@ impl Operator {
/// # }
/// ```
///
/// ## `version`
///
/// Set `version` for this `read` request.
///
/// This feature can be used to retrieve the data of a specified version of the given path.
///
/// If the version doesn't exist, an error with kind [`ErrorKind::NotFound`] will be returned.
///
/// ```no_run
/// # use opendal::Result;
/// # use opendal::Operator;
///
/// # async fn test(op: Operator, version: &str) -> Result<()> {
/// let mut bs = op.read_with("path/to/file").version(version).await?;
/// # Ok(())
/// # }
/// ```
///
/// # Examples
///
/// Read the whole path into a bytes.
Expand Down Expand Up @@ -666,6 +702,24 @@ impl Operator {
/// # }
/// ```
///
/// ## `version`
///
/// Set `version` for this `reader`.
///
/// This feature can be used to retrieve the data of a specified version of the given path.
///
/// If the version doesn't exist, an error with kind [`ErrorKind::NotFound`] will be returned.
///
/// ```no_run
/// # use opendal::Result;
/// # use opendal::Operator;
///
/// # async fn test(op: Operator, version: &str) -> Result<()> {
/// let mut bs = op.reader_with("path/to/file").version(version).await?;
/// # Ok(())
/// # }
/// ```
///
/// # Examples
///
/// ```no_run
Expand Down Expand Up @@ -1481,6 +1535,26 @@ impl Operator {
///
/// - Deleting a file that does not exist won't return errors.
///
/// # Options
///
/// ## `version`
///
/// Set `version` for this `delete` request.
///
/// remove a specific version of the given path.
///
/// If the version doesn't exist, OpenDAL will not return errors.
///
/// ```no_run
/// # use opendal::Result;
/// # use opendal::Operator;
///
/// # async fn test(op: Operator, version: &str) -> Result<()> {
/// op.delete_with("path/to/file").version(version).await?;
/// # Ok(())
/// # }
///```
///
/// # Examples
///
/// ```
Expand Down Expand Up @@ -1786,6 +1860,22 @@ impl Operator {
/// # }
/// ```
///
/// ## `version`
///
/// Specify whether to list files along with all their versions
///
/// if `version` is enabled, all file versions will be returned; otherwise,
/// only the current files will be returned.
///
/// ```no_run
/// # use opendal::Result;
/// # use opendal::Operator;
/// # async fn test(op: Operator) -> Result<()> {
/// let mut entries = op.list_with("path/to/dir/").version(true).await?;
/// # Ok(())
/// # }
/// ```
///
/// # Examples
///
/// ## List all entries recursively
Expand Down Expand Up @@ -1936,6 +2026,22 @@ impl Operator {
/// # }
/// ```
///
/// ## `version`
///
/// Specify whether to list files along with all their versions
///
/// if `version` is enabled, all file versions will be returned; otherwise,
/// only the current files will be returned.
///
/// ```no_run
/// # use opendal::Result;
/// # use opendal::Operator;
/// # async fn test(op: Operator) -> Result<()> {
/// let mut entries = op.lister_with("path/to/dir/").version(true).await?;
/// # Ok(())
/// # }
/// ```
///
/// # Examples
///
/// ## List all files recursively
Expand Down

0 comments on commit 5834e28

Please sign in to comment.