pub struct Fs { /* private fields */ }
Expand description
POSIX file system support.
Capabilities
This service can be used to:
- read
- write
- list
-
scan -
presign - blocking
Configuration
root
: Set the work dir for backend.
Refer to FsBuilder
’s public API docs for more information.
Example
Via Builder
use std::sync::Arc;
use anyhow::Result;
use opendal::services::Fs;
use opendal::Operator;
#[tokio::main]
async fn main() -> Result<()> {
// Create fs backend builder.
let mut builder = Fs::default();
// Set the root for fs, all operations will happen under this root.
//
// NOTE: the root must be absolute path.
builder.root("/tmp");
// `Accessor` provides the low level APIs, we will use `Operator` normally.
let op: Operator = Operator::new(builder)?.finish();
Ok(())
}
Implementations§
source§impl FsBuilder
impl FsBuilder
sourcepub fn atomic_write_dir(&mut self, dir: &str) -> &mut Self
pub fn atomic_write_dir(&mut self, dir: &str) -> &mut Self
Set temp dir for atomic write.
sourcepub fn enable_path_check(&mut self) -> &mut Self
pub fn enable_path_check(&mut self) -> &mut Self
OpenDAL requires all input path are normalized to make sure the behavior is consistent. By enable path check, we can make sure fs will behave the same as other services.
Enabling this feature will lead to extra metadata call in all operations.