Skip to contents

ic_chunk_refs() returns one row per stored chunk of a snapshot (or of one array): its Zarr key and where its bytes are. kind is "native" (bytes in the repository, location is chunks/<id> relative to the repository root), "virtual" (bytes in another object, location is its URL) or "inline" (bytes in the manifest). Chunks never written are absent (fill value). This is the table a reader needs to fetch chunks itself, and to check a repository against the reference table it was built from.

Usage

ic_chunk_refs(session, path = NULL, inline = FALSE)

ic_nodes(session)

ic_virtual_locations(session)

Arguments

session

an icechunk_session.

path

an array path ("/temp"), or NULL for all arrays.

inline

include inline chunk bytes as a list column.

Value

a data frame: path, coord (comma-separated 0-based chunk index), key, kind, location, offset, length, etag, last_modified (and inline).

Examples

ex <- ic_example_repo()
s <- ic_session_readonly(ic_repo_open(ex$path, authorize = ex$authorize), branch = "main")
ic_nodes(s)
#>        path  type shape num_chunks dimension_names
#> 1         / group  <NA>       <NA>            <NA>
#> 2 /from_bin array 64,48        4,1             y,x
#> 3  /from_nc array 64,48        1,1             y,x
#> 4    /small array   4,6        2,2             y,x
ic_chunk_refs(s, "/from_bin")[, c("coord", "kind", "location", "offset", "length")]
#>   coord    kind
#> 1   0,0 virtual
#> 2   1,0 virtual
#> 3   2,0 virtual
#> 4   3,0 virtual
#>                                                               location offset
#> 1 file:///tmp/RtmpVaRScy/icechunk-example-35c9725e3acd/source/grid.bin      0
#> 2 file:///tmp/RtmpVaRScy/icechunk-example-35c9725e3acd/source/grid.bin   3072
#> 3 file:///tmp/RtmpVaRScy/icechunk-example-35c9725e3acd/source/grid.bin   6144
#> 4 file:///tmp/RtmpVaRScy/icechunk-example-35c9725e3acd/source/grid.bin   9216
#>   length
#> 1   3072
#> 2   3072
#> 3   3072
#> 4   3072
ic_chunk_refs(s, inline = TRUE)[, c("path", "coord", "kind", "length")]
#>        path coord    kind length
#> 1 /from_bin   0,0 virtual   3072
#> 2 /from_bin   1,0 virtual   3072
#> 3 /from_bin   2,0 virtual   3072
#> 4 /from_bin   3,0 virtual   3072
#> 5  /from_nc   0,0 virtual  12288
#> 6    /small   0,0  inline     48
#> 7    /small   0,1  inline     48
#> 8    /small   1,0  inline     48
#> 9    /small   1,1  inline     48
ic_virtual_locations(s)
#> [1] "file:///tmp/RtmpVaRScy/icechunk-example-35c9725e3acd/source/grid.bin"
#> [2] "file:///tmp/RtmpVaRScy/icechunk-example-35c9725e3acd/source/grid.bin"
#> [3] "file:///tmp/RtmpVaRScy/icechunk-example-35c9725e3acd/source/grid.bin"
#> [4] "file:///tmp/RtmpVaRScy/icechunk-example-35c9725e3acd/source/grid.bin"
#> [5] "file:///tmp/RtmpVaRScy/icechunk-example-35c9725e3acd/source/grid.nc"