fuse3_opendal/
lib.rs

1// Licensed to the Apache Software Foundation (ASF) under one
2// or more contributor license agreements.  See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership.  The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License.  You may obtain a copy of the License at
8//
9//   http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied.  See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18//! `fuse3_opendal` is an [`fuse3`](https://github.com/Sherlock-Holo/fuse3) implementation using opendal.
19//!
20//! This crate can help you to access ANY storage services by mounting locally by [`FUSE`](https://www.kernel.org/doc/html/next/filesystems/fuse.html).
21//!
22//! ```
23//! use fuse3::path::Session;
24//! use fuse3::MountOptions;
25//! use fuse3::Result;
26//! use fuse3_opendal::Filesystem;
27//! use opendal::services::Memory;
28//! use opendal::Operator;
29//!
30//! #[tokio::test]
31//! async fn test() -> Result<()> {
32//!     // Build opendal Operator.
33//!     let op = Operator::new(Memory::default())?.finish();
34//!
35//!     // Build fuse3 file system.
36//!     let fs = Filesystem::new(op, 1000, 1000);
37//!
38//!     // Configure mount options.
39//!     let mount_options = MountOptions::default();
40//!
41//!     // Start a fuse3 session and mount it.
42//!     let mut mount_handle = Session::new(mount_options)
43//!         .mount_with_unprivileged(fs, "/tmp/mount_test")
44//!         .await?;
45//!     let handle = &mut mount_handle;
46//!
47//!     tokio::select! {
48//!         res = handle => res?,
49//!         _ = tokio::signal::ctrl_c() => {
50//!             mount_handle.unmount().await?
51//!         }
52//!     }
53//!
54//!     Ok(())
55//! }
56//! ```
57
58mod file;
59mod file_system;
60pub use file_system::Filesystem;