Rust client for the anna-rs KVS that can run in the WasmEdge Runtime

Overview

wasmedge-anna-client

wasmedge-anna-client is a Rust client for anna-rs based on Tokio for WasmEdge. It communicates with Anna routing nodes and KVS nodes via vanilla TCP connections instead of Zenoh.

Usage

use std::time::Duration;
use wasmedge_anna_client::{Client, ClientConfig};

let mut client = Client::new(ClientConfig {
    routing_ip: "127.0.0.1".parse().unwrap(),
    routing_port_base: 12340,
    routing_threads: 1,
    timeout: Duration::from_secs(10),
})?;

// put the value
client.put_lww("foo".into(), "bar".into()).await?;

// sleep 1 second
tokio::time::sleep(Duration::from_secs(1)).await;

// get the value
let bytes = client.get_lww("foo".into()).await?;
let value = String::from_utf8(bytes)?;
println!("Successfully GET value of `foo`: {}", value);

Run the example

First, run routing node and KVS node of anna-rs:

$ cd anna-rs
$ cp example-config.yml config.yml
$ ANNA_PUBLIC_IP=127.0.0.1 ANNA_TCP_PORT_BASE=12340 cargo run --bin routing -- config.yml
$ # in another shell
$ ANNA_PUBLIC_IP=127.0.0.1 cargo run --bin kvs -- config.yml

Then, build and run the example app of wasmedge-anna-client:

$ cd example
$ cargo build --target wasm32-wasi
$ /path/to/wasmedge --dir .:. target/wasm32-wasi/debug/example.wasm

Attribution

Many code of this driver is derived from anna-rs.

You might also like...
Awesome books, tutorials, courses, and resources for the Tokio asynchronous runtime ecosystem. ⚡
Awesome books, tutorials, courses, and resources for the Tokio asynchronous runtime ecosystem. ⚡

Awesome Tokio Tokio is an asynchronous runtime for the Rust programming language. It provides the building blocks needed for writing network applicati

Rust lib for a Vec-like structure that can store different types of different sizes contiguous with each other in memory.

hvec In memory of Anna Harren, who coined the term turbofish - which you'll see a lot of if you use this crate. The main purpose of this crate is the

Hypergraph is data structure library to create a directed hypergraph in which a hyperedge can join any number of vertices.

Hypergraph is data structure library to create a directed hypergraph in which a hyperedge can join any number of vertices.

This represents staked SOL, and can be sold for wSOL in the wSOL/stSOL Liquidity Pool

This represents staked SOL, and can be sold for wSOL in the wSOL/stSOL Liquidity Pool (paying a fee to skip the unstaking cool-down period). The value of your stSOL holdings is automatically incremented each epoch when staking rewards are paid.

Cassandra DB native client written in Rust language. Find 1.x versions on https://github.com/AlexPikalov/cdrs/tree/v.1.x Looking for an async version? - Check WIP https://github.com/AlexPikalov/cdrs-async
Cassandra DB native client written in Rust language. Find 1.x versions on https://github.com/AlexPikalov/cdrs/tree/v.1.x Looking for an async version? - Check WIP https://github.com/AlexPikalov/cdrs-async

CDRS CDRS is looking for maintainers CDRS is Apache Cassandra driver written in pure Rust. 💡 Looking for an async version? async-std https://github.c

CouchDB client-side library for the Rust programming language

Chill Chill is a client-side CouchDB library for the Rust programming language, available on crates.io. It targets Rust Stable. Chill's three chief de

A Rust client for the ElasticSearch REST API

rs-es Introduction An ElasticSearch client for Rust via the REST API. Targetting ElasticSearch 2.0 and higher. Other clients For later versions of Ela

An Elasticsearch REST API client for Rust

elastic elastic is an efficient, modular API client for Elasticsearch written in Rust. The API is targeting the Elastic Stack 7.x. elastic provides st

An etcd client library for Rust.

etcd An etcd client library for Rust. etcd on crates.io Documentation for the latest crates.io release Running the tests Install Docker and Docker Com

Comments
  • Failed to run example

    Failed to run example

    when I run example. I get

    wasmedge  ../target/wasm32-wasi/debug/example.wasm
    fatal runtime error: assertion failed: thread_info.is_none()
    [2022-11-18 12:05:39.929] [error] execution failed: unreachable, Code: 0x89
    [2022-11-18 12:05:39.929] [error]     In instruction: unreachable (0x00) , Bytecode offset: 0x000748d4
    [2022-11-18 12:05:39.929] [error]     When executing function name: "_start"
    

    my wasmedge version is 0.11.2

    $ wasmedge -v
    wasmedge version 0.11.2
    

    If you run example is successfully, please tell me your wasmedge version.

    opened by L-jasmine 0
  • add `ReadCommittedTransaction` and `redis_like::Client`

    add `ReadCommittedTransaction` and `redis_like::Client`

    • Add ReadCommittedTransaction according to Anna paper, by buffering client writes until transaction.commit()
    • Add redis_like module, providing Client and Connection structures similar redis-rs
    opened by richardchien 0
Owner
WasmEdge Runtime
A cloud native WebAssembly runtime. A sandbox project at the CNCF (Cloud Native Computing Foundation) and Linux Foundation.
WasmEdge Runtime
OBKV Table Client is Rust Library that can be used to access table data from OceanBase storage layer.

OBKV Table Client is Rust Library that can be used to access table data from OceanBase storage layer. Its access method is different from JDBC, it skips the SQL parsing layer, so it has significant performance advantage.

OceanBase 4 Nov 14, 2022
The rust client for CeresDB. CeresDB is a high-performance, distributed, schema-less, cloud native time-series database that can handle both time-series and analytics workloads.

The rust client for CeresDB. CeresDB is a high-performance, distributed, schema-less, cloud native time-series database that can handle both time-series and analytics workloads.

null 12 Nov 18, 2022
rustodrive is a rust client library for communicating with ODrives using the CAN protocol.

rustodrive is a WIP client library for communicating with ODrives using the CAN protocol. It is more than a simple CAN sender/receiver and has many co

null 5 Oct 31, 2022
This code features a viper-client, which can connect to a viper-server, a custom interface made for Comelit devices.

Viper Client ?? (WIP) This is code for my intercom; specifically for the Comelit Mini Wi-Fi MSFV. This features a ViperClient which can talk to the Co

Gerard 4 Feb 20, 2023
Affine-client is a client for AFFINE based on Tauri

Affine Client affine-client is a client for AFFINE based on Tauri Supported Platforms Windows Linux MacOS Download https://github.com/m1911star/affine

Horus 216 Dec 25, 2022
How to run Rust user programs on Xv6-RISC-V

Rust on Xv6-RISC-V How to run user Rust program in Xv6-RISC-V Run make init to add rist-v target to rustc Run make build to build the program. It will

Jiaxiao Zhou 4 Aug 18, 2022
A tokio-uring backed runtime for Rust

tokio-uring A proof-of-concept runtime backed by io-uring while maintaining compatibility with the Tokio ecosystem. This is a proof of concept and not

Tokio 726 Jan 4, 2023
Rust async runtime based on io-uring.

Monoio A thread-per-core Rust runtime with io_uring. 中文说明 Design Goal As a runtime based on io_uring, Monoio is designed to be the most efficient and

Bytedance Inc. 2.4k Jan 6, 2023
Run SQL queries on CSV files

zsql run SQL queries on csv files A terminal utility to easily run SQL queries on CSV files. zsql is shipped as a small single binary powered by rust

Zizaco 9 Jul 9, 2022
An Async SDR Runtime for Heterogeneous Architectures

FutureSDR An experimental asynchronous SDR runtime for heterogeneous architectures that is: Extensible: custom buffers (supporting accelerators like G

FutureSDR 169 Jan 8, 2023