Buffer filesystem changes and sync on world save #1456
Labels
area-Core
This affects CC's core (the Lua runtime, APIs, computer internals).
area-Minecraft
This affects CC's Minecraft-specific content.
enhancement
An extension of a feature or a new feature.
feedback wanted
Tell me what you want, what you really really want.
Currently, a computer gets a direct view of the host computer's filesystem, meaning that when a computer changes a file, it is immediately written to disk. This is fine most of the time (and easy to implement!) - however, in the event of crashes, it's possible for computers to write files to disk, but the chunk they're in rolled-back. This is especially irritating when trying to track turtle positions by saving to a file.
The solution1 here is to buffer file changes, effectively maintaining a virtual file system until the owning chunk2 is saved, at which point we can sync the files back to disk.
There are several other motivations for this:
However, there are some concerns I have here - it's a common pattern for people to touch the computer's file system directly, viewing and editing files in an external text editor. This is pretty incompatible with a buffered file system (changes in one will not be immediately visible in the other), and I'm not sure how to reconcile that3.
It may be sufficient to handle this one-way, picking up changes made externally in-game. This at least allows editing files out-of-game, but will not allow (for instance), tailing log files that a computer writes.
Not sure. I'm definitely a while away from wanting to implement this, so any thoughts welcome!
Footnotes
Well, an improvement. There's always going to be crashes which leave things in an entirely corrupted state, but we can at least do better than the status quo. ↩
Or owning entity for pocket computers. ↩
We'll probably want a config option for this, but really we want a something which works Well Enough straight away. ↩
The text was updated successfully, but these errors were encountered: