pins-r icon indicating copy to clipboard operation
pins-r copied to clipboard

Replacing pin_created with pin_hash

Open thomaszwagerman opened this issue 3 years ago • 2 comments

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

Suggestion made by @TylerGrantSmith.

Closes #542

thomaszwagerman avatar Feb 01 '22 18:02 thomaszwagerman

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.

thomaszwagerman avatar Feb 09 '22 09:02 thomaszwagerman

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():

https://github.com/rstudio/pins-r/blob/9d014de4d9384213ebc4e6e02888de5eb36d4ffd/R/pin-read-write.R#L209-L216

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

juliasilge avatar Aug 11 '22 15:08 juliasilge

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().

thomaszwagerman avatar Aug 18 '22 17:08 thomaszwagerman

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[bot] avatar Sep 02 '22 00:09 github-actions[bot]