Skip to content

Commit

Permalink
Updated docstring on Key.rename() with a warning.
Browse files Browse the repository at this point in the history
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 googleapis#99 and googleapis#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.
  • Loading branch information
jgeewax committed Oct 12, 2014
1 parent c3391be commit 5d4a63a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion gcloud/storage/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,17 @@ def exists(self):
return self.bucket.get_key(self.name) is not None

def rename(self, new_name):
"""Renames this key.
"""Renames this key using copy and delete operations.
Effectively, copies key to the same bucket with a new name, then
deletes the key.
.. warning::
This method will first duplicate the data
and then delete the old key.
This means that with very large objects
renaming could be a very (temporarily) costly
or a very slow operation.
:type new_name: string
:param new_name: The new name for this key.
Expand Down

0 comments on commit 5d4a63a

Please sign in to comment.