listRegisteredDirectories.Rd
List the directories that were registered in SewerRat.
listRegisteredDirectories(
url,
user = NULL,
contains = NULL,
prefix = NULL,
within = NULL,
exists = NULL,
number = 100,
on.truncation = c("message", "warning", "none")
)
String containing the URL to the SewerRat REST API.
String containing the name of a user.
If not NULL
, results are filtered to directories registered by this user.
If TRUE
, this is set to the current user.
String containing an absolute path.
If not NULL
, results are filtered to directories that contain this path.
String containing an absolute path or a prefix thereof.
If not NULL
, results are filtered to directories that start with this string.
This is soft-deprecated and users should prefer to use within
.
String containing an absolute path.
If not NULL
, results are filtered to directories that are equal to or lie within this path.
Logical scalar indicating whether to only report directories that exist on the filesystem.
If FALSE
, only non-existent directories are reported, and if NULL
, no filtering is applied based on existence.
Integer specifying the maximum number of results to return.
This can also be Inf
to return all results.
String specifying what to do when the number of results exceeds number
.
Either "warning"
, "message"
, or "none"
.
List of named lists, where each inner list corresponds to a registered directory and contains:
path
, string containing a path to the directory.
user
, string containing the name of the user who registered this directory.
time
, numeric scalar specifying the the Unix epoch time when this directory was registered.
names
, a character vector containing the base names of the JSON files to be indexed.
# Starting up an example SewerRat service:
info <- startSewerRat()
# Mocking up a directory of stuff to query.
mydir <- tempfile()
dir.create(mydir)
write(file=file.path(mydir, "metadata.json"), '{ "first": "Aaron", "last": "Lun" }')
dir.create(file.path(mydir, "diet"))
write(file=file.path(mydir, "diet", "metadata.json"),
'{ "meal": "lunch", "ingredients": "water" }')
# Registering it:
register(mydir, "metadata.json", url=info$url)
# List the registered directories:
listRegisteredDirectories(url=info$url)
#> [[1]]
#> [[1]]$path
#> [1] "/tmp/RtmpOvzCpk/file1ce7715ec9e"
#>
#> [[1]]$user
#> [1] "root"
#>
#> [[1]]$time
#> [1] 1749491762
#>
#> [[1]]$names
#> [[1]]$names[[1]]
#> [1] "metadata.json"
#>
#>
#>
#> [[2]]
#> [[2]]$path
#> [1] "/tmp/RtmpOvzCpk/file1ce3dba865d"
#>
#> [[2]]$user
#> [1] "root"
#>
#> [[2]]$time
#> [1] 1749491762
#>
#> [[2]]$names
#> [[2]]$names[[1]]
#> [1] "metadata.json"
#>
#>
#>
#> [[3]]
#> [[3]]$path
#> [1] "/tmp/RtmpOvzCpk/file1ce2d05a2ad"
#>
#> [[3]]$user
#> [1] "root"
#>
#> [[3]]$time
#> [1] 1749491762
#>
#> [[3]]$names
#> [[3]]$names[[1]]
#> [1] "metadata.json"
#>
#>
#>
listRegisteredDirectories(url=info$url, user=TRUE)
#> [[1]]
#> [[1]]$path
#> [1] "/tmp/RtmpOvzCpk/file1ce7715ec9e"
#>
#> [[1]]$user
#> [1] "root"
#>
#> [[1]]$time
#> [1] 1749491762
#>
#> [[1]]$names
#> [[1]]$names[[1]]
#> [1] "metadata.json"
#>
#>
#>
#> [[2]]
#> [[2]]$path
#> [1] "/tmp/RtmpOvzCpk/file1ce3dba865d"
#>
#> [[2]]$user
#> [1] "root"
#>
#> [[2]]$time
#> [1] 1749491762
#>
#> [[2]]$names
#> [[2]]$names[[1]]
#> [1] "metadata.json"
#>
#>
#>
#> [[3]]
#> [[3]]$path
#> [1] "/tmp/RtmpOvzCpk/file1ce2d05a2ad"
#>
#> [[3]]$user
#> [1] "root"
#>
#> [[3]]$time
#> [1] 1749491762
#>
#> [[3]]$names
#> [[3]]$names[[1]]
#> [1] "metadata.json"
#>
#>
#>