Update revision (#4595)
This commit is contained in:
parent
0b5d79cae0
commit
4c0e9aeef5
11 changed files with 58 additions and 120 deletions
21
Cargo.lock
generated
21
Cargo.lock
generated
|
@ -4902,19 +4902,16 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "revision"
|
||||
version = "0.8.0"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b98b99dba8f2787c9af2e46b17ff38437d213d46c8970b550e6b79b862bf7629"
|
||||
checksum = "4beb55556e5a2e13e796d4a58750c4c802d1766bcfc15035163ecf575a38a77e"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"chrono",
|
||||
"geo 0.26.0",
|
||||
"regex",
|
||||
"revision-derive 0.8.0",
|
||||
"revision-derive 0.9.0",
|
||||
"roaring",
|
||||
"rust_decimal",
|
||||
"serde",
|
||||
"thiserror",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
|
@ -4933,12 +4930,10 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "revision-derive"
|
||||
version = "0.8.0"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3721b4a8e52f9e52c54f74f482a4f550601f5c44cb7876606a2ab79cb09469c1"
|
||||
checksum = "d9336dc6ce3c5ece8d1eb44103d5483c68efbc4b3ac54263316eec2f57f57fec"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.58",
|
||||
|
@ -6042,7 +6037,7 @@ dependencies = [
|
|||
"rand 0.8.5",
|
||||
"rcgen",
|
||||
"reqwest",
|
||||
"revision 0.8.0",
|
||||
"revision 0.9.0",
|
||||
"rmp-serde",
|
||||
"rmpv",
|
||||
"rust_decimal",
|
||||
|
@ -6102,7 +6097,7 @@ dependencies = [
|
|||
"reblessive",
|
||||
"regex",
|
||||
"reqwest",
|
||||
"revision 0.8.0",
|
||||
"revision 0.9.0",
|
||||
"ring 0.17.8",
|
||||
"rust_decimal",
|
||||
"rustls 0.23.12",
|
||||
|
@ -6213,7 +6208,7 @@ dependencies = [
|
|||
"regex",
|
||||
"regex-syntax 0.8.3",
|
||||
"reqwest",
|
||||
"revision 0.8.0",
|
||||
"revision 0.9.0",
|
||||
"ring 0.17.8",
|
||||
"rmpv",
|
||||
"roaring",
|
||||
|
|
|
@ -103,7 +103,7 @@ reqwest = { version = "0.12.5", default-features = false, features = [
|
|||
"gzip",
|
||||
"http2",
|
||||
] }
|
||||
revision = { version = "0.8.0", features = [
|
||||
revision = { version = "0.9.0", features = [
|
||||
"chrono",
|
||||
"geo",
|
||||
"roaring",
|
||||
|
|
|
@ -121,7 +121,7 @@ reqwest = { version = "0.12.5", default-features = false, features = [
|
|||
"stream",
|
||||
"multipart",
|
||||
], optional = true }
|
||||
revision = { version = "0.8.0", features = [
|
||||
revision = { version = "0.9.0", features = [
|
||||
"chrono",
|
||||
"geo",
|
||||
"roaring",
|
||||
|
|
|
@ -62,16 +62,16 @@ impl Node {
|
|||
}
|
||||
}
|
||||
// Sets the default gc value for old nodes
|
||||
fn default_id(_revision: u16) -> Uuid {
|
||||
Uuid::default()
|
||||
fn default_id(_revision: u16) -> Result<Uuid, Error> {
|
||||
Ok(Uuid::default())
|
||||
}
|
||||
// Sets the default gc value for old nodes
|
||||
fn default_hb(_revision: u16) -> Timestamp {
|
||||
Timestamp::default()
|
||||
fn default_hb(_revision: u16) -> Result<Timestamp, Error> {
|
||||
Ok(Timestamp::default())
|
||||
}
|
||||
// Sets the default gc value for old nodes
|
||||
fn default_gc(_revision: u16) -> bool {
|
||||
true
|
||||
fn default_gc(_revision: u16) -> Result<bool, Error> {
|
||||
Ok(true)
|
||||
}
|
||||
// Sets the default gc value for old nodes
|
||||
fn convert_name(&mut self, _revision: u16, value: String) -> Result<(), Error> {
|
||||
|
|
|
@ -304,8 +304,6 @@ pub struct RecordAccess {
|
|||
pub signup: Option<Value>,
|
||||
pub signin: Option<Value>,
|
||||
pub jwt: JwtAccess,
|
||||
// TODO(gguillemas): Field kept to gracefully handle breaking change.
|
||||
// Remove when "revision" crate allows doing so.
|
||||
#[revision(start = 2, end = 3, convert_fn = "authenticate_revision")]
|
||||
pub authenticate: Option<Value>,
|
||||
}
|
||||
|
@ -330,9 +328,6 @@ impl Default for RecordAccess {
|
|||
jwt: JwtAccess {
|
||||
..Default::default()
|
||||
},
|
||||
// TODO(gguillemas): Field kept to gracefully handle breaking change.
|
||||
// Remove when "revision" crate allows doing so.
|
||||
authenticate: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ pub struct Fetch(
|
|||
|
||||
impl Fetch {
|
||||
fn convert_fetch_idiom(&mut self, _revision: u16, old: Idiom) -> Result<(), revision::Error> {
|
||||
self.1 = if old.is_empty() {
|
||||
self.0 = if old.is_empty() {
|
||||
Value::None
|
||||
} else {
|
||||
Value::Idiom(old)
|
||||
|
@ -77,7 +77,7 @@ impl Fetch {
|
|||
value: v,
|
||||
}),
|
||||
};
|
||||
match &self.1 {
|
||||
match &self.0 {
|
||||
Value::Idiom(idiom) => {
|
||||
idioms.push(idiom.to_owned());
|
||||
Ok(())
|
||||
|
@ -135,20 +135,20 @@ impl Fetch {
|
|||
|
||||
impl From<Value> for Fetch {
|
||||
fn from(value: Value) -> Self {
|
||||
Self(Idiom(vec![]), value)
|
||||
Self(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for Fetch {
|
||||
type Target = Value;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.1
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Fetch {
|
||||
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
||||
Display::fmt(&self.1, f)
|
||||
Display::fmt(&self.0, f)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,6 @@ impl MTreeParams {
|
|||
) -> Self {
|
||||
Self {
|
||||
dimension,
|
||||
_distance: Default::default(),
|
||||
distance,
|
||||
vector_type,
|
||||
capacity,
|
||||
|
|
|
@ -11,60 +11,33 @@ use serde::{Deserialize, Serialize};
|
|||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[revisioned(revision = 3)]
|
||||
#[revisioned(revision = 4)]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Store, Hash)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
#[non_exhaustive]
|
||||
pub enum InfoStatement {
|
||||
#[revision(end = 2, convert_fn = "root_migrate")]
|
||||
Root,
|
||||
#[revision(start = 2)]
|
||||
Root(bool),
|
||||
#[revision(end = 2, convert_fn = "ns_migrate")]
|
||||
Ns,
|
||||
#[revision(start = 2)]
|
||||
Ns(bool),
|
||||
#[revision(end = 2, convert_fn = "db_migrate")]
|
||||
Db,
|
||||
#[revision(start = 2)]
|
||||
Db(bool),
|
||||
#[revision(end = 2, convert_fn = "tb_migrate")]
|
||||
Tb(Ident),
|
||||
#[revision(start = 2)]
|
||||
Tb(Ident, bool),
|
||||
#[revision(end = 2, convert_fn = "user_migrate")]
|
||||
User(Ident, Option<Base>),
|
||||
#[revision(start = 2)]
|
||||
User(Ident, Option<Base>, bool),
|
||||
// revision discriminant override accounting for previous behavior when adding variants and
|
||||
// removing not at the end of the enum definition.
|
||||
#[revision(override(revision = 2, discriminant = 1), override(revision = 3, discriminant = 1))]
|
||||
Root(#[revision(start = 2)] bool),
|
||||
|
||||
#[revision(override(revision = 2, discriminant = 3), override(revision = 3, discriminant = 3))]
|
||||
Ns(#[revision(start = 2)] bool),
|
||||
|
||||
#[revision(override(revision = 2, discriminant = 5), override(revision = 3, discriminant = 5))]
|
||||
Db(#[revision(start = 2)] bool),
|
||||
|
||||
#[revision(override(revision = 2, discriminant = 7), override(revision = 3, discriminant = 7))]
|
||||
Tb(Ident, #[revision(start = 2)] bool),
|
||||
|
||||
#[revision(override(revision = 2, discriminant = 9), override(revision = 3, discriminant = 9))]
|
||||
User(Ident, Option<Base>, #[revision(start = 2)] bool),
|
||||
|
||||
#[revision(start = 3)]
|
||||
#[revision(override(revision = 3, discriminant = 10))]
|
||||
Index(Ident, Ident, bool),
|
||||
}
|
||||
|
||||
impl InfoStatement {
|
||||
fn root_migrate(_revision: u16, _: ()) -> Result<Self, revision::Error> {
|
||||
Ok(Self::Root(false))
|
||||
}
|
||||
|
||||
fn ns_migrate(_revision: u16, _: ()) -> Result<Self, revision::Error> {
|
||||
Ok(Self::Ns(false))
|
||||
}
|
||||
|
||||
fn db_migrate(_revision: u16, _: ()) -> Result<Self, revision::Error> {
|
||||
Ok(Self::Db(false))
|
||||
}
|
||||
|
||||
fn tb_migrate(_revision: u16, n: (Ident,)) -> Result<Self, revision::Error> {
|
||||
Ok(Self::Tb(n.0, false))
|
||||
}
|
||||
|
||||
fn user_migrate(
|
||||
_revision: u16,
|
||||
(i, b): (Ident, Option<Base>),
|
||||
) -> Result<Self, revision::Error> {
|
||||
Ok(Self::User(i, b, false))
|
||||
}
|
||||
}
|
||||
|
||||
impl InfoStatement {
|
||||
/// Process this type returning a computed simple Value
|
||||
pub(crate) async fn compute(
|
||||
|
|
|
@ -1169,9 +1169,6 @@ fn parse_define_access_record() {
|
|||
key: "foo".to_string(),
|
||||
}),
|
||||
},
|
||||
// TODO(gguillemas): Field kept to gracefully handle breaking change.
|
||||
// Remove when "revision" crate allows doing so.
|
||||
authenticate: None
|
||||
}),
|
||||
authenticate: None,
|
||||
duration: AccessDuration {
|
||||
|
@ -1210,9 +1207,6 @@ fn parse_define_access_record() {
|
|||
key: "bar".to_string(),
|
||||
}),
|
||||
},
|
||||
// TODO(gguillemas): Field kept to gracefully handle breaking change.
|
||||
// Remove when "revision" crate allows doing so.
|
||||
authenticate: None
|
||||
}),
|
||||
authenticate: None,
|
||||
duration: AccessDuration {
|
||||
|
@ -1251,9 +1245,6 @@ fn parse_define_access_record() {
|
|||
key: "bar".to_string(),
|
||||
}),
|
||||
},
|
||||
// TODO(gguillemas): Field kept to gracefully handle breaking change.
|
||||
// Remove when "revision" crate allows doing so.
|
||||
authenticate: None
|
||||
}),
|
||||
authenticate: None,
|
||||
duration: AccessDuration {
|
||||
|
@ -1323,9 +1314,6 @@ fn parse_define_access_record_with_jwt() {
|
|||
}),
|
||||
issue: None,
|
||||
},
|
||||
// TODO(gguillemas): Field kept to gracefully handle breaking change.
|
||||
// Remove when "revision" crate allows doing so.
|
||||
authenticate: None
|
||||
}),
|
||||
authenticate: None,
|
||||
// Default durations.
|
||||
|
@ -1552,7 +1540,6 @@ fn parse_define_index() {
|
|||
cols: Idioms(vec![Idiom(vec![Part::Field(Ident("a".to_owned()))]),]),
|
||||
index: Index::MTree(MTreeParams {
|
||||
dimension: 4,
|
||||
_distance: Default::default(),
|
||||
distance: Distance::Minkowski(Number::Int(5)),
|
||||
capacity: 6,
|
||||
doc_ids_order: 7,
|
||||
|
@ -1873,10 +1860,9 @@ SELECT bar as foo,[1,2],bar OMIT bar FROM ONLY a,1
|
|||
start: Some(Start(Value::Object(Object(
|
||||
[("a".to_owned(), Value::Bool(true))].into_iter().collect()
|
||||
)))),
|
||||
fetch: Some(Fetchs(vec![Fetch(
|
||||
Idiom(vec![]),
|
||||
Value::Idiom(Idiom(vec![Part::Field(Ident("foo".to_owned()))]))
|
||||
)])),
|
||||
fetch: Some(Fetchs(vec![Fetch(Value::Idiom(Idiom(vec![Part::Field(Ident(
|
||||
"foo".to_owned()
|
||||
))])))])),
|
||||
version: Some(Version(Datetime(expected_datetime))),
|
||||
timeout: None,
|
||||
parallel: false,
|
||||
|
@ -2141,14 +2127,11 @@ fn parse_live() {
|
|||
assert_eq!(
|
||||
stmt.fetch,
|
||||
Some(Fetchs(vec![
|
||||
Fetch(
|
||||
Idiom(vec![]),
|
||||
Value::Idiom(Idiom(vec![
|
||||
Part::Field(Ident("a".to_owned())),
|
||||
Part::Where(Value::Idiom(Idiom(vec![Part::Field(Ident("foo".to_owned()))]))),
|
||||
]))
|
||||
),
|
||||
Fetch(Idiom(vec![]), Value::Idiom(Idiom(vec![Part::Field(Ident("b".to_owned()))]))),
|
||||
Fetch(Value::Idiom(Idiom(vec![
|
||||
Part::Field(Ident("a".to_owned())),
|
||||
Part::Where(Value::Idiom(Idiom(vec![Part::Field(Ident("foo".to_owned()))]))),
|
||||
]))),
|
||||
Fetch(Value::Idiom(Idiom(vec![Part::Field(Ident("b".to_owned()))]))),
|
||||
])),
|
||||
)
|
||||
}
|
||||
|
@ -2172,10 +2155,9 @@ fn parse_return() {
|
|||
res,
|
||||
Statement::Output(OutputStatement {
|
||||
what: Value::Idiom(Idiom(vec![Part::Field(Ident("RETRUN".to_owned()))])),
|
||||
fetch: Some(Fetchs(vec![Fetch(
|
||||
Idiom(vec![]),
|
||||
Value::Idiom(Idiom(vec![Part::Field(Ident("RETURN".to_owned()).to_owned())]))
|
||||
)])),
|
||||
fetch: Some(Fetchs(vec![Fetch(Value::Idiom(Idiom(vec![Part::Field(
|
||||
Ident("RETURN".to_owned()).to_owned()
|
||||
)])))])),
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -214,9 +214,6 @@ fn statements() -> Vec<Statement> {
|
|||
}),
|
||||
issue: None,
|
||||
},
|
||||
// TODO(gguillemas): Field kept to gracefully handle breaking change.
|
||||
// Remove when "revision" crate allows doing so.
|
||||
authenticate: None,
|
||||
}),
|
||||
authenticate: None,
|
||||
// Default durations.
|
||||
|
@ -363,7 +360,6 @@ fn statements() -> Vec<Statement> {
|
|||
index: Index::MTree(MTreeParams {
|
||||
dimension: 4,
|
||||
distance: Distance::Minkowski(Number::Int(5)),
|
||||
_distance: Default::default(),
|
||||
capacity: 6,
|
||||
doc_ids_order: 7,
|
||||
doc_ids_cache: 8,
|
||||
|
@ -525,10 +521,9 @@ fn statements() -> Vec<Statement> {
|
|||
start: Some(Start(Value::Object(Object(
|
||||
[("a".to_owned(), Value::Bool(true))].into_iter().collect(),
|
||||
)))),
|
||||
fetch: Some(Fetchs(vec![Fetch(
|
||||
Idiom(vec![]),
|
||||
Value::Idiom(Idiom(vec![Part::Field(Ident("foo".to_owned()))])),
|
||||
)])),
|
||||
fetch: Some(Fetchs(vec![Fetch(Value::Idiom(Idiom(vec![Part::Field(Ident(
|
||||
"foo".to_owned(),
|
||||
))])))])),
|
||||
version: Some(Version(Datetime(expected_datetime))),
|
||||
timeout: None,
|
||||
parallel: false,
|
||||
|
@ -618,10 +613,9 @@ fn statements() -> Vec<Statement> {
|
|||
}),
|
||||
Statement::Output(OutputStatement {
|
||||
what: Value::Idiom(Idiom(vec![Part::Field(Ident("RETRUN".to_owned()))])),
|
||||
fetch: Some(Fetchs(vec![Fetch(
|
||||
Idiom(vec![]),
|
||||
Value::Idiom(Idiom(vec![Part::Field(Ident("RETURN".to_owned()).to_owned())])),
|
||||
)])),
|
||||
fetch: Some(Fetchs(vec![Fetch(Value::Idiom(Idiom(vec![Part::Field(
|
||||
Ident("RETURN".to_owned()).to_owned(),
|
||||
)])))])),
|
||||
}),
|
||||
Statement::Relate(RelateStatement {
|
||||
only: true,
|
||||
|
|
|
@ -81,7 +81,7 @@ indexmap = { version = "2.1.0", features = ["serde"] }
|
|||
native-tls = { version = "0.2.11", optional = true }
|
||||
once_cell = "1.18.0"
|
||||
path-clean = "1.0.1"
|
||||
revision = { version = "0.8.0", features = [
|
||||
revision = { version = "0.9.0", features = [
|
||||
"chrono",
|
||||
"geo",
|
||||
"roaring",
|
||||
|
|
Loading…
Reference in a new issue