Skip to content

Extending Persistency to Allow Associating a File to Entity and Key Pair #5476

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

UnknowableCoder
Copy link

I propose a set of functions to DFHack::Persistency to allow managing whole files, following the same entity ID and key logic as the pre-existing functions.

The API was designed around managing the possible paths for these files rather than the files themselves; it would be up to the callers to interact with them according to the demands of their particular use case. Every (entity ID, key) pair will be associated with a unique file ID, corresponding to a file with a name of the form dfhack-pf-<ID>.dat. The association between (entity ID, key) pairs and file IDs is saved as JSON in dfhack-extra-files.dat.

Files that are requested will be copied over to the current folder unless specifically requested as read only through the API (in which case modifying their contents leads to these changes not being reflected if the user does not save to the same folder).

No attempt is made at this stage to offer any particular form of synchronization or memory management of the files themselves. Operations that add to or query the list of available files are guarded by CoreSuspender, but this ultimately only protects the list of file IDs.

No provisions are made for associating more than one file to an (entity ID, key) pair.

Note: I surmised from perusing previous discussions that it was not yet consensual among the main developers whether DFHack should offer the ability to request an entire file for persistency. However, for my current project of overhauling the dwarf logic system, serialization/deserialization could be important for performance if the user configures many objects to be handled by my system, so a more optimized way of handling that seems desirable. My apologies if I overstep any boundaries by proposing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant