Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(core): add the description of version parameter for operator #5144

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading