2 stable releases

2.0.0 Jul 11, 2024
1.0.2 Nov 29, 2023

#2471 in Database interfaces

Download history 197/week @ 2024-08-12 200/week @ 2024-08-19 206/week @ 2024-08-26 224/week @ 2024-09-02 241/week @ 2024-09-09 152/week @ 2024-09-16 229/week @ 2024-09-23 186/week @ 2024-09-30 161/week @ 2024-10-07 282/week @ 2024-10-14 128/week @ 2024-10-21 186/week @ 2024-10-28 148/week @ 2024-11-04 187/week @ 2024-11-11 169/week @ 2024-11-18 212/week @ 2024-11-25

738 downloads per month

Apache-2.0

115KB
2K SLoC

Apache HoraeDB (Incubating) Rust Client

License Crates.io

Introduction

Rust client for Apache HoraeDB (Incubating).

[!IMPORTANT] Apache HoraeDB (incubating) is an effort undergoing incubation at the Apache Software Foundation (ASF), sponsored by the Apache Incubator PMC.

Please read the DISCLAIMER and a full explanation of "incubating".

Support features

  • Query
  • Write

Contributing

Any contribution is welcome!

Read our Contributing Guide and make your first contribution!

License

Under Apache License 2.0.


lib.rs:

This crate provides an user-friendly client for [HoraeDB](https://github.com/HoraeDB /horaedb).

With this crate, you can access a standalone HoraeDB or a HoraeDB cluster and manipulates the data in it. And the underlying communication between the client the HoraeDB servers is based on the gRPC, and the protocol is defined in the horaedbproto.

Choose Mode

Two access Modes are provided by the client, Proxy and Direct:

  • When accessing HoraeDB cluster by Direct mode, the requests will be sent directly to the right HoraeDB instance determined by routing information.
  • When accessing HoraeDB by Proxy mode, the requests are just sent to any one HoraeDB instance, which takes the responsibilities for forwarding the requests.

If the client can't access the HoraeDB server directly because of the network partition, Proxy mode is the only choice. Otherwise, Direct mode is suggested for better performance.

Usage

Build the client, and then manipulate the HoraeDB by writing and querying.

Example

Here is an example to create a table in HoraeDB by the client.


let client = Builder::new("127.0.0.1:8831".to_string(), Mode::Direct).build();
let rpc_ctx = RpcContext::default().database("public".to_string());

let create_table_sql = r#"CREATE TABLE IF NOT EXISTS horaedb (
    str_tag string TAG,
    int_tag int32 TAG,
    var_tag varbinary TAG,
    str_field string,
    int_field int32,
    bin_field varbinary,
    t timestamp NOT NULL,
    TIMESTAMP KEY(t)) ENGINE=Analytic with
    (enable_ttl='false')"#;

let req = SqlQueryRequest {
    tables: vec!["horaedb".to_string()],
    sql: create_table_sql.to_string(),
};
let resp = client
    .sql_query(&rpc_ctx, &req)
    .await
    .expect("Should succeed to create table");

println!("Create table result:{:?}", resp);

Dependencies

~20–33MB
~447K SLoC