-
Notifications
You must be signed in to change notification settings - Fork 677
[1/3] RawModuleDefV10 definition and validation.
#4098
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
base: master
Are you sure you want to change the base?
Conversation
gefjon
left a comment
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.
I haven't looked at your validation logic yet, but I assume it's reasonably straightforward. The raw def format itself looks great, excellent work.
| /// Unlike V9 where lifecycle was a field on reducers, | ||
| /// V10 stores lifecycle-to-reducer mappings separately. | ||
| LifeCycleReducers(Vec<RawLifeCycleReducerDefV10>), | ||
| //TODO: Add section for Event tables, and Case conversion before exposing this from module |
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.
That's the neat part: we can expose this whenever we want, and adding new sections / variants to this enum is a non-breaking change!
| /// The name of the table. | ||
| /// Unique within a module, acts as the table's identifier. | ||
| /// Must be a valid `spacetimedb_schema::identifier::Identifier`. | ||
| pub name: RawIdentifier, |
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.
For added clarity with Tyler's case conversion proposal, could you change this (and other name fields) to be called source_name?
| /// Default values for columns in this table. | ||
| pub default_values: Vec<RawColumnDefaultValueV10>, |
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.
Do you think it would make more sense to store this in a separate section? Or any of the other stuff in here? I have no particular opinion, just thought I'd mention it as a possibility.
Description of Changes
Patch:
crates/lib/src/db/raw_def/v10.rs- a definition as per https://github.com/clockworklabs/SpacetimeDBPrivate/issues/2412.RawModuleDefV9validation code to dedup some of the core validation logic, No functionality should change there.RawModuleDefV10.crates::schema::def::ModuleDef:raw_module_def_versionvisibilityfield to existingRedcuerDefandProcedureDefLot of code is duplicated from
RawModuleDefV9includng tests.API and ABI breaking changes
NA,
RawModuleDefV10is not yet exported by modules.Expected complexity level and risk
3? close analyses of structure is important to ensure future extensibility.
Testing
For code motion in
RawModuleDefV9validation: Existing unit tests seems to cover any functionality change.For
RawModuleDefV10: V9 test has been repeated with moreasserts to check onvisibility