4 releases
0.0.3 | Nov 7, 2024 |
---|---|
0.0.2 | Oct 23, 2024 |
0.0.1 | Sep 18, 2024 |
0.0.0 | Sep 11, 2024 |
#656 in HTTP server
320 downloads per month
Used in ofs
3MB
62K
SLoC
Apache OpenDAL™ Cloud Filter Integration
cloud_filter_opendal
integrates OpenDAL with cloud sync engines. It provides a way to access various cloud storage on Windows.
Note that cloud_filter_opendal
is a read-only service, and it is not recommended to use it in production.
Example
use anyhow::Result;
use cloud_filter::root::PopulationType;
use cloud_filter::root::SecurityId;
use cloud_filter::root::Session;
use cloud_filter::root::SyncRootIdBuilder;
use cloud_filter::root::SyncRootInfo;
use opendal::services;
use opendal::Operator;
use tokio::runtime::Handle;
use tokio::signal;
#[tokio::main]
async fn main() -> Result<()> {
// Create any service desired
let op = Operator::from_iter::<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()),
])?
.finish();
let client_path = std::env::var("CLIENT_PATH").expect("$CLIENT_PATH is set");
// Create a sync root id
let sync_root_id = SyncRootIdBuilder::new("cloud_filter_opendal")
.user_security_id(SecurityId::current_user()?)
.build();
// Register the sync root if not exists
if !sync_root_id.is_registered()? {
sync_root_id.register(
SyncRootInfo::default()
.with_display_name("OpenDAL Cloud Filter")
.with_population_type(PopulationType::Full)
.with_icon("shell32.dll,3")
.with_version("1.0.0")
.with_recycle_bin_uri("http://cloudmirror.example.com/recyclebin")?
.with_path(&client_path)?,
)?;
}
let handle = Handle::current();
let connection = Session::new().connect_async(
&client_path,
cloud_filter_opendal::CloudFilter::new(op, client_path.clone().into()),
move |f| handle.block_on(f),
)?;
signal::ctrl_c().await?;
// Drop the connection before unregister the sync root
drop(connection);
sync_root_id.unregister()?;
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.
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.
Dependencies
~145MB
~2.5M SLoC