This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new a7b1a6c673 doc(unftp-sbe): adds example and readme (#4777)
a7b1a6c673 is described below
commit a7b1a6c67360fd05a9d8a3cc9385c2f5476c760c
Author: Pop <[email protected]>
AuthorDate: Thu Jun 20 18:22:31 2024 +0900
doc(unftp-sbe): adds example and readme (#4777)
add example and doc
---
README.md | 12 +++++---
integrations/unftp-sbe/README.md | 53 ++++++++++++++++++++++++++++++++-
integrations/unftp-sbe/examples/main.rs | 24 +++++++++++++++
3 files changed, 84 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index f6c662d94b..a07c94e517 100644
--- a/README.md
+++ b/README.md
@@ -64,8 +64,8 @@ OpenDAL offers a unified data access layer, empowering users
to seamlessly and e
## For *ANY* methods
-| Name | Description |
Release |
-|-------|--------------------------------------------------------------------|---------------------------|
+| Name | Description |
Release |
+|-------|--------------------------------------------------------------------|---------------------------|
| [oay] | Access data via API Gateway |
[![oay image]][oay crate] |
| [oli] | Access data via Command Line (alternative to s3cmd, s3cli, azcopy) |
[![oli image]][oli crate] |
| [ofs] | Access data via POSIX file system API (alternative to s3fs) |
[![ofs image]][ofs crate] |
@@ -88,6 +88,7 @@ OpenDAL offers a unified data access layer, empowering users
to seamlessly and e
| [object_store_opendal] | an [object_store] implementation using opendal.
| [![object_store image]][object_store crate] | [![Docs Release]][object_store
release docs] [![Docs Dev]][object_store dev docs] |
| [fuse3_opendal] | Access data via integrations to [fuse3]
| - | -
|
| [virtiofs_opendal] | Access data via integrations to
[vhost-user-backend] | - | -
|
+| [unftp-sbe-opendal] | an [unftp] storage backend implementation using
opendal. | - | -
|
[dav-server-opendalfs]: integrations/dav-server/README.md
[dav-server-rs]: https://github.com/messense/dav-server-rs
@@ -109,10 +110,13 @@ OpenDAL offers a unified data access layer, empowering
users to seamlessly and e
[virtiofs_opendal]: integrations/virtiofs/README.md
[vhost-user-backend]: https://docs.rs/vhost-user-backend
+[unftp-sbe-opendal]: integrations/unftp-sbe/README.md
+[unftp]: https://crates.io/crates/unftp
+
## For *ANY* services
-| Type | Services
|
-|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
+| Type | Services
|
+|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
| Standard Storage Protocols | ftp http [sftp] [webdav]
|
| Object Storage Services | [azblob] [cos] [gcs] [obs] [oss] [s3] <br>
[b2] [openstack_swift] [upyun] [vercel_blob]
|
| File Storage Services | fs [alluxio] [azdls] [azfile] [chainsafe]
[compfs] <br> [dbfs] [gridfs] [hdfs] [hdfs_native] [ipfs] [webhdfs]
|
diff --git a/integrations/unftp-sbe/README.md b/integrations/unftp-sbe/README.md
index e0969d64cd..0bf2f54f78 100644
--- a/integrations/unftp-sbe/README.md
+++ b/integrations/unftp-sbe/README.md
@@ -1,3 +1,54 @@
# Apache OpenDALâ„¢ unftp Integration
-This crate intends to build an backend based on OpenDAL for
[unftp](https://crates.io/crates/unftp).
\ No newline at end of file
+`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.
+
+## Examples
+
+```rust
+use anyhow::Result;
+use opendal::Operator;
+use unftp_sbe_opendal::OpendalStorage;
+
+#[tokio::main]
+async fn main() -> Result<()> {
+ // Create any service desired
+ let service = opendal::services::S3::from_map(
+ [
+ ("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();
+
+ // 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(())
+}
+```
+
+## Branding
+
+The first and most prominent mentions must use the full form: **Apache
OpenDALâ„¢** of the name for any individual usage (webpage, handout, slides,
etc.) Depending on the context and writing style, you should use the full form
of the name sufficiently often to ensure that readers clearly understand the
association of both the OpenDAL project and the OpenDAL software product to the
ASF as the parent organization.
+
+For more details, see the [Apache Product Name Usage
Guide](https://www.apache.org/foundation/marks/guide).
+
+## License and Trademarks
+
+Licensed under the Apache License, Version 2.0:
http://www.apache.org/licenses/LICENSE-2.0
+
+Apache OpenDAL, OpenDAL, and Apache are either registered trademarks or
trademarks of the Apache Software Foundation.
diff --git a/integrations/unftp-sbe/examples/main.rs
b/integrations/unftp-sbe/examples/main.rs
new file mode 100644
index 0000000000..541b96503f
--- /dev/null
+++ b/integrations/unftp-sbe/examples/main.rs
@@ -0,0 +1,24 @@
+use std::error::Error;
+
+use opendal::Operator;
+use unftp_sbe_opendal::OpendalStorage;
+
+#[tokio::main(flavor = "current_thread")]
+async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
+ // Create any service desired
+ let service = opendal::services::Memory::default();
+
+ // Init an operator with the service created
+ let op = Operator::new(service)?.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(())
+}