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

feat: Implement list with metakey for blocking #2861

Merged
merged 4 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion bindings/c/src/lib.rs
Expand Up @@ -485,7 +485,7 @@ pub unsafe extern "C" fn opendal_operator_blocking_list(

let op = (*ptr).as_ref();
let path = unsafe { std::ffi::CStr::from_ptr(path).to_str().unwrap() };
match op.list(path) {
match op.lister(path) {
Ok(lister) => opendal_result_list {
lister: Box::into_raw(Box::new(opendal_blocking_lister::new(lister))),
code: opendal_code::OPENDAL_OK,
Expand Down
4 changes: 2 additions & 2 deletions bindings/haskell/src/lib.rs
Expand Up @@ -501,7 +501,7 @@ pub unsafe extern "C" fn blocking_list(
}
};

let res = match op.list(path_str) {
let res = match op.lister(path_str) {
Ok(lister) => FFIResult::ok(Box::into_raw(Box::new(lister))),
Err(e) => FFIResult::err_with_source("Failed to list", e),
};
Expand Down Expand Up @@ -540,7 +540,7 @@ pub unsafe extern "C" fn blocking_scan(
}
};

let res = match op.scan(path_str) {
let res = match op.lister_with(path_str).delimiter("").call() {
Ok(lister) => FFIResult::ok(Box::into_raw(Box::new(lister))),
Err(e) => FFIResult::err_with_source("Failed to scan", e),
};
Expand Down
14 changes: 12 additions & 2 deletions bindings/nodejs/src/lib.rs
Expand Up @@ -336,7 +336,12 @@ impl Operator {
#[napi]
pub fn scan_sync(&self, path: String) -> Result<BlockingLister> {
Ok(BlockingLister(
self.0.blocking().scan(&path).map_err(format_napi_error)?,
self.0
.blocking()
.lister_with(&path)
.delimiter("")
.call()
.map_err(format_napi_error)?,
))
}

Expand Down Expand Up @@ -443,7 +448,12 @@ impl Operator {
#[napi]
pub fn list_sync(&self, path: String) -> Result<BlockingLister> {
Ok(BlockingLister(
self.0.blocking().scan(&path).map_err(format_napi_error)?,
self.0
.blocking()
.lister_with(&path)
.delimiter("")
.call()
.map_err(format_napi_error)?,
))
}

Expand Down
10 changes: 8 additions & 2 deletions bindings/python/src/lib.rs
Expand Up @@ -146,12 +146,18 @@ impl Operator {

/// List current dir path.
pub fn list(&self, path: &str) -> PyResult<BlockingLister> {
Ok(BlockingLister(self.0.list(path).map_err(format_pyerr)?))
Ok(BlockingLister(self.0.lister(path).map_err(format_pyerr)?))
}

/// List dir in flat way.
pub fn scan(&self, path: &str) -> PyResult<BlockingLister> {
Ok(BlockingLister(self.0.scan(path).map_err(format_pyerr)?))
Ok(BlockingLister(
self.0
.lister_with(path)
.delimiter("")
.call()
.map_err(format_pyerr)?,
))
}

fn __repr__(&self) -> String {
Expand Down