diff --git a/rust/README.md b/rust/README.md index 03d99ca..8e3fa9e 100644 --- a/rust/README.md +++ b/rust/README.md @@ -1,2 +1,39 @@ -## WIP -Not ready for use !! \ No newline at end of file +# Versioned Storage Service (Rust) + +This directory hosts the Rust-based implementation of the Versioned Storage Service (VSS). + +### Prerequisites + +- Install Rust and Cargo (https://www.rust-lang.org/tools/install). +- Install PostgreSQL 15 (https://www.postgresql.org/download/) + +### Building + +``` +git clone https://github.com/lightningdevkit/vss-server.git +cd vss-server/rust + +cargo build --release +``` + +### Running +1. **Edit Configuration**: Modify `./vss_server_config.toml` to set application configuration and + environment variables as needed. Add PostgreSQL endpoint configuration. +2. Create table in PostgreSQL using `./impls/src/postgres/sql/` +3. Start server: + ``` + cargo run -- vss-server-config.toml + ``` +3. VSS endpoint should be reachable at `http://localhost:8080/vss`. + +### Configuration + +Refer `./vss_server_config.toml` to see available configuration options. + +### Support + +If you encounter any issues or have questions, feel free to open an issue on +the [GitHub repository](https://github.com/lightningdevkit/vss-server/issues). For further assistance or to discuss the +development of VSS, you can reach out to us in the [LDK Discord](https://discord.gg/5AcknnMfBw) in the `#vss` channel. + +[LDK Discord]: https://discord.gg/5AcknnMfBw diff --git a/rust/impls/src/postgres/sql/v0_create_vss_db.sql b/rust/impls/src/postgres/sql/v0_create_vss_db.sql new file mode 100644 index 0000000..8d91c25 --- /dev/null +++ b/rust/impls/src/postgres/sql/v0_create_vss_db.sql @@ -0,0 +1,10 @@ +CREATE TABLE vss_db ( + user_token character varying(120) NOT NULL CHECK (user_token <> ''), + store_id character varying(120) NOT NULL CHECK (store_id <> ''), + key character varying(600) NOT NULL, + value bytea NULL, + version bigint NOT NULL, + created_at TIMESTAMP WITH TIME ZONE, + last_updated_at TIMESTAMP WITH TIME ZONE, + PRIMARY KEY (user_token, store_id, key) +);