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

StorageAdapter Versioning Implementation #932

Merged
merged 33 commits into from
Sep 15, 2023
Merged

Conversation

tpendragon
Copy link
Collaborator

@tpendragon tpendragon commented Sep 6, 2023

This adds a versioning implementation to Valkyrie StorageAdapters and implements it for a new versioned disk adapter and Fedora 4/5/6.

There's a follow-on ticket to do here: #934

As this doesn't change the API or outcomes of any of the adapters this is a minor release.

@tpendragon tpendragon marked this pull request as draft September 6, 2023 20:07
Copy link
Contributor

@hackartisan hackartisan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry this review took so long. It looks good to me, some requests for comments / organization.

lib/valkyrie/storage/versioned_disk.rb Outdated Show resolved Hide resolved
lib/valkyrie/storage/versioned_disk.rb Outdated Show resolved Hide resolved
lib/valkyrie/storage/versioned_disk.rb Outdated Show resolved Hide resolved

def upload_version(id:, file:)
version_timestamp = current_timestamp
version_id = version_id(id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be nice to name the local variable different from the method

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe comment why we're getting this? It seems like it's the version id of the file that, before this new file is uploaded, is the current version. And that it's used to get/create the correct file path for the file we're about to upload.

end

def current_timestamp
Time.now.strftime("%s%N")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would milliseconds (%L) be good enough here? It would save 6 characters in every filename.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently not, one of the tests fails. Computer's too fast. 😎

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could re-call if the file already exists, probably a good safety measure.

@tpendragon tpendragon marked this pull request as ready for review September 15, 2023 16:39
dlpierce
dlpierce previously approved these changes Sep 15, 2023
Copy link
Contributor

@hackartisan hackartisan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Way to make it happen!! Should we remove the unused keyword param mentioned inline.


# Delete the file on disk associated with the given identifier.
# @param id [Valkyrie::ID]
def delete(id:, purge_versions: false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

purge_versions no longer used

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, removed.

@tpendragon tpendragon merged commit a97b5d7 into main Sep 15, 2023
@tpendragon tpendragon deleted the storage_versioning branch September 15, 2023 22:05
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.

3 participants