pub struct HdfsFs { /* private fields */ }Expand description
Hdfs Filesystem
It is basically thread safe because the native API for hdfsFs is thread-safe.
Implementations§
Source§impl HdfsFs
impl HdfsFs
Sourcepub fn new(
connection_properties: ConnectionProperties,
) -> Result<HdfsFs, HdfsErr>
pub fn new( connection_properties: ConnectionProperties, ) -> Result<HdfsFs, HdfsErr>
Create an instance of HdfsFs. A global cache is used to ensure that only one instance is created per namenode uri.
- connection_properties - Namenode connection parameters
Sourcepub fn new_with_hdfs_params(
connection_properties: ConnectionProperties,
hdfs_params: HashMap<String, String>,
) -> Result<HdfsFs, HdfsErr>
pub fn new_with_hdfs_params( connection_properties: ConnectionProperties, hdfs_params: HashMap<String, String>, ) -> Result<HdfsFs, HdfsErr>
Create an instance of HdfsFs. A global cache is used to ensure that only one instance is created per namenode uri.
- connection_properties - Namenode connection parameters
- hdfs_params - optional key value pairs that need to be passed to configure the HDFS client side. Example: key = ‘dfs.domain.socket.path’, value = ‘/var/lib/hadoop-fs/dn_socket’
Sourcepub fn create(&self, path: &str) -> Result<HdfsFile, HdfsErr>
pub fn create(&self, path: &str) -> Result<HdfsFile, HdfsErr>
Create the given path as read-only
Sourcepub fn create_with_overwrite(
&self,
path: &str,
overwrite: bool,
) -> Result<HdfsFile, HdfsErr>
pub fn create_with_overwrite( &self, path: &str, overwrite: bool, ) -> Result<HdfsFile, HdfsErr>
Create the given path as writable
Sourcepub fn create_with_params(
&self,
path: &str,
overwrite: bool,
buf_size: i32,
replica_num: i16,
block_size: i64,
) -> Result<HdfsFile, HdfsErr>
pub fn create_with_params( &self, path: &str, overwrite: bool, buf_size: i32, replica_num: i16, block_size: i64, ) -> Result<HdfsFile, HdfsErr>
Create the given path
pub fn get_file_status(&self, path: &str) -> Result<FileStatus, HdfsErr>
Sourcepub fn delete(&self, path: &str, recursive: bool) -> Result<bool, HdfsErr>
pub fn delete(&self, path: &str, recursive: bool) -> Result<bool, HdfsErr>
Delete the content at the given path.
- path - the path on the filesystem
- recursive - if true, delete the content recursively.
Sourcepub fn list_status(&self, path: &str) -> Result<Vec<FileStatus>, HdfsErr>
pub fn list_status(&self, path: &str) -> Result<Vec<FileStatus>, HdfsErr>
Get the file status of each entry under the specified path Note that it is an error to list an empty directory.
pub fn mkdir(&self, path: &str) -> Result<bool, HdfsErr>
pub fn open(&self, path: &str) -> Result<HdfsFile, HdfsErr>
pub fn open_with_buf_size( &self, path: &str, buf_size: i32, ) -> Result<HdfsFile, HdfsErr>
pub fn open_for_writing(&self, path: &str) -> Result<HdfsFile, HdfsErr>
Trait Implementations§
impl Send for HdfsFs
since HDFS client handles are completely thread safe, here we implement Send + Sync trait for HdfsFs
impl Sync for HdfsFs
Auto Trait Implementations§
impl Freeze for HdfsFs
impl RefUnwindSafe for HdfsFs
impl Unpin for HdfsFs
impl UnwindSafe for HdfsFs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more