HdfsFs

Struct HdfsFs 

Source
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

Source

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
Source

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’
Source

pub fn append(&self, path: &str) -> Result<HdfsFile, HdfsErr>

Open a file for append

Source

pub fn create(&self, path: &str) -> Result<HdfsFile, HdfsErr>

Create the given path as read-only

Source

pub fn create_with_overwrite( &self, path: &str, overwrite: bool, ) -> Result<HdfsFile, HdfsErr>

Create the given path as writable

Source

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

Source

pub fn get_file_status(&self, path: &str) -> Result<FileStatus, HdfsErr>

Source

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.
Source

pub fn exist(&self, path: &str) -> bool

Check if the given path exists on the filesystem

Source

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.

Source

pub fn mkdir(&self, path: &str) -> Result<bool, HdfsErr>

Source

pub fn open(&self, path: &str) -> Result<HdfsFile, HdfsErr>

Source

pub fn open_with_buf_size( &self, path: &str, buf_size: i32, ) -> Result<HdfsFile, HdfsErr>

Source

pub fn open_for_writing(&self, path: &str) -> Result<HdfsFile, HdfsErr>

Source

pub fn rename(&self, old_path: &str, new_path: &str) -> Result<bool, HdfsErr>

Rename a file

old_path - the path to rename new_path - the new name

Note that the destination directory must exist.

Trait Implementations§

Source§

impl Clone for HdfsFs

Source§

fn clone(&self) -> HdfsFs

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HdfsFs

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Send for HdfsFs

since HDFS client handles are completely thread safe, here we implement Send + Sync trait for HdfsFs

Source§

impl Sync for HdfsFs

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.