Skip to content

Commit 2e71cbe

Browse files
authored
Merge branch 'main' into get_metadata
2 parents accac90 + 7a00dfb commit 2e71cbe

File tree

2 files changed

+86
-1
lines changed

2 files changed

+86
-1
lines changed

samples/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,15 @@ for more detailed instructions.
3434
```
3535
source <your-venv>/bin/activate
3636
```
37+
3. To run samples for [Zonal Buckets](https://github.com/googleapis/python-storage/tree/main/samples/snippets/zonal_buckets)
3738
38-
3. Install the dependencies needed to run the samples.
39+
```
40+
pip install "google-cloud-storage[grpc]"
41+
python samples/snippets/zonal_buckets/storage_create_and_write_appendable_object.py --bucket_name <BUCKET_NAME> --object_name <OBJECT_NAME>
42+
43+
```
44+
45+
4. Install the dependencies needed to run the samples.
3946
```
4047
cd samples/snippets
4148
pip install -r requirements.txt
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Google Cloud Storage - Zonal Buckets Snippets
2+
3+
This directory contains snippets for interacting with Google Cloud Storage zonal buckets.
4+
5+
## Prerequisites
6+
7+
- A Google Cloud Platform project with the Cloud Storage API enabled.
8+
- A zonal Google Cloud Storage bucket.
9+
10+
## Running the snippets
11+
12+
### Create and write to an appendable object
13+
14+
This snippet uploads an appendable object to a zonal bucket.
15+
16+
```bash
17+
python samples/snippets/zonal_buckets/storage_create_and_write_appendable_object.py --bucket_name <bucket_name> --object_name <object_name>
18+
```
19+
20+
### Finalize an appendable object upload
21+
22+
This snippet creates, writes to, and finalizes an appendable object.
23+
24+
```bash
25+
python samples/snippets/zonal_buckets/storage_finalize_appendable_object_upload.py --bucket_name <bucket_name> --object_name <object_name>
26+
```
27+
28+
### Pause and resume an appendable object upload
29+
30+
This snippet demonstrates pausing and resuming an appendable object upload.
31+
32+
```bash
33+
python samples/snippets/zonal_buckets/storage_pause_and_resume_appendable_upload.py --bucket_name <bucket_name> --object_name <object_name>
34+
```
35+
36+
### Tail an appendable object
37+
38+
This snippet demonstrates tailing an appendable GCS object, similar to `tail -f`.
39+
40+
```bash
41+
python samples/snippets/zonal_buckets/storage_read_appendable_object_tail.py --bucket_name <bucket_name> --object_name <object_name> --duration <duration_in_seconds>
42+
```
43+
44+
45+
### Download a range of bytes from an object
46+
47+
This snippet downloads a range of bytes from an object.
48+
49+
```bash
50+
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>
51+
```
52+
53+
54+
### Download multiple ranges of bytes from a single object
55+
56+
This snippet downloads multiple ranges of bytes from a single object into different buffers.
57+
58+
```bash
59+
python samples/snippets/zonal_buckets/storage_open_object_multiple_ranged_read.py --bucket_name <bucket_name> --object_name <object_name>
60+
```
61+
62+
### Download the entire content of an object
63+
64+
This snippet downloads the entire content of an object using a multi-range downloader.
65+
66+
```bash
67+
python samples/snippets/zonal_buckets/storage_open_object_read_full_object.py --bucket_name <bucket_name> --object_name <object_name>
68+
```
69+
70+
71+
72+
### Download a range of bytes from multiple objects concurrently
73+
74+
This snippet downloads a range of bytes from multiple objects concurrently.
75+
76+
```bash
77+
python samples/snippets/zonal_buckets/storage_open_multiple_objects_ranged_read.py --bucket_name <bucket_name> --object_names <object_name_1> <object_name_2>
78+
```

0 commit comments

Comments
 (0)