Title: Should Blobs and Buckets be stateless or keep a reference to a StorageService ? · Issue #55 · googleapis/google-cloud-java · GitHub
Open Graph Title: Should Blobs and Buckets be stateless or keep a reference to a StorageService ? · Issue #55 · googleapis/google-cloud-java
X Title: Should Blobs and Buckets be stateless or keep a reference to a StorageService ? · Issue #55 · googleapis/google-cloud-java
Description: 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: StorageService storage = ... // Get a storage service (i...
Open Graph Description: 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: StorageService s...
X Description: 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: StorageServi...
Opengraph URL: https://github.com/googleapis/google-cloud-java/issues/55
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Should Blobs and Buckets be stateless or keep a reference to a StorageService ?","articleBody":"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:\n\n``` java\nStorageService storage = ... // Get a storage service (irrelevant how here)\nBucket bucket = storage.get(\"bucket-name\");\nBlob blob = storage.get(\"bucket-name\", \"blobname\");\n```\n\nThe only way to interact with these objects is by keeping a reference to the `StorageService`:\n\n``` java\nBlobReadChannel channel = storage.reader(\"bucket\", \"blob\");\n// or \nBlobReadChannel channel = storage.reader(blob); // I think?\n```\n\nThere's no way to do:\n\n``` java\nBlobReadChannel channel = blob.getReadChannel(); // Or anything like this.\n```\n\nThe 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)`.\n\nThe 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:\n\n``` java\nStorageService storageA = ... // Authenticated with read permissions only.\nStorageService storageB = ... // Authenticated with read *and* write permissions.\nBlob blobA = storageA.get(\"bucket-name\", \"blob\");\nblobA.delete(); // This should fail: blobA is tied to storageA, which has read-only permissions.\nstorageB.delete(blobA); // Should this \"override\" the `StorageService`?\n```\n\nI have no idea what the right answer is, but wanted to open the floor for discussion.\n\n/cc @aozarov @jboynes \n","author":{"url":"https://github.com/jgeewax","@type":"Person","name":"jgeewax"},"datePublished":"2015-05-12T17:33:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":13},"url":"https://github.com/55/google-cloud-java/issues/55"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6d3263a7-e4fd-277d-8d7a-12c92e02d1dc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8458:38C5E:382CD5:50C819:6A4E2E0B |
| html-safe-nonce | 396ad7007230dbfb5b69f964859be7e66a4ac3c25f5e5cd3683b84fa49d3ffa8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDU4OjM4QzVFOjM4MkNENTo1MEM4MTk6NkE0RTJFMEIiLCJ2aXNpdG9yX2lkIjoiMTYxOTk1MjA0OTY3OTM3OTk3OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 603266d61db68de735d8509455bc68227a3f62c2e6082a53bbd7b9732c25209d |
| hovercard-subject-tag | issue:75677913 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/google-cloud-java/55/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8fa60c086a3faeb208bd454da23b0e8180b0dc44e2e5faa3682d9e06669788e8/googleapis/google-cloud-java/issues/55 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8fa60c086a3faeb208bd454da23b0e8180b0dc44e2e5faa3682d9e06669788e8/googleapis/google-cloud-java/issues/55 |
| og:image:alt | 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: StorageService s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jgeewax |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/google-cloud-java git https://github.com/googleapis/google-cloud-java.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 26181278 |
| octolytics-dimension-repository_nwo | googleapis/google-cloud-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 26181278 |
| octolytics-dimension-repository_network_root_nwo | googleapis/google-cloud-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 42a6d378d7587a44c93aca255096cd66b7c8eb2d |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width