-
Notifications
You must be signed in to change notification settings - Fork 1k
Subgraph composition spec version #5782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,6 +150,14 @@ impl EntityType { | |
pub fn is_object_type(&self) -> bool { | ||
self.schema.is_object_type(self.atom) | ||
} | ||
|
||
// Changes the way the VID field is generated. It used to be autoincrement. Now its | ||
// based on block number and the order of the entities in a block. The latter | ||
// represents the write order across all entity types in the subgraph. | ||
pub fn strict_vid_order(&self) -> bool { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's the method that I would rename to /// Whether the table for this entity type uses a sequence for the `vid` or whether
/// `graph-node` sets them explicitly. See also [`InputSchema.strict_vid_order()`]
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed this and next remark in a separate PR as this one is already merged. |
||
// Currently the agregations entities don't have VIDs in insertion order | ||
self.schema.strict_vid_order() && self.is_object_type() | ||
} | ||
} | ||
|
||
impl fmt::Display for EntityType { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ use crate::data::graphql::{DirectiveExt, DocumentExt, ObjectTypeExt, TypeExt, Va | |
use crate::data::store::{ | ||
self, EntityValidationError, IdType, IntoEntityIterator, TryIntoEntityIterator, ValueType, ID, | ||
}; | ||
use crate::data::subgraph::SPEC_VERSION_1_3_0; | ||
use crate::data::value::Word; | ||
use crate::derive::CheapClone; | ||
use crate::prelude::q::Value; | ||
|
@@ -955,6 +956,7 @@ pub struct Inner { | |
pool: Arc<AtomPool>, | ||
/// A list of all timeseries types by interval | ||
agg_mappings: Box<[AggregationMapping]>, | ||
spec_version: Version, | ||
} | ||
|
||
impl InputSchema { | ||
|
@@ -1042,6 +1044,7 @@ impl InputSchema { | |
enum_map, | ||
pool, | ||
agg_mappings, | ||
spec_version: spec_version.clone(), | ||
}), | ||
}) | ||
} | ||
|
@@ -1585,6 +1588,10 @@ impl InputSchema { | |
}?; | ||
Some(EntityType::new(self.cheap_clone(), obj_type.name)) | ||
} | ||
|
||
pub fn strict_vid_order(&self) -> bool { | ||
self.inner.spec_version >= SPEC_VERSION_1_3_0 | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might be a good comment for this method: /// How the values for the VID field are generated.
/// When this is `false`, this subgraph uses the old way of autoincrementing `vid` in the database.
/// When it is `true`, `graph-node` sets the `vid` explicitly to a number based on block number
/// and the order in which entities are written, and comparing by `vid` will order entities by that order
|
||
} | ||
|
||
/// Create a new pool that contains the names of all the types defined | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by 'not correct'? It seems correct to me, though a little slow because of the clone, but that's fine for debug builds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The release build is missing the
remove()
call bellow which is guarded with a debug pragma, hence the function is a NOP.