Following #632 (once I'm done with it) we should have the ability to change a commit's metadata from another commit via changing the file written to the volume, however, as of right now we don't need to be able to do this.
This issue therefore covers:
The ability to change metadata on existing commits, so we don't need a separate storage mechanism to allow for corrections, marking commits as "archived", etc.
which was previously in that issue.
ACs
[ ] The ability to update metadata of existing commits when making a commit, through special metadata added to the new commit: adding a property of the form #update-commit-metadata:<COMMIT ID> that contains a JSON string:string map of metadata makes this commit overwrite the metadata of an earlier commit.
[ ] Documentation updated to reflect property naming rules, with a note that any property whose name starts with # is reserved for system purposes.
[ ] Multiple commits may be updated in the same commit.
[ ] The #update-commit-metadata:<COMMIT ID> properties are part of the metadata of the new commit, and will be recorded as such.
[ ] Commits that have been updated, when fetched through APIs that return commit metadata, return the new metadata plus some extra audit metadata for every time it's been updated: a property of the form #updated:<INDEX>:<COMMIT ID> will contain a JSON string:string map recording the state of the metadata BEFORE that update. <INDEX> starts at 0 and increments for each update to the commit. <COMMIT ID> is the ID of the commit that made the change. The map DOES NOT include any #updated:... properties from previous updates!
[ ] Attempting to provide #updated:... properties in commit metadata, or editing them into a commit with a later commit, is forbidden and results in the API call returning an error.
Implementation notes
When storing a commit, if it has #update-commit-metadata: properties, create or update metadata files for those commits, creating the #updated audit properties.
All updates to metadata files must be atomic (create the new file alongside with a .json.tmp extension, then rename it over any existing one when completed), and committed in the ZFS snapshot corresponding to the commit responsible for that change.
Following #632 (once I'm done with it) we should have the ability to change a commit's metadata from another commit via changing the file written to the volume, however, as of right now we don't need to be able to do this.
This issue therefore covers:
ACs
#update-commit-metadata:<COMMIT ID>
that contains a JSON string:string map of metadata makes this commit overwrite the metadata of an earlier commit.#
is reserved for system purposes.#update-commit-metadata:<COMMIT ID>
properties are part of the metadata of the new commit, and will be recorded as such.#updated:<INDEX>:<COMMIT ID>
will contain a JSON string:string map recording the state of the metadata BEFORE that update.<INDEX>
starts at 0 and increments for each update to the commit.<COMMIT ID>
is the ID of the commit that made the change. The map DOES NOT include any#updated:...
properties from previous updates!#updated:...
properties in commit metadata, or editing them into a commit with a later commit, is forbidden and results in the API call returning an error.Implementation notes
#update-commit-metadata:
properties, create or update metadata files for those commits, creating the#updated
audit properties..json.tmp
extension, then rename it over any existing one when completed), and committed in the ZFS snapshot corresponding to the commit responsible for that change.