From 01395f3faf182a43860596248283a46c1905f747 Mon Sep 17 00:00:00 2001 From: Chandra Date: Fri, 30 Jan 2026 10:10:22 +0000 Subject: [PATCH 1/2] chore: Add README for running zonal buckets samples --- samples/README.md | 9 ++- samples/snippets/zonal_buckets/README.md | 74 ++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 samples/snippets/zonal_buckets/README.md diff --git a/samples/README.md b/samples/README.md index 490af710a..9999e8e53 100644 --- a/samples/README.md +++ b/samples/README.md @@ -34,8 +34,15 @@ for more detailed instructions. ``` source /bin/activate ``` +3. To run samples for [Zonal Buckets](https://github.com/googleapis/python-storage/tree/main/samples/snippets/zonal_buckets) -3. Install the dependencies needed to run the samples. + ``` + pip install -e ".[grpc]" + python samples/snippets/zonal_buckets/storage_create_and_write_appendable_object.py --bucket_name --object_name + + ``` + +4. Install the dependencies needed to run the samples. ``` cd samples/snippets pip install -r requirements.txt diff --git a/samples/snippets/zonal_buckets/README.md b/samples/snippets/zonal_buckets/README.md new file mode 100644 index 000000000..5f84b70ea --- /dev/null +++ b/samples/snippets/zonal_buckets/README.md @@ -0,0 +1,74 @@ +# Google Cloud Storage - Zonal Buckets Snippets + +This directory contains snippets for interacting with Google Cloud Storage zonal buckets. + +## Prerequisites + +- A Google Cloud Platform project with the Cloud Storage API enabled. +- A zonal Google Cloud Storage bucket. + +## Running the snippets + +### Create and write to an appendable object + +This snippet uploads an appendable object to a zonal bucket. + +```bash +python samples/snippets/zonal_buckets/storage_create_and_write_appendable_object.py --bucket_name --object_name +``` + +### Finalize an appendable object upload + +This snippet creates, writes to, and finalizes an appendable object. + +```bash +python samples/snippets/zonal_buckets/storage_finalize_appendable_object_upload.py --bucket_name --object_name +``` + +### Download a range of bytes from multiple objects concurrently + +This snippet downloads a range of bytes from multiple objects concurrently. + +```bash +python samples/snippets/zonal_buckets/storage_open_multiple_objects_ranged_read.py --bucket_name --object_names +``` + +### Download multiple ranges of bytes from a single object + +This snippet downloads multiple ranges of bytes from a single object into different buffers. + +```bash +python samples/snippets/zonal_buckets/storage_open_object_multiple_ranged_read.py --bucket_name --object_name +``` + +### Download the entire content of an object + +This snippet downloads the entire content of an object using a multi-range downloader. + +```bash +python samples/snippets/zonal_buckets/storage_open_object_read_full_object.py --bucket_name --object_name +``` + +### Download a range of bytes from an object + +This snippet downloads a range of bytes from an object. + +```bash +python samples/snippets/zonal_buckets/storage_open_object_single_ranged_read.py --bucket_name --object_name --start_byte --size +``` + +### Pause and resume an appendable object upload + +This snippet demonstrates pausing and resuming an appendable object upload. + +```bash +python samples/snippets/zonal_buckets/storage_pause_and_resume_appendable_upload.py --bucket_name --object_name +``` + +### Tail an appendable object + +This snippet demonstrates tailing an appendable GCS object, similar to `tail -f`. + +```bash +python samples/snippets/zonal_buckets/storage_read_appendable_object_tail.py --bucket_name --object_name --duration +``` From 66dde27ecdaedf7fa862968baf2e254c8e68ff77 Mon Sep 17 00:00:00 2001 From: Chandra Date: Mon, 2 Feb 2026 08:41:47 +0000 Subject: [PATCH 2/2] address comments --- samples/README.md | 2 +- samples/snippets/zonal_buckets/README.md | 42 +++++++++++++----------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/samples/README.md b/samples/README.md index 9999e8e53..118a778cb 100644 --- a/samples/README.md +++ b/samples/README.md @@ -37,7 +37,7 @@ for more detailed instructions. 3. To run samples for [Zonal Buckets](https://github.com/googleapis/python-storage/tree/main/samples/snippets/zonal_buckets) ``` - pip install -e ".[grpc]" + pip install "google-cloud-storage[grpc]" python samples/snippets/zonal_buckets/storage_create_and_write_appendable_object.py --bucket_name --object_name ``` diff --git a/samples/snippets/zonal_buckets/README.md b/samples/snippets/zonal_buckets/README.md index 5f84b70ea..71c17e5c3 100644 --- a/samples/snippets/zonal_buckets/README.md +++ b/samples/snippets/zonal_buckets/README.md @@ -25,29 +25,22 @@ This snippet creates, writes to, and finalizes an appendable object. python samples/snippets/zonal_buckets/storage_finalize_appendable_object_upload.py --bucket_name --object_name ``` -### Download a range of bytes from multiple objects concurrently +### Pause and resume an appendable object upload -This snippet downloads a range of bytes from multiple objects concurrently. +This snippet demonstrates pausing and resuming an appendable object upload. ```bash -python samples/snippets/zonal_buckets/storage_open_multiple_objects_ranged_read.py --bucket_name --object_names +python samples/snippets/zonal_buckets/storage_pause_and_resume_appendable_upload.py --bucket_name --object_name ``` -### Download multiple ranges of bytes from a single object +### Tail an appendable object -This snippet downloads multiple ranges of bytes from a single object into different buffers. +This snippet demonstrates tailing an appendable GCS object, similar to `tail -f`. ```bash -python samples/snippets/zonal_buckets/storage_open_object_multiple_ranged_read.py --bucket_name --object_name +python samples/snippets/zonal_buckets/storage_read_appendable_object_tail.py --bucket_name --object_name --duration ``` -### Download the entire content of an object - -This snippet downloads the entire content of an object using a multi-range downloader. - -```bash -python samples/snippets/zonal_buckets/storage_open_object_read_full_object.py --bucket_name --object_name -``` ### Download a range of bytes from an object @@ -57,18 +50,29 @@ This snippet downloads a range of bytes from an object. python samples/snippets/zonal_buckets/storage_open_object_single_ranged_read.py --bucket_name --object_name --start_byte --size ``` -### Pause and resume an appendable object upload -This snippet demonstrates pausing and resuming an appendable object upload. +### Download multiple ranges of bytes from a single object + +This snippet downloads multiple ranges of bytes from a single object into different buffers. ```bash -python samples/snippets/zonal_buckets/storage_pause_and_resume_appendable_upload.py --bucket_name --object_name +python samples/snippets/zonal_buckets/storage_open_object_multiple_ranged_read.py --bucket_name --object_name ``` -### Tail an appendable object +### Download the entire content of an object -This snippet demonstrates tailing an appendable GCS object, similar to `tail -f`. +This snippet downloads the entire content of an object using a multi-range downloader. ```bash -python samples/snippets/zonal_buckets/storage_read_appendable_object_tail.py --bucket_name --object_name --duration +python samples/snippets/zonal_buckets/storage_open_object_read_full_object.py --bucket_name --object_name ``` + + + +### Download a range of bytes from multiple objects concurrently + +This snippet downloads a range of bytes from multiple objects concurrently. + +```bash +python samples/snippets/zonal_buckets/storage_open_multiple_objects_ranged_read.py --bucket_name --object_names +``` \ No newline at end of file