Skip to content

Commit bed5bc1

Browse files
committed
Added comments for clarity
1 parent 83581b2 commit bed5bc1

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

gcsfs/core.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,6 +2074,10 @@ def _convert_fixed_key_metadata(metadata, *, from_google=False):
20742074

20752075

20762076
async def upload_chunk(fs, location, data, offset, size, content_type):
2077+
"""
2078+
Uploads a chunk of data. This function has a conditional path to support
2079+
experimental features for Zonal buckets to append data using gRPC.
2080+
"""
20772081
from google.cloud.storage._experimental.asyncio.async_appendable_object_writer import (
20782082
AsyncAppendableObjectWriter,
20792083
)
@@ -2114,6 +2118,11 @@ async def initiate_upload(
21142118
mode="overwrite",
21152119
kms_key_name=None,
21162120
):
2121+
"""
2122+
Initiates a resumable upload. This function has a conditional path to support
2123+
experimental features for Zonal buckets to append data using gRPC, returning an
2124+
"AsyncAppendableObjectWriter" instance as location.
2125+
"""
21172126
from .extended_gcsfs import ExtendedGcsFileSystem
21182127
from .extended_gcsfs import initiate_upload as ext_initiate_upload
21192128

@@ -2164,6 +2173,10 @@ async def simple_upload(
21642173
mode="overwrite",
21652174
kms_key_name=None,
21662175
):
2176+
"""
2177+
Performs a simple, single-request upload. This function has a conditional path to support
2178+
experimental features for Zonal buckets to upload data using gRPC.
2179+
"""
21672180
from .extended_gcsfs import ExtendedGcsFileSystem
21682181
from .extended_gcsfs import simple_upload as ext_simple_upload
21692182

gcsfs/extended_gcsfs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ async def _cat_file(self, path, start=None, end=None, mrd=None, **kwargs):
252252

253253
async def upload_chunk(fs, location, data, offset, size, content_type):
254254
raise NotImplementedError(
255-
"upload_chunk is not implemented yet for ExtendedGcsFileSystem. Please use write() instead."
255+
"upload_chunk is not implemented yet for Zonal experimental feature. Please use write() instead."
256256
)
257257

258258

@@ -267,7 +267,7 @@ async def initiate_upload(
267267
kms_key_name=None,
268268
):
269269
raise NotImplementedError(
270-
"initiate_upload is not implemented yet for ExtendedGcsFileSystem. Please use write() instead."
270+
"initiate_upload is not implemented yet for Zonal experimental feature. Please use write() instead."
271271
)
272272

273273

@@ -284,5 +284,5 @@ async def simple_upload(
284284
kms_key_name=None,
285285
):
286286
raise NotImplementedError(
287-
"simple_upload is not implemented yet for ExtendedGcsFileSystem. Please use write() instead."
287+
"simple_upload is not implemented yet for Zonal experimental feature. Please use write() instead."
288288
)

gcsfs/zonal_file.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ def _fetch_range(self, start, end):
6363
def write(self, data):
6464
"""
6565
Writes data using AsyncAppendableObjectWriter.
66+
67+
For more details, see the documentation for AsyncAppendableObjectWriter:
68+
https://github.com/googleapis/python-storage/blob/9e6fefdc24a12a9189f7119bc9119e84a061842f/google/cloud/storage/_experimental/asyncio/async_appendable_object_writer.py#L38
6669
"""
6770
if self.closed:
6871
raise ValueError("I/O operation on closed file.")
@@ -103,7 +106,7 @@ def commit(self):
103106
def discard(self):
104107
"""Discard is not applicable for Zonal Buckets. Log a warning instead."""
105108
logger.warning(
106-
"Discard is unavailable for Zonal Buckets. \
109+
"Discard is not applicable for Zonal Buckets. \
107110
Data is uploaded via streaming and cannot be cancelled."
108111
)
109112

0 commit comments

Comments
 (0)