2 releases

0.1.1 Feb 15, 2023
0.1.0 Dec 15, 2022

#643 in WebAssembly

23 downloads per month

Apache-2.0

175KB
1.5K SLoC

Rust 1K SLoC // 0.0% comments TypeScript 364 SLoC // 0.1% comments Java 18 SLoC Swift 15 SLoC

Crux Key-Value Store capability

This crate contains the KeyValue capability, which can be used to ask the Shell to read from, and write to, a key-value store.

For an example of how to use the capability, see the integration test.

About Crux Capabilities

Crux capabilities teach Crux how to interact with the shell when performing side effects. They do the following:

  1. define a Request struct to instruct the Shell how to perform the side effect on behalf of the Core
  2. define a Response struct to hold the data returned by the Shell after the side effect has completed
  3. declare one or more convenience methods for invoking the Shell's capability, each of which creates a Command (describing the effect and its continuation) that Crux can "execute"

Note that because Swift has no namespacing, there is currently a requirement to ensure that Request and Response are unambiguously named (e.g. HttpRequest and HttpResponse).


lib.rs:

A basic Key-Value store for use with Crux

crux_kv allows Crux apps to store and retrieve arbitrary data by asking the Shell to persist the data using platform native capabilities (e.g. disk or web localStorage)

This is still work in progress and extremely basic.

Dependencies

~2.8–4MB
~79K SLoC