Skip to content
This repository has been archived by the owner on Sep 21, 2024. It is now read-only.

feat: prototype implementation of SqliteStorage #549

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/run_test_suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
- name: 'Run Rust native target tests'
run: NOOSPHERE_LOG=deafening cargo test --features test-kubo,headers

run-test-suite-linux-rocksdb:
run-test-suite-linux-sqlite:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporary

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -115,8 +115,8 @@ jobs:
with:
ipfs_version: v0.17.0
run_daemon: true
- name: 'Run Rust native target tests (RocksDB)'
run: NOOSPHERE_LOG=defeaning cargo test -p noosphere -p noosphere-storage --features rocksdb,test-kubo
- name: 'Run Rust native target tests (Sqlite)'
run: NOOSPHERE_LOG=defeaning cargo test -p noosphere -p noosphere-storage --features sqlite,test-kubo

run-test-suite-linux-c:
runs-on: ubuntu-latest
Expand Down
90 changes: 90 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions rust/noosphere-storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ libipld-cbor = { workspace = true }
serde = { workspace = true }
base64 = "=0.21.4"
url = { version = "^2" }
r2d2 = { version = "0.8.10", optional = true }
r2d2_sqlite = { version = "0.22.0", optional = true, features = ["bundled"] }

[dev-dependencies]
witty-phrase-generator = "~0.2"
Expand Down Expand Up @@ -69,6 +71,7 @@ features = [
default = []
rocksdb = ["dep:rocksdb"]
rocksdb-multi-thread = ["dep:rocksdb"]
sqlite = ["dep:r2d2", "dep:r2d2_sqlite"]

[[example]]
name = "bench"
14 changes: 9 additions & 5 deletions rust/noosphere-storage/examples/bench/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,7 @@ async fn create_sphere_with_large_files<S: Storage + 'static>(db: SphereDb<S>) -
type ActiveStoragePrimitive = noosphere_storage::SledStorage;
#[cfg(all(not(target_arch = "wasm32"), feature = "rocksdb"))]
type ActiveStoragePrimitive = noosphere_storage::RocksDbStorage;
#[cfg(all(
not(target_arch = "wasm32"),
feature = "sqlite",
not(feature = "rocksdb")
))]
#[cfg(all(not(target_arch = "wasm32"), feature = "sqlite"))]
type ActiveStoragePrimitive = noosphere_storage::SqliteStorage;
#[cfg(target_arch = "wasm32")]
type ActiveStoragePrimitive = noosphere_storage::IndexedDbStorage;
Expand Down Expand Up @@ -145,6 +141,14 @@ impl BenchmarkStorage {
)
};

#[cfg(all(not(target_arch = "wasm32"), feature = "sqlite"))]
let (storage, storage_name) = {
(
noosphere_storage::SqliteStorage::new(&storage_path)?,
"SqliteStorage",
)
};

#[cfg(target_arch = "wasm32")]
let (storage, storage_name) = {
let temp_name: String = witty_phrase_generator::WPGen::new()
Expand Down
5 changes: 5 additions & 0 deletions rust/noosphere-storage/src/implementation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ pub use rocks_db::*;
mod indexed_db;
#[cfg(target_arch = "wasm32")]
pub use indexed_db::*;

#[cfg(all(not(target_arch = "wasm32"), feature = "sqlite"))]
mod sqlite;
#[cfg(all(not(target_arch = "wasm32"), feature = "sqlite"))]
pub use sqlite::*;
Loading
Loading