hdfs_native/lib.rs
1// #![warn(missing_docs)]
2//! Native HDFS client implementation in Rust
3//!
4//! # Usage
5//!
6//! ## Async client
7//!
8//! Create an async client to a single NameNode
9//! ```rust
10//! use hdfs_native::ClientBuilder;
11//! let client = ClientBuilder::new().with_url("hdfs://localhost:9000").build().unwrap();
12//! ```
13//!
14//! Create an async client for a Name Service
15//! ```rust
16//! use hdfs_native::ClientBuilder;
17//! let client = ClientBuilder::new()
18//! .with_url("hdfs://ns")
19//! .with_config(vec![
20//! ("dfs.ha.namenodes.ns", "nn-1,nn-2"),
21//! ("dfs.namenode.rpc-address.ns.nn-1", "nn-1:9000"),
22//! ("dfs.namenode.rpc-address.ns.nn-2", "nn-2:9000"),
23//! ])
24//! .build()
25//! .unwrap();
26//! ```
27//!
28//! ## Sync client
29//!
30//! The [`sync`] module provides blocking wrappers around the async client. This is useful for
31//! applications that do not use Tokio directly.
32//!
33//! Create a sync client to a single NameNode
34//! ```rust
35//! use hdfs_native::sync::ClientBuilder;
36//! let client = ClientBuilder::new().with_url("hdfs://localhost:9000").build().unwrap();
37//! ```
38//!
39//! Use the sync client with standard IO traits
40//! ```rust,no_run
41//! use std::io::{Read, Write};
42//! use hdfs_native::{WriteOptions, sync::ClientBuilder};
43//!
44//! let client = ClientBuilder::new().with_url("hdfs://localhost:9000").build().unwrap();
45//! ```
46pub mod acl;
47pub mod client;
48pub(crate) mod common;
49#[cfg(feature = "benchmark")]
50pub mod ec;
51#[cfg(not(feature = "benchmark"))]
52pub(crate) mod ec;
53pub(crate) mod error;
54pub mod file;
55pub(crate) mod glob;
56pub(crate) mod hdfs;
57#[cfg(any(feature = "integration-test", feature = "benchmark"))]
58pub mod minidfs;
59pub(crate) mod proto;
60pub(crate) mod security;
61pub mod sync;
62
63pub use client::WriteOptions;
64pub use client::{Client, ClientBuilder};
65pub use error::HdfsError;
66pub use error::Result;
67
68// Module for testing hooks into non-test code
69#[cfg(feature = "integration-test")]
70pub mod test;