Skip to contents

Reads one snapshot of an Icechunk repository through the tabularberg package. Everything zaro does with a store works on the result: zaro_meta(), zaro_read(), zaro_array(), zaro_dataset(), zaro_plan().

Usage

zaro_icechunk(
  source,
  branch = NULL,
  tag = NULL,
  snapshot = NULL,
  authorize = NULL,
  direct = FALSE,
  verbose = zaro_verbose()
)

Arguments

source

an icechunk_repo or icechunk_session from tabularberg, or a repository location for tabularberg::ic_repo_open() (a local path, an http(s):// URL, or an icechunk_storage).

branch, tag, snapshot

the version to read (one of them; default branch "main"). Ignored when source is a session.

authorize

virtual chunk containers to authorize, passed to tabularberg::ic_repo_open() when source is a location.

direct

logical. Fetch virtual chunks with zaro's own fetcher instead of through Icechunk (see Details).

verbose

logical. Emit diagnostic messages.

Value

An IcechunkStore.

Details

The tabularberg package is not on CRAN; install it from R-universe with install.packages("tabularberg", repos = "https://hypertidy.r-universe.dev").

The session is read-only and pinned to one snapshot (its id is in store@snapshot), so lazy arrays made from it keep reading the same version after the branch moves on. Pick the version with branch, tag or snapshot (default branch "main").

Chunks are read through Icechunk by default, which applies the repository's container authorization and checksums. With direct = TRUE zaro fetches virtual chunks itself, concurrently and with adjacent byte ranges merged, but only from containers the repository object has authorized (see tabularberg::ic_repo_containers()), and without Icechunk's etag / last-modified checks. Native and inline chunks always come from Icechunk.

Examples

if (FALSE) { # requireNamespace("tabularberg", quietly = TRUE)
## a small local repository that tabularberg writes to tempdir()
ex <- tabularberg::ic_example_repo()
store <- zaro_icechunk(ex$path, tag = "v1", authorize = ex$authorize)
zaro_dataset(store)
zaro_read(store, "from_bin", start = c(0, 0), count = c(3, 4))
if (requireNamespace("altarr", quietly = TRUE)) {
  x <- zaro_array(store, "from_bin")
  x[1:4, 1:4]
}
}