pub struct Azdfs { /* private fields */ }
Expand description
Azure Data Lake Storage Gen2 Support.
As known as abfs
, azdfs
or azdls
.
This service will visist the ABFS URI supported by Azure Data Lake Storage Gen2.
Configuration
root
: Set the work dir for backend.filesystem
: Set the filesystem name for backend.endpoint
: Set the endpoint for backend.account_name
: Set the account_name for backend.account_key
: Set the account_key for backend.
Refer to public API docs for more information.
Example
Init OpenDAL Operator
Via Builder
use std::sync::Arc;
use anyhow::Result;
use opendal::services::Azdfs;
use opendal::Object;
use opendal::Operator;
#[tokio::main]
async fn main() -> Result<()> {
// Create azblob backend builder.
let mut builder = Azdfs::default();
// Set the root for azblob, all operations will happen under this root.
//
// NOTE: the root must be absolute path.
builder.root("/path/to/dir");
// Set the filesystem name, this is required.
builder.filesystem("test");
// Set the endpoint, this is required.
//
// For examples:
// - "https://accountname.dfs.core.windows.net"
builder.endpoint("https://accountname.dfs.core.windows.net");
// Set the account_name and account_key.
//
// OpenDAL will try load credential from the env.
// If credential not set and no valid credential in env, OpenDAL will
// send request without signing like anonymous user.
builder.account_name("account_name");
builder.account_key("account_key");
// `Accessor` provides the low level APIs, we will use `Operator` normally.
let op: Operator = Operator::create(builder)?.finish();
// Create an object handle to start operation on object.
let _: Object = op.object("test_file");
Ok(())
}
Implementations§
source§impl AzdfsBuilder
impl AzdfsBuilder
sourcepub fn root(&mut self, root: &str) -> &mut Self
pub fn root(&mut self, root: &str) -> &mut Self
Set root of this backend.
All operations will happen under this root.
sourcepub fn filesystem(&mut self, filesystem: &str) -> &mut Self
pub fn filesystem(&mut self, filesystem: &str) -> &mut Self
Set filesystem name of this backend.
sourcepub fn endpoint(&mut self, endpoint: &str) -> &mut Self
pub fn endpoint(&mut self, endpoint: &str) -> &mut Self
Set endpoint of this backend.
Endpoint must be full uri, e.g.
- Azblob:
https://accountname.blob.core.windows.net
- Azurite:
http://127.0.0.1:10000/devstoreaccount1
sourcepub fn account_name(&mut self, account_name: &str) -> &mut Self
pub fn account_name(&mut self, account_name: &str) -> &mut Self
Set account_name of this backend.
- If account_name is set, we will take user’s input first.
- If not, we will try to load it from environment.
sourcepub fn account_key(&mut self, account_key: &str) -> &mut Self
pub fn account_key(&mut self, account_key: &str) -> &mut Self
Set account_key of this backend.
- If account_key is set, we will take user’s input first.
- If not, we will try to load it from environment.
sourcepub fn http_client(&mut self, client: HttpClient) -> &mut Self
pub fn http_client(&mut self, client: HttpClient) -> &mut Self
Specify the http client that used by this service.
Notes
This API is part of OpenDAL’s Raw API. HttpClient
could be changed
during minor updates.
Trait Implementations§
source§impl Builder for AzdfsBuilder
impl Builder for AzdfsBuilder
source§impl Clone for AzdfsBuilder
impl Clone for AzdfsBuilder
source§fn clone(&self) -> AzdfsBuilder
fn clone(&self) -> AzdfsBuilder
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for AzdfsBuilder
impl Debug for AzdfsBuilder
source§impl Default for AzdfsBuilder
impl Default for AzdfsBuilder
source§fn default() -> AzdfsBuilder
fn default() -> AzdfsBuilder
Returns the “default value” for a type. Read more