Struct dav_server_opendalfs::OpendalFs

source ·
pub struct OpendalFs {
    pub op: Operator,
}
Expand description

OpendalFs is a DavFileSystem implementation for opendal.

use anyhow::Result;
use dav_server::davpath::DavPath;
use dav_server::fs::DavFileSystem;
use dav_server_opendalfs::OpendalFs;
use opendal::services::Memory;
use opendal::Operator;

#[tokio::test]
async fn test() -> Result<()> {
    let op = Operator::new(Memory::default())?.finish();

    let webdavfs = OpendalFs::new(op);

    let metadata = webdavfs
        .metadata(&DavPath::new("/").unwrap())
        .await
        .unwrap();
    println!("{}", metadata.is_dir());

    Ok(())
}

Fields§

§op: Operator

Implementations§

source§

impl OpendalFs

source

pub fn new(op: Operator) -> Box<OpendalFs>

Create a new OpendalFs instance.

Trait Implementations§

source§

impl Clone for OpendalFs

source§

fn clone(&self) -> OpendalFs

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl DavFileSystem for OpendalFs

source§

fn open<'a>( &'a self, path: &'a DavPath, options: OpenOptions, ) -> FsFuture<'a, Box<dyn DavFile>>

Open a file.
source§

fn read_dir<'a>( &'a self, path: &'a DavPath, _meta: ReadDirMeta, ) -> FsFuture<'a, FsStream<Box<dyn DavDirEntry>>>

Perform read_dir.
source§

fn metadata<'a>( &'a self, path: &'a DavPath, ) -> FsFuture<'a, Box<dyn DavMetaData>>

Return the metadata of a file or directory.
source§

fn create_dir<'a>(&'a self, path: &'a DavPath) -> FsFuture<'a, ()>

Create a directory. Read more
source§

fn remove_dir<'a>(&'a self, path: &'a DavPath) -> FsFuture<'a, ()>

Remove a directory. Read more
source§

fn remove_file<'a>(&'a self, path: &'a DavPath) -> FsFuture<'a, ()>

Remove a file. Read more
source§

fn rename<'a>(&'a self, from: &'a DavPath, to: &'a DavPath) -> FsFuture<'a, ()>

Rename a file or directory. Read more
source§

fn copy<'a>(&'a self, from: &'a DavPath, to: &'a DavPath) -> FsFuture<'a, ()>

Copy a file Read more
Return the metadata of a file, directory or symbolic link. Read more
§

fn have_props<'a>( &'a self, path: &'a DavPath, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'a>>

Indicator that tells if this filesystem driver supports DAV properties. Read more
§

fn patch_props<'a>( &'a self, path: &'a DavPath, patch: Vec<(bool, DavProp)>, ) -> Pin<Box<dyn Future<Output = Result<Vec<(StatusCode, DavProp)>, FsError>> + Send + 'a>>

Patch the DAV properties of a node (add/remove props) Read more
§

fn get_props<'a>( &'a self, path: &'a DavPath, do_content: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<DavProp>, FsError>> + Send + 'a>>

List/get the DAV properties of a node. Read more
§

fn get_prop<'a>( &'a self, path: &'a DavPath, prop: DavProp, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, FsError>> + Send + 'a>>

Get one specific named property of a node. Read more
§

fn get_quota( &self, ) -> Pin<Box<dyn Future<Output = Result<(u64, Option<u64>), FsError>> + Send + '_>>

Get quota of this filesystem (used/total space). Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSendSync for T