Skip to content

Commit

Permalink
remove more s3 things
Browse files Browse the repository at this point in the history
  • Loading branch information
cole-brokamp committed Sep 3, 2024
1 parent 709c5c0 commit fc90978
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 47 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ export(as_codec_dpkg)
export(codec_colors)
export(codec_dpkg_s3_put)
export(get_codec_dpkg)
export(stow_codec_dpkg)
import(cincy)
14 changes: 14 additions & 0 deletions R/codec_dpkg.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#' Read a dpkg from the public CoDEC repository into R
#'
#' Public data packages are downloaded from `gh://geomarker-io/codec/` using
#' `dpkg::stow()` to cache a local copy in the user's data directory.
#' @param codec_dpkg name of CoDEC dpkg
#' @param overwrite logical; re-download the remote file even though
#' a local file with the same name exists?
#' @returns a CoDEC data package (see `dpkg::as_dpkg()`)
#' @export
get_codec_dpkg <- function(codec_dpkg, overwrite = FALSE) {
dpkg::read_dpkg(dpkg::stow(glue::glue("gh://geomarker-io/codec/{codec_dpkg}"),
overwrite = overwrite))
}

#' as_codec_dpkg
#'
#' Convert a tibble to a data package (`dpkg`) object in R while checking it
Expand Down
32 changes: 0 additions & 32 deletions R/codec_dpkg_s3.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,3 @@ codec_dpkg_s3_put <- function(x) {
return(as.character(glue::glue("s3://geomarker-io/codec_data/{attr(x, 'name')}-v{attr(x, 'version')}.parquet")))
}

#' Read a dpkg from the public CoDEC repository into R
#'
#' Public data packages are downloaded from `s3://geomarker-io/codec_data`.
#' `dpkg::stow()` is used to cache a local copy in the user's data directory so that
#' it is available later without having to redownload it.
#' @param codec_dpkg name of CoDEC dpkg
#' @param overwrite logical; re-download the remote file even though
#' a local file with the same name exists?
#' @returns for `get_codec_dkg()`, an data package (`dpkg::as_dpkg()`) object; for
#' `stow_codec_dpkg()`, the path to the downloaded data package parquet file
#' @export
#' @examples
#' get_codec_dpkg("drivetime-v0.2.2")
#'
#' stow_codec_dpkg("drivetime-v0.2.2")
get_codec_dpkg <- function(codec_dpkg, overwrite = FALSE) {
dpkg::read_dpkg(stow_codec_dpkg(codec_dpkg = codec_dpkg, overwrite = overwrite))
}

#' Stow a dpkg from the public CoDEC S3 bucket
#' @rdname get_codec_dpkg
#' @export
stow_codec_dpkg <- function(codec_dpkg, overwrite = FALSE) {
dpkg::stow_url(
paste0("https://geomarker-io.s3.us-east-2.amazonaws.com/codec_data/", codec_dpkg, ".parquet"),
overwrite = overwrite
)
}

list_codec_dpkg <- function() {
system2("aws", c("s3", "ls", "s3://geomarker-io/codec_data/"))
}
18 changes: 4 additions & 14 deletions man/get_codec_dpkg.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fc90978

Please sign in to comment.