Skip to main content

Crate hdfs_native

Crate hdfs_native 

Source
Expand description

Native HDFS client implementation in Rust

§Usage

§Async client

Create an async client to a single NameNode

use hdfs_native::ClientBuilder;
let client = ClientBuilder::new().with_url("hdfs://localhost:9000").build().unwrap();

Create an async client for a Name Service

use hdfs_native::ClientBuilder;
let client = ClientBuilder::new()
    .with_url("hdfs://ns")
    .with_config(vec![
        ("dfs.ha.namenodes.ns", "nn-1,nn-2"),
        ("dfs.namenode.rpc-address.ns.nn-1", "nn-1:9000"),
        ("dfs.namenode.rpc-address.ns.nn-2", "nn-2:9000"),
    ])
    .build()
    .unwrap();

§Sync client

The sync module provides blocking wrappers around the async client. This is useful for applications that do not use Tokio directly.

Create a sync client to a single NameNode

use hdfs_native::sync::ClientBuilder;
let client = ClientBuilder::new().with_url("hdfs://localhost:9000").build().unwrap();

Use the sync client with standard IO traits

use std::io::{Read, Write};
use hdfs_native::{WriteOptions, sync::ClientBuilder};

let client = ClientBuilder::new().with_url("hdfs://localhost:9000").build().unwrap();

Re-exports§

pub use client::WriteOptions;
pub use client::Client;
pub use client::ClientBuilder;

Modules§

acl
client
file
sync
Synchronous wrappers around the asynchronous HDFS client.

Enums§

HdfsError

Type Aliases§

Result