elastik 0.0.1

Rust client for elastik — pastebin with HMAC that accidentally became a web OS.
Documentation

elastik

Rust client for elastik. The server is the Rust binary you pip install. This crate is the Rust client that talks to it.

use elastik::Elastik;

fn main() -> Result<(), elastik::Error> {
    let e = Elastik::new("http://localhost:3105").token("t");

    e.put("/home/note", b"hello", &[("actor", "me")])?;
    let body = e.get_raw("/home/note")?;
    assert_eq!(body, b"hello");

    let worlds = e.list()?;
    println!("{worlds:?}");

    e.delete("/home/note")?;
    Ok(())
}

Install

[dependencies]
elastik = "0.0.1"

What is elastik

A pastebin with HMAC that accidentally became a web OS. One Rust binary on the server, one client per language. The server lives in pip install elastik; the JavaScript client in @elastik/client; this crate is the Rust client.

API

let e = Elastik::new(url).token(t);

e.put(path, data, &[("meta_key", "value")]);   // → PutResponse
e.get(path);                                    // → Envelope (JSON)
e.get_raw(path);                                // → Vec<u8> (raw bytes)
e.head(path);                                   // → HashMap<String, String>
e.delete(path);                                 // → bool
e.list();                                       // → Vec<String>
e.shaped(path, accept, intent);                 // → Vec<u8>

Synchronous (reqwest::blocking) by default. Async support behind the async feature flag (TODO).

Status

Sketch / 0.0.1. Atom bindings only. The reactor sugar (@listen + Action classes, the L2 layer in the Python SDK) and the bundled-binary spawn helper haven't been ported yet — for now, run the elastik server out-of-band (any way works: pip install elastik && python -c "import elastik; elastik.start()" is one line) and point this client at it.

License

MIT.