4 releases

new 0.1.3 Oct 21, 2024
0.1.2 Oct 20, 2024
0.1.1 Oct 16, 2024
0.1.0 Oct 13, 2024

#323 in Database implementations

Download history 68/week @ 2024-10-07 335/week @ 2024-10-14

403 downloads per month
Used in bulletin-board-mathematic…

Apache-2.0

18KB
249 lines

Rust client for BulletinBoard

Sponsors Crates.io Crates.io License

BulletinBoard is an object strage for ArrayObject for debugging and data taking purposes. For more details, see BulletinBoard.

Example

Before using bulletin-board-client, you must set up a BulletinBoard server and set the server address in the environmental variable. It is convenient to set it in .cargo/config.toml of your Rust project:

[env]
BB_ADDR = "ADDRESS:PORT"

To post and read the bulletins,

use bulletin_board_client as bbclient;
use bbclient::*;

fn main() {
    let data: ArrayObject = vec![1f32, 2., -3., 5.].try_into().unwrap();
    bbclient::post("x", "tag", data.clone()).unwrap();

    let recv = bbclient::read("x", None, vec![]).unwrap().pop().unwrap();
    let restored = recv.try_into().unwrap();
    assert_eq!(data, restored);
}

To make the data persistent,

use bulletin_board_client as bbclient;

fn main() {
    bbclient::archive("x", "tag", "acv").unwrap();
    bbclient::reset().unwrap(); // Delete all temporary data.

    bbclient::load("acv").unwrap();
    dbg!(bbclient::view_board().unwrap());
}

Environment Variables

Variable Default Description
BB_ADDR "127.0.0.1:7578" or "/tmp/bb.sock" Address of the bulletin board server. It is either [IP address]:[port] or [hostname]:[port]. When UNIX socket is used, the address should be the path to the uncreated socket.

Crate Features

Feature Description
unix Use the UNIX socket instead of TCP. Only for UNIX-like OS.

Dependencies

~1.1–1.8MB
~39K SLoC