Struct hdfs_native::client::Client

source ·
pub struct Client { /* private fields */ }

Implementations§

source§

impl Client

source

pub fn new(url: &str) -> Result<Self>

Creates a new HDFS Client. The URL must include the protocol and host, and optionally a port. If a port is included, the host is treated as a single NameNode. If no port is included, the host is treated as a name service that will be resolved using the HDFS config.

viewfs schemes are not currently supported.

source

pub async fn get_file_info(&self, path: &str) -> Result<FileStatus>

Retrieve the file status for the file at path.

source

pub async fn list_status( &self, path: &str, recursive: bool ) -> Result<Vec<FileStatus>>

Retrives a list of all files in directories located at path. Wrapper around list_status_iter that returns Err if any part of the stream fails, or Ok if all file statuses were found successfully.

source

pub fn list_status_iter( &self, path: &str, recursive: bool ) -> ListStatusIterator

Retrives an iterator of all files in directories located at path.

source

pub async fn read(&self, path: &str) -> Result<FileReader>

Opens a file reader for the file at path. Path should not include a scheme.

source

pub async fn create( &self, src: &str, write_options: WriteOptions ) -> Result<FileWriter>

source

pub async fn mkdirs( &self, path: &str, permission: u32, create_parent: bool ) -> Result<()>

Create a new directory at path with the given permission. If create_parent is true, any missing parent directories will be created as well, otherwise an error will be returned if the parent directory doesn’t already exist.

source

pub async fn rename(&self, src: &str, dst: &str, overwrite: bool) -> Result<()>

Renames src to dst. Returns Ok(()) on success, and Err otherwise.

source

pub async fn delete(&self, path: &str, recursive: bool) -> Result<bool>

Deletes the file or directory at path. If recursive is false and path is a non-empty directory, this will fail. Returns Ok(true) if it was successfully deleted.

Trait Implementations§

source§

impl Debug for Client

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.