Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,15 @@ for more detailed instructions.
```
source <your-venv>/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]"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The instruction pip install -e ".[grpc]" installs the google-cloud-storage package in editable mode. For users who only intend to run the samples, a non-editable installation is generally more appropriate. Removing the -e flag would install the package from the local source in a standard way, ensuring gRPC dependencies are available without setting up a development environment.

Suggested change
pip install -e ".[grpc]"
pip install ".[grpc]"

python samples/snippets/zonal_buckets/storage_create_and_write_appendable_object.py --bucket_name <BUCKET_NAME> --object_name <OBJECT_NAME>

```

4. Install the dependencies needed to run the samples.
```
cd samples/snippets
pip install -r requirements.txt
Expand Down
74 changes: 74 additions & 0 deletions samples/snippets/zonal_buckets/README.md
Original file line number Diff line number Diff line change
@@ -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 <bucket_name> --object_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 <bucket_name> --object_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 <bucket_name> --object_names <object_name_1> <object_name_2>
```

### 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 <bucket_name> --object_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 <bucket_name> --object_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 <bucket_name> --object_name <object_name> --start_byte <start_byte> --size <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 <bucket_name> --object_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 <bucket_name> --object_name <object_name> --duration <duration_in_seconds>
```