Skip to content

Commit 99c99e2

Browse files
committed
update open_with_defaults
1 parent b49aedd commit 99c99e2

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ rand = "0.8.5"
3030
tempfile = "3.8"
3131
criterion = "0.5"
3232
futures-util = "0.3"
33-
libmdbx-remote = {version = "0.4", path = "crates/mdbx-remote", default-features = false}
33+
libmdbx-remote = {version = "0.4.1", path = "crates/mdbx-remote", default-features = false}
3434
mdbx = {version = "0.1", path = "crates/mdbx", default-features = false}
35-
mdbx-remote-sys = {version = "0.4", path = "crates/mdbx-remote/mdbx-sys", default-features = false}
35+
mdbx-remote-sys = {version = "0.4.1", path = "crates/mdbx-remote/mdbx-sys", default-features = false}

crates/mdbx-remote/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "libmdbx-remote"
33
description = "Access remote mdbx database seamlessly"
4-
version = "0.4.0"
4+
version = "0.4.1"
55
# rust-version.workspace = true
66
license = "Apache-2.0"
77
edition.workspace = true

crates/mdbx-remote/mdbx-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "mdbx-remote-sys"
33
description = "Raw bindings for libmdbx"
4-
version = "0.4.0"
4+
version = "0.4.1"
55
edition.workspace = true
66
# rust-version.workspace = true
77
license = "Apache-2.0"

crates/mdbx-remote/src/any.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ impl EnvironmentAny {
5757
}
5858

5959
pub async fn open_with_defaults(url: &str, defaults: EnvironmentBuilder) -> Result<Self> {
60+
if url.starts_with("mdbx") || url.starts_with("file") {
61+
Self::open_url_with_defaults(url, defaults).await
62+
} else {
63+
Self::open_local(&PathBuf::from(url), defaults)
64+
}
65+
}
66+
67+
pub async fn open_url_with_defaults(url: &str, defaults: EnvironmentBuilder) -> Result<Self> {
6068
let url = url::Url::parse(url).map_err(|e| ClientError::WrongURL(e))?;
6169
let mut builder = defaults;
6270

0 commit comments

Comments
 (0)