#hdfs #cargo

sys hdfs-sys

Bindings to HDFS Native C API

8 releases

Uses new Rust 2021

0.2.0 May 6, 2022
0.1.0 Apr 28, 2022
0.0.5 Apr 27, 2022

#101 in Build Utils

Download history 1380/week @ 2022-06-08 246/week @ 2022-06-15 481/week @ 2022-06-22 391/week @ 2022-06-29 499/week @ 2022-07-06 695/week @ 2022-07-13 855/week @ 2022-07-20 867/week @ 2022-07-27 629/week @ 2022-08-03 965/week @ 2022-08-10 928/week @ 2022-08-17 1183/week @ 2022-08-24 1186/week @ 2022-08-31 994/week @ 2022-09-07 1167/week @ 2022-09-14 917/week @ 2022-09-21

4,488 downloads per month
Used in 2 crates (via hdrs)


49K SLoC

C 49K SLoC // 0.1% comments Rust 554 SLoC // 0.0% comments

hdfs-sys   Build Status Latest Version

Bindings to HDFS Native C API.

Work with these bindings directly is boring and error proven, please use hdrs instead if ever possible.

Supported Versions

To target a version of libhdfs, enable a Cargo features such as one of the following:

  • hdfs_2_2 (default): requires hdfs 2.2 or later releases.
  • hdfs_2_3: requires hdfs 2.3 or later releases.
  • hdfs_2_4: requires hdfs 2.4 or later releases.
  • hdfs_2_5: requires hdfs 2.5 or later releases.
  • hdfs_2_6: requires hdfs 2.6 or later releases.
  • hdfs_2_7: requires hdfs 2.7 or later releases.
  • hdfs_2_8: requires hdfs 2.8 or later releases.
  • hdfs_2_9: requires hdfs 2.9 or later releases.
  • hdfs_2_10: requires hdfs 2.10 or later releases.
  • hdfs_3_0: requires hdfs 3.0 or later releases.
  • hdfs_3_1: requires hdfs 3.1 or later releases.
  • hdfs_3_2: requires hdfs 3.2 or later releases.
  • hdfs_3_3: requires hdfs 3.3 or later releases.

If you do not enable one of these features, the API provided by hdfs_2_2 will be available by default.

Enable one feature will also enable all features before it. For example, enable hdfs_2_4 will also enable hdfs_2_3 and hdfs_2_2.


This crate will link to libjvm dynamically.

To make this crate works correctly, please make sure the following env set correctly:

  • JAVA_HOME: hdfs-sys will search path like ${JAVA_HOME}/lib/server to link libjvm.

NOTE: hdfs-sys will ignore linking if DOCS_RS is set to build docs.


hdfs-sys uses JNI to call functions provided by jars that provided by hadoop releases. Please make sure CLASSPATH is set correctly before calling any functions provided by hdfs-sys:

export JAVA_HOME=/path/to/java
export HADOOP_HOME=/path/to/hadoop
export LD_LIBRARY_PATH=${JAVA_HOME}/lib/server
export CLASSPATH=$(find $HADOOP_HOME -iname "*.jar" | xargs echo | tr ' ' ':')


Check out the CONTRIBUTING.md guide for more details on getting started with contributing to this project.

Getting help

Submit issues for bug report or asking questions in discussion.


This project is highly inspired by clang-sys


Licensed under Apache License, Version 2.0.