1616//! `kerberos` - Enables Kerberos authentication support via the [libgssapi](https://docs.rs/libgssapi/latest/libgssapi) crate
1717//!
1818use std:: {
19+ collections:: HashMap ,
1920 fmt:: { Display , Formatter } ,
2021 future,
2122 path:: PathBuf ,
@@ -39,6 +40,10 @@ use tokio::{
3940 task:: { self , JoinHandle } ,
4041} ;
4142
43+ // Re-export minidfs for down-stream integration tests
44+ #[ cfg( feature = "integration-test" ) ]
45+ pub use hdfs_native:: minidfs;
46+
4247#[ derive( Debug ) ]
4348pub struct HdfsObjectStore {
4449 client : Arc < Client > ,
@@ -78,9 +83,29 @@ impl HdfsObjectStore {
7883 /// # }
7984 /// ```
8085 pub fn with_url ( url : & str ) -> Result < Self > {
81- Ok ( Self {
82- client : Arc :: new ( Client :: new ( url) . to_object_store_err ( ) ?) ,
83- } )
86+ Ok ( Self :: new ( Arc :: new ( Client :: new ( url) . to_object_store_err ( ) ?) ) )
87+ }
88+
89+ /// Creates a new HdfsObjectStore using the specified URL and Hadoop configs.
90+ ///
91+ /// Connect to a NameService
92+ /// ```rust
93+ /// # use hdfs_native_object_store::HdfsObjectStore;
94+ /// # use std::collections::HashMap;
95+ /// # fn main() -> object_store::Result<()> {
96+ /// let config = HashMap::from([
97+ /// ("dfs.ha.namenodes.ns".to_string(), "nn1,nn2".to_string()),
98+ /// ("dfs.namenode.rpc-address.nn1".to_string(), "nn1.example.com:9000".to_string()),
99+ /// ("dfs.namenode.rpc-address.nn2".to_string(), "nn2.example.com:9000".to_string()),
100+ /// ]);
101+ /// let store = HdfsObjectStore::with_config("hdfs://ns", config)?;
102+ /// # Ok(())
103+ /// # }
104+ /// ```
105+ pub fn with_config ( url : & str , config : HashMap < String , String > ) -> Result < Self > {
106+ Ok ( Self :: new ( Arc :: new (
107+ Client :: new_with_config ( url, config) . to_object_store_err ( ) ?,
108+ ) ) )
84109 }
85110
86111 async fn internal_copy ( & self , from : & Path , to : & Path , overwrite : bool ) -> Result < ( ) > {
0 commit comments