deprecate file://
(#4505)
This commit is contained in:
parent
0a4801dcf8
commit
e18cd17ca6
9 changed files with 13 additions and 6 deletions
|
@ -224,7 +224,7 @@ impl Datastore {
|
||||||
/// # use surrealdb_core::err::Error;
|
/// # use surrealdb_core::err::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Error> {
|
/// # async fn main() -> Result<(), Error> {
|
||||||
/// let ds = Datastore::new("file://temp.db").await?;
|
/// let ds = Datastore::new("surrealkv://temp.skv").await?;
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -298,6 +298,7 @@ impl Datastore {
|
||||||
#[cfg(feature = "kv-rocksdb")]
|
#[cfg(feature = "kv-rocksdb")]
|
||||||
{
|
{
|
||||||
info!(target: TARGET, "Starting kvs store at {}", path);
|
info!(target: TARGET, "Starting kvs store at {}", path);
|
||||||
|
warn!("file:// is deprecated, please use surrealkv:// or rocksdb://");
|
||||||
let s = s.trim_start_matches("file://");
|
let s = s.trim_start_matches("file://");
|
||||||
let s = s.trim_start_matches("file:");
|
let s = s.trim_start_matches("file:");
|
||||||
let v = super::rocksdb::Datastore::new(s).await.map(DatastoreFlavor::RocksDB);
|
let v = super::rocksdb::Datastore::new(s).await.map(DatastoreFlavor::RocksDB);
|
||||||
|
|
|
@ -169,6 +169,7 @@ pub struct Mem;
|
||||||
#[cfg(feature = "kv-rocksdb")]
|
#[cfg(feature = "kv-rocksdb")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "kv-rocksdb")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "kv-rocksdb")))]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[deprecated]
|
||||||
pub struct File;
|
pub struct File;
|
||||||
|
|
||||||
/// RocksDB database
|
/// RocksDB database
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use crate::api::engine::local::Db;
|
use crate::api::engine::local::Db;
|
||||||
|
#[allow(deprecated)]
|
||||||
use crate::api::engine::local::File;
|
use crate::api::engine::local::File;
|
||||||
use crate::api::engine::local::RocksDb;
|
use crate::api::engine::local::RocksDb;
|
||||||
use crate::api::opt::Config;
|
use crate::api::opt::Config;
|
||||||
|
@ -35,6 +36,7 @@ macro_rules! endpoints {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(deprecated)]
|
||||||
impl IntoEndpoint<File> for $name {
|
impl IntoEndpoint<File> for $name {
|
||||||
type Client = Db;
|
type Client = Db;
|
||||||
|
|
||||||
|
@ -48,6 +50,7 @@ macro_rules! endpoints {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(deprecated)]
|
||||||
impl IntoEndpoint<File> for ($name, Config) {
|
impl IntoEndpoint<File> for ($name, Config) {
|
||||||
type Client = Db;
|
type Client = Db;
|
||||||
|
|
||||||
|
|
|
@ -275,6 +275,7 @@ mod api_integration {
|
||||||
mod file {
|
mod file {
|
||||||
use super::*;
|
use super::*;
|
||||||
use surrealdb::engine::local::Db;
|
use surrealdb::engine::local::Db;
|
||||||
|
#[allow(deprecated)]
|
||||||
use surrealdb::engine::local::File;
|
use surrealdb::engine::local::File;
|
||||||
|
|
||||||
async fn new_db() -> (SemaphorePermit<'static>, Surreal<Db>) {
|
async fn new_db() -> (SemaphorePermit<'static>, Surreal<Db>) {
|
||||||
|
@ -288,6 +289,7 @@ mod api_integration {
|
||||||
.user(root)
|
.user(root)
|
||||||
.tick_interval(TICK_INTERVAL)
|
.tick_interval(TICK_INTERVAL)
|
||||||
.capabilities(Capabilities::all());
|
.capabilities(Capabilities::all());
|
||||||
|
#[allow(deprecated)]
|
||||||
let db = Surreal::new::<File>((path, config)).await.unwrap();
|
let db = Surreal::new::<File>((path, config)).await.unwrap();
|
||||||
db.signin(root).await.unwrap();
|
db.signin(root).await.unwrap();
|
||||||
(permit, db)
|
(permit, db)
|
||||||
|
|
|
@ -45,7 +45,7 @@ pub async fn init(
|
||||||
crate::telemetry::builder().with_log_level("error").init();
|
crate::telemetry::builder().with_log_level("error").init();
|
||||||
|
|
||||||
// If username and password are specified, and we are connecting to a remote SurrealDB server, then we need to authenticate.
|
// If username and password are specified, and we are connecting to a remote SurrealDB server, then we need to authenticate.
|
||||||
// If we are connecting directly to a datastore (i.e. file://local.db or tikv://...), then we don't need to authenticate because we use an embedded (local) SurrealDB instance with auth disabled.
|
// If we are connecting directly to a datastore (i.e. surrealkv://local.skv or tikv://...), then we don't need to authenticate because we use an embedded (local) SurrealDB instance with auth disabled.
|
||||||
let client = if username.is_some()
|
let client = if username.is_some()
|
||||||
&& password.is_some()
|
&& password.is_some()
|
||||||
&& !endpoint.clone().into_endpoint()?.parse_kind()?.is_local()
|
&& !endpoint.clone().into_endpoint()?.parse_kind()?.is_local()
|
||||||
|
|
|
@ -44,7 +44,7 @@ pub async fn init(
|
||||||
let config = Config::new().capabilities(Capabilities::all());
|
let config = Config::new().capabilities(Capabilities::all());
|
||||||
|
|
||||||
// If username and password are specified, and we are connecting to a remote SurrealDB server, then we need to authenticate.
|
// If username and password are specified, and we are connecting to a remote SurrealDB server, then we need to authenticate.
|
||||||
// If we are connecting directly to a datastore (i.e. file://local.db or tikv://...), then we don't need to authenticate because we use an embedded (local) SurrealDB instance with auth disabled.
|
// If we are connecting directly to a datastore (i.e. surrealkv://local.skv or tikv://...), then we don't need to authenticate because we use an embedded (local) SurrealDB instance with auth disabled.
|
||||||
let client = if username.is_some()
|
let client = if username.is_some()
|
||||||
&& password.is_some()
|
&& password.is_some()
|
||||||
&& !endpoint.clone().into_endpoint()?.parse_kind()?.is_local()
|
&& !endpoint.clone().into_endpoint()?.parse_kind()?.is_local()
|
||||||
|
|
|
@ -61,7 +61,7 @@ pub async fn init(
|
||||||
crate::telemetry::builder().with_log_level("error").init();
|
crate::telemetry::builder().with_log_level("error").init();
|
||||||
|
|
||||||
// If username and password are specified, and we are connecting to a remote SurrealDB server, then we need to authenticate.
|
// If username and password are specified, and we are connecting to a remote SurrealDB server, then we need to authenticate.
|
||||||
// If we are connecting directly to a datastore (i.e. file://local.db or tikv://...), then we don't need to authenticate because we use an embedded (local) SurrealDB instance with auth disabled.
|
// If we are connecting directly to a datastore (i.e. surrealkv://local.skv or tikv://...), then we don't need to authenticate because we use an embedded (local) SurrealDB instance with auth disabled.
|
||||||
let client = if username.is_some()
|
let client = if username.is_some()
|
||||||
&& password.is_some()
|
&& password.is_some()
|
||||||
&& !endpoint.clone().into_endpoint()?.parse_kind()?.is_local()
|
&& !endpoint.clone().into_endpoint()?.parse_kind()?.is_local()
|
||||||
|
|
|
@ -44,7 +44,7 @@ pub async fn init(
|
||||||
let config = Config::new().capabilities(Capabilities::all());
|
let config = Config::new().capabilities(Capabilities::all());
|
||||||
|
|
||||||
// If username and password are specified, and we are connecting to a remote SurrealDB server, then we need to authenticate.
|
// If username and password are specified, and we are connecting to a remote SurrealDB server, then we need to authenticate.
|
||||||
// If we are connecting directly to a datastore (i.e. file://local.db or tikv://...), then we don't need to authenticate because we use an embedded (local) SurrealDB instance with auth disabled.
|
// If we are connecting directly to a datastore (i.e. surrealkv://local.skv or tikv://...), then we don't need to authenticate because we use an embedded (local) SurrealDB instance with auth disabled.
|
||||||
let client = if username.is_some()
|
let client = if username.is_some()
|
||||||
&& password.is_some()
|
&& password.is_some()
|
||||||
&& !endpoint.clone().into_endpoint()?.parse_kind()?.is_local()
|
&& !endpoint.clone().into_endpoint()?.parse_kind()?.is_local()
|
||||||
|
|
|
@ -67,7 +67,7 @@ pub async fn init(
|
||||||
let config = Config::new().capabilities(Capabilities::all());
|
let config = Config::new().capabilities(Capabilities::all());
|
||||||
|
|
||||||
// If username and password are specified, and we are connecting to a remote SurrealDB server, then we need to authenticate.
|
// If username and password are specified, and we are connecting to a remote SurrealDB server, then we need to authenticate.
|
||||||
// If we are connecting directly to a datastore (i.e. file://local.db or tikv://...), then we don't need to authenticate because we use an embedded (local) SurrealDB instance with auth disabled.
|
// If we are connecting directly to a datastore (i.e. surrealkv://local.skv or tikv://...), then we don't need to authenticate because we use an embedded (local) SurrealDB instance with auth disabled.
|
||||||
let client = if username.is_some()
|
let client = if username.is_some()
|
||||||
&& password.is_some()
|
&& password.is_some()
|
||||||
&& !endpoint.clone().into_endpoint()?.parse_kind()?.is_local()
|
&& !endpoint.clone().into_endpoint()?.parse_kind()?.is_local()
|
||||||
|
|
Loading…
Reference in a new issue