This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch implement-list-metakey
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


The following commit(s) were added to refs/heads/implement-list-metakey by this 
push:
     new c570a8ccc regen opendal.h
c570a8ccc is described below

commit c570a8ccc48f8c20e325b4c84468946d4a6d1b23
Author: Xuanwo <[email protected]>
AuthorDate: Mon Aug 7 15:51:34 2023 +0800

    regen opendal.h
    
    Signed-off-by: Xuanwo <[email protected]>
---
 bindings/c/include/opendal.h | 43 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 41 insertions(+), 2 deletions(-)

diff --git a/bindings/c/include/opendal.h b/bindings/c/include/opendal.h
index d83356324..bc47bf5b5 100644
--- a/bindings/c/include/opendal.h
+++ b/bindings/c/include/opendal.h
@@ -85,7 +85,7 @@ typedef enum opendal_code {
  * BlockingLister is designed to list entries at given path in a blocking
  * manner.
  *
- * Users can construct Lister by `blocking_list` or `blocking_scan`.
+ * Users can construct Lister by `blocking_lister`.
  */
 typedef struct BlockingLister BlockingLister;
 
@@ -122,7 +122,46 @@ typedef struct BlockingLister BlockingLister;
 typedef struct BlockingOperator BlockingOperator;
 
 /**
- * Entry is the file/dir entry returned by `Lister`.
+ * Entry returned by [`Lister`] or [`BlockingLister`] to represent a path and 
it's relative metadata.
+ *
+ * # Notes
+ *
+ * Entry returned by [`Lister`] or [`BlockingLister`] may carry some already 
known metadata.
+ * Lister by default only make sure that `Mode` is fetched. To make sure the 
entry contains
+ * metadata you want, please use `list_with` or `lister_with` and `metakey`.
+ *
+ * For example:
+ *
+ * ```no_run
+ * # use anyhow::Result;
+ * use opendal::EntryMode;
+ * use opendal::Metakey;
+ * use opendal::Operator;
+ * # #[tokio::main]
+ * # async fn test(op: Operator) -> Result<()> {
+ * let mut entries = op
+ *     .list_with("dir/")
+ *     .metakey(Metakey::ContentLength | Metakey::LastModified)
+ *     .await?;
+ * for entry in entries {
+ *     let meta = entry.metadata();
+ *     match meta.mode() {
+ *         EntryMode::FILE => {
+ *             println!(
+ *                 "Handling file {} with size {}",
+ *                 entry.path(),
+ *                 meta.content_length()
+ *             )
+ *         }
+ *         EntryMode::DIR => {
+ *             println!("Handling dir {}", entry.path())
+ *         }
+ *         EntryMode::Unknown => continue,
+ *     }
+ * }
+ * # Ok(())
+ * # }
+ * ```
  */
 typedef struct Entry Entry;
 

Reply via email to