Guiding principles:
@property
def acl(self):
"""Create our ACL on demand."""
if self._acl is None:
self._acl = BucketACL(self)
return self._acl
blob = Blob('/remote/path.txt', bucket=bucket, properties=properties)
try:
blob.load() # Just metadata
except NotFound:
blob.upload_from_file(filename) # Sends metadata from properties
(this maybe screams for get_or_create(), we'll feel it out as we develop). It's unclear if it's worth making a distinction between storage.NOUN.update <--> PUT and storage.NOUN.patch <--> PATCH. (As of right now, we don't implement PUT / update anywhere.)
storage.get_all_buckets(connection=optional_connection)
and then bucket.get_all_objects(). It's unclear how the other 3 nouns (objectAccessControls, bucketAccessControls and defaultObjectAccessControls) will handle this. Right now they are handled via ObjectACL.reload() and BucketACL.reload() (a superclass of DefaultObjectACL).
@tseaver Please weigh in. This was inspired by our discussion at the end of #604.
/cc @thobrla I'd like to close #545 and focus on this (possibly broken down into sub-bugs). Does that sound OK?
Guiding principles:
but only when it involves instance creation / other local (non-network bound) behavior. For example, in
Bucket.aclthis already happens:Blob,Bucket, and*ACL(the only nouns) instances should haveload(),exists(),create(),delete(), andupdate()methods. This design gives rise to code like(this maybe screams for
get_or_create(), we'll feel it out as we develop). It's unclear if it's worth making a distinction betweenstorage.NOUN.update <--> PUTandstorage.NOUN.patch <--> PATCH. (As of right now, we don't implementPUT/updateanywhere.)exists()should usefieldsin the requests to minimize the payload.Connectionshould not be required to be bound to any object (one of the nounsBucket,ACL, orBlob) but should be an optional argument to methods which actually talk to the API.last_updatedfield to classes to indicate the last time the values were updated (from the server).and then
bucket.get_all_objects(). It's unclear how the other 3 nouns (objectAccessControls,bucketAccessControlsanddefaultObjectAccessControls) will handle this. Right now they are handled viaObjectACL.reload()andBucketACL.reload()(a superclass ofDefaultObjectACL).@tseaver Please weigh in. This was inspired by our discussion at the end of #604.
/cc @thobrla I'd like to close #545 and focus on this (possibly broken down into sub-bugs). Does that sound OK?