Crate hdrs

source · []
Expand description

hdrs is a HDFS Native Client in Rust based on hdfs-sys.

Examples

use std::io::{Read, Write};

use hdrs::Client;

let fs = Client::connect("default")?;

let mut f = fs.open("/tmp/hello.txt", libc::O_WRONLY | libc::O_CREAT)?;
let n = f.write("Hello, World!".as_bytes())?;

let mut f = fs.open("/tmp/hello.txt", libc::O_RDONLY)?;
let mut buf = vec![0; 1024];
let n = f.read(&mut buf)?;

let _ = fs.delete("/tmp/hello.txt", false)?;

Features

Structs

Client holds the underlying connection to hdfs clusters.

File will hold the underlying pointer to hdfsFile.