Skip to content

Commit

Permalink
refactor: Avoid accessor in object entry (#992)
Browse files Browse the repository at this point in the history
* Save work

Signed-off-by: Xuanwo <[email protected]>

* Save work

Signed-off-by: Xuanwo <[email protected]>

* Save work

Signed-off-by: Xuanwo <[email protected]>

* Save work

Signed-off-by: Xuanwo <[email protected]>

* Fix

Signed-off-by: Xuanwo <[email protected]>

* Save work

Signed-off-by: Xuanwo <[email protected]>

* Format code

Signed-off-by: Xuanwo <[email protected]>

* Fix build

Signed-off-by: Xuanwo <[email protected]>

* polish API

Signed-off-by: Xuanwo <[email protected]>

* Polish stat

Signed-off-by: Xuanwo <[email protected]>

* Make sure cache updated

Signed-off-by: Xuanwo <[email protected]>

* Update comments for object

Signed-off-by: Xuanwo <[email protected]>

* Fix test

Signed-off-by: Xuanwo <[email protected]>

* Fix link

Signed-off-by: Xuanwo <[email protected]>

* Fix ftp

Signed-off-by: Xuanwo <[email protected]>

Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo authored Nov 24, 2022
1 parent 296e4e5 commit 0b9eb7d
Show file tree
Hide file tree
Showing 52 changed files with 1,401 additions and 1,575 deletions.
2 changes: 1 addition & 1 deletion examples/ftp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async fn main() -> Result<()> {
r#"OpenDAL ftp Example.
Available Environment Values:
- OPENDAL_FTP_ENDPOINT=endpoint # required
- OPENDAL_FTP_ENDPOINT=endpoint # required
- OPENDAL_FTP_ROOT=/path/to/dir/ # if not set, will be seen as "/"
- OPENDAL_FTP_USER=user # default with empty string ""
- OPENDAL_FTP_PASSWORD=password # default with empty string ""
Expand Down
10 changes: 6 additions & 4 deletions src/accessor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ use async_trait::async_trait;
use flagset::flags;
use flagset::FlagSet;

use crate::object::BlockingObjectPager;
use crate::object::ObjectPager;
use crate::ops::*;
use crate::*;

Expand Down Expand Up @@ -173,7 +175,7 @@ pub trait Accessor: Send + Sync + Debug + 'static {
///
/// - Input path MUST be dir path, DON'T NEED to check object mode.
/// - List non-exist dir should return Empty.
async fn list(&self, path: &str, args: OpList) -> Result<ObjectStreamer> {
async fn list(&self, path: &str, args: OpList) -> Result<(RpList, ObjectPager)> {
match self.inner() {
Some(inner) => inner.list(path, args).await,
None => Err(Error::new(
Expand Down Expand Up @@ -370,7 +372,7 @@ pub trait Accessor: Send + Sync + Debug + 'static {
///
/// - Require capability: `Blocking`
/// - List non-exist dir should return Empty.
fn blocking_list(&self, path: &str, args: OpList) -> Result<ObjectIterator> {
fn blocking_list(&self, path: &str, args: OpList) -> Result<(RpList, BlockingObjectPager)> {
match self.inner() {
Some(inner) => inner.blocking_list(path, args),
None => Err(Error::new(
Expand Down Expand Up @@ -404,7 +406,7 @@ impl<T: Accessor> Accessor for Arc<T> {
async fn delete(&self, path: &str, args: OpDelete) -> Result<RpDelete> {
self.as_ref().delete(path, args).await
}
async fn list(&self, path: &str, args: OpList) -> Result<ObjectStreamer> {
async fn list(&self, path: &str, args: OpList) -> Result<(RpList, ObjectPager)> {
self.as_ref().list(path, args).await
}

Expand Down Expand Up @@ -457,7 +459,7 @@ impl<T: Accessor> Accessor for Arc<T> {
fn blocking_delete(&self, path: &str, args: OpDelete) -> Result<RpDelete> {
self.as_ref().blocking_delete(path, args)
}
fn blocking_list(&self, path: &str, args: OpList) -> Result<ObjectIterator> {
fn blocking_list(&self, path: &str, args: OpList) -> Result<(RpList, BlockingObjectPager)> {
self.as_ref().blocking_list(path, args)
}
}
Expand Down
Loading

1 comment on commit 0b9eb7d

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for opendal ready!

✅ Preview
https://opendal-88s64stvg-databend.vercel.app

Built with commit 0b9eb7d.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.