Fetch the manifest for a version of an asset of a project. This will call the REST API if the caller is not on the same filesystem as the registry.

fetchManifest(
  project,
  asset,
  version,
  registry,
  url,
  cache = NULL,
  forceRemote = FALSE,
  overwrite = FALSE
)

Arguments

project

String containing the project name.

asset

String containing the asset name.

version

String containing the version name.

registry

String containing a path to the registry.

url

String containing the URL to the Gobbler REST API. Only used for remote access.

cache

String containing a path to a cache directory. If NULL, an appropriate location is automatically chosen. Only used for remote access.

forceRemote

Logical scalar indicating whether to force remote access. This will download all files in the path via the REST API and cache them locally, even if registry is on the same filesystem as the caller.

overwrite

Logical scalar indicating whether to overwrite the existing cache. Only used for remote access.

Value

List containing the manifest for this version. Each element is named after the relative path of a file in this version. The value of each element is another list with the following fields:

  • size, an integer specifying the size of the file in bytes.

  • md5sum, a string containing the hex-encoded MD5 checksum of the file.

  • link (optional): a list specifying the link destination for a file. This contains the strings project, asset, version and path. If the link destination is itself a link, an ancestor list will be present that specifies the final location of the file after resolving all intermediate links.

Author

Aaron Lun

Examples

info <- startGobbler()
removeProject("test", info$staging, url=info$url) # start with a clean slate.
createProject("test", info$staging, url=info$url)

# Mocking up an upload. 
src <- allocateUploadDirectory(info$staging)
write(file=file.path(src, "foo"), "BAR")
dir.create(file.path(src, "whee"))
write(file=file.path(src, "whee", "blah"), "stuff")
uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)

# Obtaining the manifest for this version.
fetchManifest("test", "simple", "v1", registry=info$registry, url=info$url)
#> $foo
#> $foo$size
#> [1] 4
#> 
#> $foo$md5sum
#> [1] "f98bf6f12e995a053b7647b10d937912"
#> 
#> 
#> $`whee/blah`
#> $`whee/blah`$size
#> [1] 6
#> 
#> $`whee/blah`$md5sum
#> [1] "9eb84090956c484e32cb6c08455a667b"
#> 
#> 

# Force remote access.
fetchManifest(
    "test", 
    "simple", 
    "v1", 
    registry=info$registry, 
    url=info$url, 
    forceRemote=TRUE
)
#> $foo
#> $foo$size
#> [1] 4
#> 
#> $foo$md5sum
#> [1] "f98bf6f12e995a053b7647b10d937912"
#> 
#> 
#> $`whee/blah`
#> $`whee/blah`$size
#> [1] 6
#> 
#> $`whee/blah`$md5sum
#> [1] "9eb84090956c484e32cb6c08455a667b"
#> 
#>