Create a placeholder file that links to an ArtifactDB ID. This is by initializeUpload to automatically create deduplicating links.

createPlaceholderLink(dir, path, id)

extractLinkedID(dir, path)

Arguments

dir

String containing the path to the project directory.

path

String containing the relative path of the file in dir to be linked from.

id

String containing the ArtifactDB identifier of the file to be linked to.

Value

For createLink, a symbolic link is created at path inside dir, with the id string embedded in the name of the destination file. NULL is invisibly returned.

For extractLinkID, a string is returned containing the ArtifactDB identifier used to create the link.

Details

The placeholder is implemented as a dangling symlink where the id is embedded into the destination path. This distinguishes the placeholders from regular files and non-broken symlinks to existing targets, allowing initializeUpload to safely assume that the placeholder represents a link to an ArtifactDB resource.

See also

initializeUpload, where the placeholders are automatically detected for linking.

Author

Aaron Lun

Examples

tmp <- tempfile()
dir.create(tmp)
 
createPlaceholderLink(tmp, "boo.txt", example.id)
list.files(tmp)
#> [1] "boo.txt"

extractLinkedID(tmp, "boo.txt")
#> [1] "test-public:blah.txt@base"