Skip to contents

Version locker contents

Usage

version_locker(where, version = "save", overwrite = FALSE, noreset = FALSE)

Arguments

where

The locker location.

version

A tag to be appended to where for creating a backup of the locker contents.

overwrite

If TRUE, the new location will be removed with unlink() if it exists.

noreset

If TRUE, config_locker() is called on the new version to mark the space noreset.

Value

A logical value indicating whether or not all files were successfully copied to the backup, invisibly.

Examples

locker <- file.path(tempdir(), "version-locker-example")

if(dir.exists(locker)) unlink(locker, recursive = TRUE)

x <- new_stream(1, locker = locker)

cat("test", file = file.path(locker, "1-1"))

dir.exists(locker)
#> [1] TRUE

list.files(locker, all.files = TRUE)
#> [1] "."                  ".."                 ".paquet-locker-dir"
#> [4] "1-1"               

y <- version_locker(locker, version = "y")

y
#> [1] "/var/folders/5w/2ky5lwcj1zq7kyk4c3zg3zpw0000gp/T//Rtmpx1IZit/version-locker-example-y"

list.files(y, all.files = TRUE)
#> [1] "."                  ".."                 ".paquet-locker-dir"
#> [4] "1-1"