Right now, it looks like our Blob and Bucket objects are stateless, in that they don't keep a reference to a StorageService object. What this means is, given we have the following:
StorageServicestorage = ... // Get a storage service (irrelevant how here)Bucketbucket = storage.get("bucket-name");
Blobblob = storage.get("bucket-name", "blobname");The only way to interact with these objects is by keeping a reference to the StorageService:
BlobReadChannelchannel = storage.reader("bucket", "blob");
// or BlobReadChannelchannel = storage.reader(blob); // I think?There's no way to do:
BlobReadChannelchannel = blob.getReadChannel(); // Or anything like this.
The purpose of this issue is to discuss whether or not these objects should hold a reference to the StorageService which would make things like blob.getReadChannel() or blob.delete() possible rather than always calling storage.getReadChannel(blob) and storage.delete(blob).
The benefits of this are friendlier-looking code (IMO at least....). The downsides are (I think) serialization becomes a bit more confusing, and what does it mean to send one "StorageService-aware" Blob into another StorageService method, ie:
StorageServicestorageA = ... // Authenticated with read permissions only.StorageServicestorageB = ... // Authenticated with read *and* write permissions.BlobblobA = storageA.get("bucket-name", "blob");
blobA.delete(); // This should fail: blobA is tied to storageA, which has read-only permissions.storageB.delete(blobA); // Should this "override" the `StorageService`?I have no idea what the right answer is, but wanted to open the floor for discussion.
/cc @aozarov@jboynes
Right now, it looks like our
BlobandBucketobjects are stateless, in that they don't keep a reference to aStorageServiceobject. What this means is, given we have the following:The only way to interact with these objects is by keeping a reference to the
StorageService:There's no way to do:
The purpose of this issue is to discuss whether or not these objects should hold a reference to the
StorageServicewhich would make things likeblob.getReadChannel()orblob.delete()possible rather than always callingstorage.getReadChannel(blob)andstorage.delete(blob).The benefits of this are friendlier-looking code (IMO at least....). The downsides are (I think) serialization becomes a bit more confusing, and what does it mean to send one "
StorageService-aware"Blobinto anotherStorageServicemethod, ie:I have no idea what the right answer is, but wanted to open the floor for discussion.
/cc @aozarov@jboynes