-
Notifications
You must be signed in to change notification settings - Fork 177
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
Major Subsystem Rewrite (Reconciler Mk5) #217
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Jul 16, 2019
Closed
This was referenced Aug 23, 2019
Merged
Closed
0.5.0 is released, so now this can go into master and become the base for a new lineage of Rojo releases! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR reimplements most of the big chunks in Rojo to shift their philosophy, enable some new features, and make it easier to understand and edit the codebase in the future.
.model.json
files has reverted to match 0.4.x, andName
is now optional. This change was landed in master for testing ease.Remaining Work
init.lua
,init.server.lua
, andinit.client.lua
foo.meta.json
init.meta.json
$ignoreUnknownInstances
ImfsEntry
API, potentially usinggenerational_arena
instead of spammingPathBuf
SnapshotMiddleware
RbxSession
and web server with new project lifecyclerojo serve
?Philosophy Change
Instead of reading the project structure out of the project file at initialization time, the project file is discovered organically through the snapshot middleware! This has a few awesome side effects:
rojo build
can now operate on any file that Rojo can turn into an instance!rojo build input.rbxm -o output.rbxmx
rojo build main.lua -o MyPlugin.rbxmx
In-memory filesystem (IMFS)
The in-memory filesystem was rewritten to fetch files lazily instead of recursively reading in all files. I saw this as a prerequisite for nested projects so that we would avoid reading in lots of files accidentally.
All methods on the IMFS require exclusive mutable access, which makes some operations awkward since even reading can result in mutation. There might be a slightly cleaner approach involving interior mutability, possibly wrapping the data storage itself in an
Rc
orArc
.Snapshot Subsystem
The snapshot subsystem was rewritten in order to break apart the code that generates patches and the code that applies them, which isolates the different forms of complexity.
I'm considering making applying a patch return a different kind of patch that actually gets sent over the network that would include ID information on instances that were created. That information is critical for correctly applying patches in the Rojo plugin!
Snapshot Middleware
The giant ball of mud in
rbx_snapshot.rs
for determining how to turn files into instances was broken apart into a folder of "snapshot middleware". A middleware is a struct that implements theSnapshotMiddleware
trait. Examples of middleware are support for.lua
scripts, support for.rbxm
models, or a middleware that implements all user plugins!The middleware trait defines how to turn in-memory files into instances, as well as instances to file snapshots: two-way sync! There's still work to do in adding the additional metadata context needed for live-syncing.
I'm not sure if generating snapshots of files is tractable. There is a single way to turn files into instances, but many different ways to turn instances back into files. While snapshots work well for the former case, it's possible that they're not enough (even with extra context) for two-way sync and we might need to revise this a bit.
Differences from Reconciler Mk4 (previous experiment)
This approach is the successor to #198. In this branch, the goal is to be less pedantic about child ordering than the reconciler-mk4 branch while still trying to accomplish the same overall goal.
The branch does not currently preserve child order across mutations. We can apply a similar strategy to this branch as we did to the current master branch if it's important.