Skip to contents

Marks a gs:// URL for the zarrs Rust backend. All I/O is delegated to object_store, so this class requires the gcs compiled feature (r-universe tier).

Format

R6::R6Class

Details

GcsStore is a dispatch marker, not a full store: it carries a URL and implements no key-level I/O of its own. Reads go through zarrs_open_array_metadata() and zarrs_get_subset(), which take the gs:// URL directly. Calling get_item(), contains_item() or listdir() on this object raises an error pointing at those functions and at HttpStore.

Configuration mirrors S3Store, with GOOGLE_ variables:

GOOGLE_SKIP_SIGNATURE

Set to "true" for anonymous access to a public bucket. Unlike S3, GCS does not infer this from the absence of credentials — without it, a world-readable bucket still fails.

GOOGLE_APPLICATION_CREDENTIALS, GOOGLE_SERVICE_ACCOUNT, GOOGLE_SERVICE_ACCOUNT_KEY

Credentials. The GCE metadata server is used when none are set.

GOOGLE_BASE_URL

Alternate endpoint, e.g. a local fake-gcs-server instance.

Public GCS data is also reachable over HTTPS at https://storage.googleapis.com/bucket/path using HttpStore, which needs no configuration and works on both distribution tiers.

Store handles are cached by URL on the Rust side, so changing credentials has no effect on an already-open store until you call zarrs_close_store().

Writes to GCS are not supported.

See also

HttpStore for public GCS data over HTTPS, which works on both distribution tiers. vignette("remote-stores") for worked examples.

Other Store classes: DirectoryStore, HttpStore, MemoryStore, S3Store, Store

Super class

pizzarr::Store -> GcsStore

Methods

Inherited methods


Method new()

Create a GcsStore.

Usage

GcsStore$new(url)

Arguments

url

Character. GCS URL (e.g., "gs://bucket/prefix").


Method get_item()

Not implemented. Raises an error naming the supported read paths.

Usage

GcsStore$get_item(key)

Arguments

key

The item key.

Returns

Never returns.


Method set_item()

Not implemented. Writes to GCS are not supported.

Usage

GcsStore$set_item(key, value)

Arguments

key

The item key.

value

The item value as a vector of type raw.

Returns

Never returns.


Method contains_item()

Not implemented. Raises an error naming the supported read paths.

Usage

GcsStore$contains_item(key)

Arguments

key

The item key.

Returns

Never returns.


Method listdir()

Not implemented. Raises an error naming the supported read paths.

Usage

GcsStore$listdir(path = NA)

Arguments

path

character path.

Returns

Never returns.


Method get_store_identifier()

Return the GCS URL for zarrs dispatch.

Usage

GcsStore$get_store_identifier()

Returns

A character string.


Method print()

Print a human-readable summary of the store.

Usage

GcsStore$print(...)

Arguments

...

Ignored.

Returns

self (invisibly).


Method clone()

The objects of this class are cloneable with this method.

Usage

GcsStore$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

if (FALSE) { # \dontrun{
# Public bucket, no credentials. Requires the gcs feature.
Sys.setenv(GOOGLE_SKIP_SIGNATURE = "true")

url <- "gs://pangeo-data/ECCO_basins.zarr"
zarrs_open_array_metadata(url, "basin_mask")
zarrs_close_store(url)

# Public GCS data needs no credentials over HTTPS:
z <- zarr_open(HttpStore$new(
  "https://storage.googleapis.com/pangeo-data/ECCO_basins.zarr"
))
} # }