Skip to content
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

[DRAFT] Update ResourceFormatSaver::_save() virtual method for new integrity level argument #101154

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dsnopek
Copy link
Contributor

@dsnopek dsnopek commented Jan 5, 2025

This builds on PR #100674 and #100447, in order to make the changes the ResourceFormatSaver::_save() virtual method in a way that doesn't break GDExtension compatibility.

(These changes used to be part of PR #100674 but I've extracted them here)

This will be a DRAFT until those other two have been merged.

darksylinc and others added 3 commits December 19, 2024 19:10
This PR adds an argument to most save functions to specify what level of
integrity should Godot attempt to guarantee when writing a file.

This in preparation for PR godotengine#98361; which will introduce a full sync
barrier when performing save operations to avoid data loss.

This PR puts such expensive sync() behind the enum
SAVE_INTEGRITY_SAVE_SWAP_PLUS_SYNC; which should be used sparingly for
important information.

This PR also sets most cache files to be saved as either
SAVE_INTEGRITY_SAVE_SWAP (old default behavior) or SAVE_INTEGRITY_NONE;
because Godot can easily generate thousands of these file saving
operations. Performing thousands of full syncs() would be too expensive,
specially when these files can be regenerated if they're corrupted or
lost.

The PR is incomplete as it does not yet expose integrity levels to the
user, which is relevant for certain file saving operations, such as when
game save files that store the player's progress (those should be done
with SAVE_INTEGRITY_SAVE_SWAP_PLUS_SYNC).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants