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;
|
||||
/// # #[tokio::main]
|
||||
/// # async fn main() -> Result<(), Error> {
|
||||
/// let ds = Datastore::new("file://temp.db").await?;
|
||||
/// let ds = Datastore::new("surrealkv://temp.skv").await?;
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
|
@ -298,6 +298,7 @@ impl Datastore {
|
|||
#[cfg(feature = "kv-rocksdb")]
|
||||
{
|
||||
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 v = super::rocksdb::Datastore::new(s).await.map(DatastoreFlavor::RocksDB);
|
||||
|
|
|
@ -169,6 +169,7 @@ pub struct Mem;
|
|||
#[cfg(feature = "kv-rocksdb")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "kv-rocksdb")))]
|
||||
#[derive(Debug)]
|
||||
#[deprecated]
|
||||
pub struct File;
|
||||
|
||||
/// RocksDB database
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::api::engine::local::Db;
|
||||
#[allow(deprecated)]
|
||||
use crate::api::engine::local::File;
|
||||
use crate::api::engine::local::RocksDb;
|
||||
use crate::api::opt::Config;
|
||||
|
@ -35,6 +36,7 @@ macro_rules! endpoints {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
impl IntoEndpoint<File> for $name {
|
||||
type Client = Db;
|
||||
|
||||
|
@ -48,6 +50,7 @@ macro_rules! endpoints {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
impl IntoEndpoint<File> for ($name, Config) {
|
||||
type Client = Db;
|
||||
|
||||
|
|
|
@ -275,6 +275,7 @@ mod api_integration {
|
|||
mod file {
|
||||
use super::*;
|
||||
use surrealdb::engine::local::Db;
|
||||
#[allow(deprecated)]
|
||||
use surrealdb::engine::local::File;
|
||||
|
||||
async fn new_db() -> (SemaphorePermit<'static>, Surreal<Db>) {
|
||||
|
@ -288,6 +289,7 @@ mod api_integration {
|
|||
.user(root)
|
||||
.tick_interval(TICK_INTERVAL)
|
||||
.capabilities(Capabilities::all());
|
||||
#[allow(deprecated)]
|
||||
let db = Surreal::new::<File>((path, config)).await.unwrap();
|
||||
db.signin(root).await.unwrap();
|
||||
(permit, db)
|
||||
|
|
|
@ -45,7 +45,7 @@ pub async fn 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 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()
|
||||
&& password.is_some()
|
||||
&& !endpoint.clone().into_endpoint()?.parse_kind()?.is_local()
|
||||
|
|
|
@ -44,7 +44,7 @@ pub async fn init(
|
|||
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 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()
|
||||
&& password.is_some()
|
||||
&& !endpoint.clone().into_endpoint()?.parse_kind()?.is_local()
|
||||
|
|
|
@ -61,7 +61,7 @@ pub async fn 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 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()
|
||||
&& password.is_some()
|
||||
&& !endpoint.clone().into_endpoint()?.parse_kind()?.is_local()
|
||||
|
|
|
@ -44,7 +44,7 @@ pub async fn init(
|
|||
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 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()
|
||||
&& password.is_some()
|
||||
&& !endpoint.clone().into_endpoint()?.parse_kind()?.is_local()
|
||||
|
|
|
@ -67,7 +67,7 @@ pub async fn init(
|
|||
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 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()
|
||||
&& password.is_some()
|
||||
&& !endpoint.clone().into_endpoint()?.parse_kind()?.is_local()
|
||||
|
|
Loading…
Reference in a new issue