hbase-thrift

Crates.iohbase-thrift
lib.rshbase-thrift
version1.2.0
sourcesrc
created_at2021-12-06 20:27:45.805262
updated_at2024-01-21 20:01:11.926766
descriptionA client for HBase's Thrift Interface
homepage
repositoryhttps://github.com/midnightexigent/hbase-thrift-rs
max_upload_size
id493372
size621,929
0x776a (midnightexigent)

documentation

README

HBase Thrift

This library is like happybase, but in rust. It provides a way to interact with HBase's thrift interface

It provides (some) wrappers that make it easier to interact with the generated code from HBase's Thrift Spec

Additionnaly, it provides connection pools through thrift-pool : see the pool example

Example

use hbase_thrift::hbase::{HbaseSyncClient, THbaseSyncClient};
use thrift::{
    protocol::{TBinaryInputProtocol, TBinaryOutputProtocol},
    transport::{TBufferedReadTransport, TBufferedWriteTransport, TIoChannel, TTcpChannel},
};

fn main() -> Result<(), thrift::Error> {
    let mut channel = TTcpChannel::new();
    channel.open("localhost:9090")?;
    let (i_chan, o_chan) = channel.split()?;

    let i_prot = TBinaryInputProtocol::new(TBufferedReadTransport::new(i_chan), true);
    let o_prot = TBinaryOutputProtocol::new(TBufferedWriteTransport::new(o_chan), true);

    let mut client = HbaseSyncClient::new(i_prot, o_prot);
    let tables = client.get_table_names()?;

    println!(
        "tables: {:?}",
        tables
            .into_iter()
            .map(|v| String::from_utf8(v).unwrap())
            .collect::<Vec<_>>()
    );

    Ok(())
}

Other examples are under the examples directory

Also see vector-http-sink-hbase which motivated the creation of this library

Documentation

Commit count: 63

cargo fmt