R/update_data.R

Defines functions packtrack_update

Documented in packtrack_update

#' Update the dictionary
#'
#' This internal function either adds a new entry to the dictionary if the package is not among
#' the keys, or refreshes the time stamp otherwise.
#' It should not be called by the user.
#'
#' @param pkg the name of the package to add to the dictionary
#'
#' @export
#'
packtrack_update <- function(pkg) {
  .packtrack_data$time[[pkg]] <- Sys.time()
  if (.packtrack_data$n$has_key(pkg)) {
    .packtrack_data$n[[pkg]] <- .packtrack_data$n[[pkg]] + 1L
  } else {
    .packtrack_data$n[[pkg]] <- 1L
  }
  #packtrack_unlock() ## for unlocking the saving on drive -> for future
  NULL
}
courtiol/packtrack documentation built on May 30, 2021, 12:10 a.m.