Skip to content

Commit

Permalink
fix: Remove unneded idb dependency (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
fl0rek authored Aug 22, 2024
1 parent dca5226 commit 58994e6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ tokio = { version = "1.29.0", features = ["macros", "rt"], optional = true }
[target.'cfg(target_arch = "wasm32")'.dependencies]
js-sys = { version = "0.3.68", optional = true }
rexie = { version = "0.6.1", optional = true }
idb = { version = "0.6.2", optional = true }
wasm-bindgen = { version = "0.2.91", optional = true }

[dev-dependencies]
Expand All @@ -47,7 +46,7 @@ multihash-codetable = { version = "0.1.1", features = ["digest", "sha2"] }
wasm-bindgen-test = "0.3.41"

[features]
indexeddb = ["dep:js-sys", "dep:rexie", "dep:wasm-bindgen", "dep:idb"]
indexeddb = ["dep:js-sys", "dep:rexie", "dep:wasm-bindgen"]
lru = ["dep:lru"]
redb = ["dep:redb", "dep:tokio"]
sled = ["dep:sled", "dep:tokio"]
Expand Down
8 changes: 1 addition & 7 deletions src/indexed_db_blockstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,8 @@ impl From<rexie::Error> for Error {
}
}

impl From<idb::Error> for Error {
fn from(value: idb::Error) -> Self {
Error::FatalDatabaseError(value.to_string())
}
}

async fn has_key(store: &Store, key: &JsValue) -> Result<bool> {
let key_range = KeyRange::only(key)?;
let key_range = KeyRange::only(key).map_err(rexie::Error::IdbError)?;
let count = store.count(Some(key_range)).await?;
Ok(count > 0)
}
Expand Down

0 comments on commit 58994e6

Please sign in to comment.