Skip to contents

Enumerates every object matching a prefix and extension, unlike cloud_object_name() which resolves a single versioned object. Use this when a prefix legitimately covers many distinct objects — for example one Parquet file per GPS trip.

Usage

cloud_object_names(
  prefix,
  provider,
  options,
  extension = "",
  latest_only = FALSE
)

Arguments

prefix

A character string specifying the object name prefix.

provider

A character string specifying the cloud storage provider.

options

A named list of cloud storage provider options.

extension

A character string the object name must end with. Default "", i.e. no extension filter.

latest_only

Logical. If TRUE, keeps only the most recently updated object per distinct base_name, applying cloud_object_name()'s "latest" semantics to each base name independently rather than across the whole match set. Default FALSE, which returns everything.

Value

A character vector of object names, sorted, possibly of length zero. Never NA.

Details

Names that do not follow the <base_name>__<version>__.<ext> convention are still returned when latest_only = FALSE; they are skipped when latest_only = TRUE, because there is no version to compare.

See also

cloud_object_name() for resolving a single versioned object.

Examples

if (FALSE) { # \dontrun{
# Every stored track object
all_tracks <- cloud_object_names(
  prefix = "pds-track",
  provider = conf$storage$google$key,
  options = conf$pds_storage$google$options,
  extension = "parquet"
)

# The latest version of each distinct base name under a prefix
latest_each <- cloud_object_names(
  prefix = "trips-",
  provider = conf$storage$google$key,
  options = conf$storage$google$options,
  extension = "parquet",
  latest_only = TRUE
)
} # }