Skip to content

Commit b6e1ae7

Browse files
committed
Add empty postgres KvStore implementation.
1 parent 3e527d6 commit b6e1ae7

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

rust/impls/Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "impls"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
async-trait = "0.1.77"
8+
api = { path = "../api" }

rust/impls/src/lib.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//! Hosts VSS protocol compliant [`KvStore`] implementations for various backends.
2+
//!
3+
//! VSS is an open-source project designed to offer a server-side cloud storage solution specifically
4+
//! tailored for noncustodial Lightning supporting mobile wallets. Its primary objective is to
5+
//! simplify the development process for Lightning wallets by providing a secure means to store
6+
//! and manage the essential state required for Lightning Network (LN) operations.
7+
//!
8+
//! [`KvStore`]: api::kv_store::KvStore
9+
10+
#![deny(rustdoc::broken_intra_doc_links)]
11+
#![deny(rustdoc::private_intra_doc_links)]
12+
#![deny(missing_docs)]
13+
14+
/// Contains [PostgreSQL](https://www.postgresql.org/) based backend implementation for VSS.
15+
pub mod postgres_store;

rust/impls/src/postgres_store.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
use api::error::VssError;
2+
use api::kv_store::KvStore;
3+
use api::types::{
4+
DeleteObjectRequest, DeleteObjectResponse, GetObjectRequest, GetObjectResponse,
5+
ListKeyVersionsRequest, ListKeyVersionsResponse, PutObjectRequest, PutObjectResponse,
6+
};
7+
use async_trait::async_trait;
8+
use std::io::Error;
9+
10+
/// A [PostgreSQL](https://www.postgresql.org/) based backend implementation for VSS.
11+
pub struct PostgresBackendImpl {}
12+
13+
impl PostgresBackendImpl {
14+
/// Constructs a [`PostgresBackendImpl`] using `dsn` for PostgreSQL connection information.
15+
pub async fn new(dsn: &str) -> Result<Self, Error> {
16+
todo!("pending implementation.");
17+
}
18+
}
19+
20+
#[async_trait]
21+
impl KvStore for PostgresBackendImpl {
22+
async fn get(
23+
&self, user_token: String, request: GetObjectRequest,
24+
) -> Result<GetObjectResponse, VssError> {
25+
todo!("pending implementation.");
26+
}
27+
28+
async fn put(
29+
&self, user_token: String, request: PutObjectRequest,
30+
) -> Result<PutObjectResponse, VssError> {
31+
todo!("pending implementation.");
32+
}
33+
34+
async fn delete(
35+
&self, user_token: String, request: DeleteObjectRequest,
36+
) -> Result<DeleteObjectResponse, VssError> {
37+
todo!("pending implementation.");
38+
}
39+
40+
async fn list_key_versions(
41+
&self, user_token: String, request: ListKeyVersionsRequest,
42+
) -> Result<ListKeyVersionsResponse, VssError> {
43+
todo!("pending implementation.");
44+
}
45+
}

0 commit comments

Comments
 (0)