You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2024/07/01 06:22:22 UTC
(opendal) branch docs created (now 09e2af0c63)
This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a change to branch docs
in repository https://gitbox.apache.org/repos/asf/opendal.git
at 09e2af0c63 docs(integration/unftp-sbe): Polish docs for unftp-sbe
This branch includes the following new commits:
new 09e2af0c63 docs(integration/unftp-sbe): Polish docs for unftp-sbe
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(opendal) 01/01: docs(integration/unftp-sbe): Polish docs for unftp-sbe
Posted by xu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch docs
in repository https://gitbox.apache.org/repos/asf/opendal.git
commit 09e2af0c637e478eea2721406998d1c01680dfe8
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Mon Jul 1 14:21:59 2024 +0800
docs(integration/unftp-sbe): Polish docs for unftp-sbe
Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
integrations/README.md | 17 ----------------
integrations/unftp-sbe/Cargo.toml | 5 +++++
integrations/unftp-sbe/README.md | 18 +++++++++-------
integrations/unftp-sbe/src/lib.rs | 43 +++++++++++++++++++++++++++++++++++++++
4 files changed, 59 insertions(+), 24 deletions(-)
diff --git a/integrations/README.md b/integrations/README.md
deleted file mode 100644
index 721532d3b2..0000000000
--- a/integrations/README.md
+++ /dev/null
@@ -1,17 +0,0 @@
-# OpenDAL Integrations
-
-This folder contains the integrations for OpenDAL. Integrations are used to integrate OpenDAL with other systems.
-
-## Available Integrations
-
-- [`object_store_opendal`](object_store/README.md): Use OpenDAL as a backend for the [object_store](https://docs.rs/object_store/latest/object_store/).
-
-- [`dav-server-opendalfs`](dav-server/README.md): Use OpenDAL as a backend to access data in various service with WebDAV protocol.
-
-- [`fuse3_opendal`](fuse3/README.md): Use OpenDAL as a backend to access data in various services with FUSE protocol.
-
-- [`virtiofs_opendal`](virtiofs/README.md): Use OpenDAL as a backend to access data in various services with VirtioFS protocol.
-
-- [`unftp-sbe-opendal`](unftp-sbe/README.md): Use OpenDAL as a backend to access data in various services with FTP protocol.
-
-- [`cloudfilter_opendal`](cloudfilter/README.md): Use OpenDAL as a backend to access data in various services with [CloudFilter](https://learn.microsoft.com/en-us/windows/win32/api/_cloudapi/).
diff --git a/integrations/unftp-sbe/Cargo.toml b/integrations/unftp-sbe/Cargo.toml
index fb28aef92a..3ad20094ef 100644
--- a/integrations/unftp-sbe/Cargo.toml
+++ b/integrations/unftp-sbe/Cargo.toml
@@ -32,3 +32,8 @@ libunftp = "0.20.0"
opendal = { version = "0.47.0", path = "../../core" }
tokio = { version = "1.38.0", default-features = false, features = ["io-util"] }
tokio-util = { version = "0.7.11", features = ["compat"] }
+
+[dev-dependencies]
+tokio = { version = "1.38.0", default-features = false, features = ["io-util", "rt-multi-thread"] }
+anyhow = "1"
+opendal = { version = "0.47.0", path = "../../core", features = ["services-s3"] }
diff --git a/integrations/unftp-sbe/README.md b/integrations/unftp-sbe/README.md
index 0bf2f54f78..3624bc013b 100644
--- a/integrations/unftp-sbe/README.md
+++ b/integrations/unftp-sbe/README.md
@@ -4,29 +4,33 @@
This crate can help you to access ANY storage services with the same ftp API.
+## Useful Links
+
+- Documentation: [release](https://docs.rs/unftp-sbe-opendal/) | [dev](https://opendal.apache.org/docs/unftp-sbe-opendal/unftp_sbe_opendal/)
+
## Examples
```rust
use anyhow::Result;
use opendal::Operator;
+use opendal::Scheme;
+use opendal::services;
use unftp_sbe_opendal::OpendalStorage;
#[tokio::main]
async fn main() -> Result<()> {
// Create any service desired
- let service = opendal::services::S3::from_map(
+ let op = opendal::Operator::from_map::<services::S3>(
[
+ ("bucket".to_string(), "my_bucket".to_string()),
("access_key".to_string(), "my_access_key".to_string()),
("secret_key".to_string(), "my_secret_key".to_string()),
("endpoint".to_string(), "my_endpoint".to_string()),
("region".to_string(), "my_region".to_string()),
]
- .into_iter()
- .collect(),
- );
-
- // Init an operator with the service created
- let op = Operator::new(service)?.finish();
+ .into_iter()
+ .collect(),
+ )?.finish();
// Wrap the operator with `OpendalStorage`
let backend = OpendalStorage::new(op);
diff --git a/integrations/unftp-sbe/src/lib.rs b/integrations/unftp-sbe/src/lib.rs
index fef41e3918..4f99195461 100644
--- a/integrations/unftp-sbe/src/lib.rs
+++ b/integrations/unftp-sbe/src/lib.rs
@@ -15,6 +15,49 @@
// specific language governing permissions and limitations
// under the License.
+//! `unftp-sbe-opendal` is an [unftp](https://crates.io/crates/unftp) `StorageBackend` implementation using opendal.
+//!
+//! This crate can help you to access ANY storage services with the same ftp API.
+//!
+//! # Example
+//!
+//! This example demonstrates how to use `unftp-sbe-opendal` with the `S3` service.
+//!
+//! ```no_run
+//! use anyhow::Result;
+//! use opendal::Operator;
+//! use opendal::Scheme;
+//! use opendal::services;
+//! use unftp_sbe_opendal::OpendalStorage;
+//!
+//! #[tokio::main]
+//! async fn main() -> Result<()> {
+//! // Create any service desired
+//! let op = opendal::Operator::from_map::<services::S3>(
+//! [
+//! ("bucket".to_string(), "my_bucket".to_string()),
+//! ("access_key".to_string(), "my_access_key".to_string()),
+//! ("secret_key".to_string(), "my_secret_key".to_string()),
+//! ("endpoint".to_string(), "my_endpoint".to_string()),
+//! ("region".to_string(), "my_region".to_string()),
+//! ]
+//! .into_iter()
+//! .collect(),
+//! )?.finish();
+//!
+//! // Wrap the operator with `OpendalStorage`
+//! let backend = OpendalStorage::new(op);
+//!
+//! // Build the actual unftp server
+//! let server = libunftp::ServerBuilder::new(Box::new(move || backend.clone())).build()?;
+//!
+//! // Start the server
+//! server.listen("0.0.0.0:0").await?;
+//!
+//! Ok(())
+//! }
+//! ```
+
use std::fmt::Debug;
use std::path::{Path, PathBuf};