Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit aa2e66a

Browse filesBrowse files
committed
Updated docstring on Key.rename() with a warning.
I have a pending request to the GCS team asking if this is a reasonable thing to have exposed, however based on our conversations in #99 and #224 it seems that it needs to exist regardless (if we don't provide it, people will just do this on their own). That said, we need to be clear about what's happening under the hood in the short part of the docstring. If someone is frequently "renaming" 5TB objects (that's the maximum size currently), this could actually change their bill a lot and make the GCS API do some ridiculous amounts of work. For small objects this shouldn't really be a problem.
1 parent c3391be commit aa2e66a
Copy full SHA for aa2e66a

File tree

Expand file treeCollapse file tree

1 file changed

+8
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-1
lines changed

‎gcloud/storage/key.py

Copy file name to clipboardExpand all lines: gcloud/storage/key.py
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,17 @@ def exists(self):
134134
return self.bucket.get_key(self.name) is not None
135135

136136
def rename(self, new_name):
137-
"""Renames this key.
137+
"""Renames this key using copy and delete operations.
138138
139139
Effectively, copies key to the same bucket with a new name, then
140140
deletes the key.
141+
142+
.. warning::
143+
This method will first duplicate the data
144+
and then delete the old key.
145+
This means that with very large objects
146+
renaming could be a very (temporarily) costly
147+
or a very slow operation.
141148
142149
:type new_name: string
143150
:param new_name: The new name for this key.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.