refactor: drop DynRef
and move fs
into Workspace
#4493
Merged
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.
Summary
The reason
DynRef
existed was primarily because of tests: It allowed for dynamic ownership which was used to let theSession
own thefs
under normal execution, which in tests the test owned thefs
for snapshot purposes. With this PR, theWorkspace
has become the owner of thefs
, while everywhere else we use references. To resolve the situation in the tests, I've wrapped thefiles
of theMemoryFileSystem
in anArc
, which allows me to reconstruct theMemoryFileSystem
for the snapshot, even though the original instance was consumed during the test run.The reason I wanted to place the
fs
intoWorkspace
is so that we can start doing I/O from inside the workspace server, which this solution also allows for.Test Plan
CI should remain green.