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

Replacing pin_created with pin_hash #595

Merged
merged 4 commits into from
Aug 18, 2022

Conversation

thomaszwagerman
Copy link
Contributor

Replaces pin_created() with pin_hash(), which supports functionality of pin_reactive_read() and pin_reactive_download().

Suggestion made by @TylerGrantSmith.

Closes #542

@thomaszwagerman
Copy link
Contributor Author

Looking at this again and had a thought.

I've replaced pin_created() with a function called pin_hash(), however where pin_meta() returns $created for the date the pin was created, for the hash of the pin contents it returns $pin_hash. When I looked back over the code this caused confusion.

Either I change the pin_hash() function name, or the output of pin_meta() should be changed from $pin_hash -> $hash, which I think is more consistent with the rest of pin_meta()'s outputs.

@juliasilge
Copy link
Member

Thank you so much for this PR @thomaszwagerman and for your patience on it!

I agree that it's not ideal that the hash is called pin_hash in the pin metadata. However, it wouldn't really solve this specific question because there is an existing unexported function called pin_hash():

pins-r/R/pin-read-write.R

Lines 209 to 216 in 9d014de

pin_hash <- function(paths) {
if (length(paths) == 1) {
hash_file(paths)
} else {
hashes <- map_chr(paths, hash_file)
hash(hashes)
}
}

Even if we were to change the name of pin_hash, we still need to change the function name here. Maybe get_pin_hash()?

@thomaszwagerman
Copy link
Contributor Author

Hi @juliasilge, thank you for you reply, and no worries at all for the wait!

Apologies, I was not aware of the unexported pin_hash() - I've implemented your suggestion by changing the function name to get_pin_hash().

Copy link
Member

@juliasilge juliasilge left a comment

Choose a reason for hiding this comment

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

Thank you so much for this PR @thomaszwagerman! 🙌

@juliasilge juliasilge merged commit 1a0c16b into rstudio:main Aug 18, 2022
@github-actions
Copy link

github-actions bot commented Sep 2, 2022

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pins_reactive_read does not update when pin changes more frequently than once a minute
2 participants