Skip to content

Commit 5d4a63a

Browse 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 5d4a63a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

gcloud/storage/key.py

Lines 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)