GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — PROPOSAL: Storage API consistency fix · Issue #632 · googleapis/google-cloud-python

PROPOSAL: Storage API consistency fix #632

New issue
Copy link
New issue
Copy link
Closed
Closed
PROPOSAL: Storage API consistency fix#632
Copy link
Assignees
lukesneeringer
Labels
api: storageIssues related to the Cloud Storage API.
Milestone
Storage Stable

Description

@dhermes
dhermes
opened on Feb 13, 2015
Issue body actions

Guiding principles:

  • Getters and setters should never make HTTP requests. Lazy loading is OK,
    but only when it involves instance creation / other local (non-network bound) behavior. For example, in Bucket.acl this already happens:
@property
def acl(self):
    """Create our ACL on demand."""
    if self._acl is None:
        self._acl = BucketACL(self)
    return self._acl
  • More generally HTTP requests should be limited to explicit method calls. This also rules out constructors loading data.
  • Blob, Bucket, and *ACL (the only nouns) instances should have load(), exists(), create(), delete(), and update() methods. This design gives rise to code like
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.)

  • exists() should use fields in the requests to minimize the payload.
  • A Connection should not be required to be bound to any object (one of the nouns Bucket, ACL, or Blob) but should be an optional argument to methods which actually talk to the API.
  • We should strongly consider adding a last_updated field to classes to indicate the last time the values were updated (from the server).
  • For list methods: List all buckets top-level, e.g.
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).

  • Implicit behavior (default project, default bucket and/or default connection) should be used wherever possible (and documented)

@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?

Activity

  1. dhermes
    added
    api: storageIssues related to the Cloud Storage API.
    on Feb 13, 2015
  2. dhermes
    added this to the Storage Stable milestone on Feb 13, 2015
  3. thobrla commented on Feb 13, 2015

    @thobrla
    thobrla
    on Feb 13, 2015
    More actions

    Closing #545 and focusing on this+sub-bugs sounds good to me; this captures the concerns I had there.

  4. dhermes commented on Feb 13, 2015

    @dhermes
    dhermes
    on Feb 13, 2015
    ContributorAuthor
    More actions

    Thanks!

  5. dhermes commented on Feb 14, 2015

    @dhermes
    dhermes
    on Feb 14, 2015
    ContributorAuthor
    More actions

    Aside: I made a list of all the 34 API methods and the corresponding code paths.

  6. dhermes
    changed the title [-]PROPOSAL: Storage API consistency fix (545)[/-] [+]PROPOSAL: Storage API consistency fix[/+] on Feb 15, 2015
  7. dhermes commented on Feb 15, 2015

    @dhermes
    dhermes
    on Feb 15, 2015
    ContributorAuthor
    More actions

    @tseaver I'd like to get moving on this soon. WDYT of the proposals?

  8. tseaver commented on Feb 15, 2015

    @tseaver
    tseaver
    on Feb 15, 2015
    Contributor
    More actions

    @dhermes I'm in "quick hit" mode today, but can review in more depth tomorrow.

  9. dhermes commented on Feb 15, 2015

    @dhermes
    dhermes
    on Feb 15, 2015
    ContributorAuthor
    More actions

    I'm in Portland mostly AFK, so next few days is fine.

  10. dhermes commented on Feb 24, 2015

    @dhermes
    dhermes
    on Feb 24, 2015
    ContributorAuthor
    More actions

    @tseaver Can we move forward on this?

  11. tseaver commented on Feb 24, 2015

    @tseaver
    tseaver
    on Feb 24, 2015
    Contributor
    More actions

    I'm not sure debate here is the right thing: this is a large set of changes, and I'm not sure what the goals are: we should be talking about them, first, before we try to plan out an implementation.

  12. dhermes commented on Feb 24, 2015

    @dhermes
    dhermes
    on Feb 24, 2015
    ContributorAuthor
    More actions

    The goal is really just making the API more usable.

    The current behavior of "sync" whenever a property is added outside a batch shouldn't be the default behavior (see #545). Most of the changes above relate to making network interaction occur more transparently.

  13. dhermes
    added a commit that references this issue on Mar 12, 2015

    Using 'fields' in Bucket.exists().

    6186059
  14. jgrahn commented on Jun 21, 2016

    @jgrahn
    jgrahn
    on Jun 21, 2016
    More actions

    Hi. Is there any progress on the part that says blob.upload_from_file(filename) # Sends metadata from properties in this issue (or is there a separate issue for it I haven't found)?

    Having to use patch() after upload_...() unfortunately has several more or less serious drawbacks:

    1. It requires the client to have credentials allowing PATCH requests, preventing immutable append-only semantics.
    2. It is not atomic, so if the PATCH operation fails, or the client fails between the calls, the data in the storage service might be left in an inconsistent state.
    3. It lacks consistency. There will be a window when the blob data has been uploaded but when metadata are still incorrect or missing, leading to potential race conditions.
    4. The metadata-generation will never be 1.

    These are currently blocking me from using gcloud-python.

    User @pdknsk seems to have provided a patch in #536. I think it would make sense implementing that even before/without having the "load(), exists(), create(), delete(), and update()" interface described in this issue.

    I'd be happy to provide a pull request if that helps.

    Reacted by Brian J Petersen
  15. pdknsk commented on Jun 21, 2016

    @pdknsk
    pdknsk
    on Jun 21, 2016 via email
    More actions
    #1185 #754
    Reacted by Josef Grahn and Ernesto Alejo
  16. lukesneeringer
    closed this as completedon Apr 19, 2017
  17. JustinBeckwith
    assigned
    lukesneeringer
    on Feb 1, 2021
  18. vchudnov-g
    added a commit that references this issue on Sep 20, 2023

    docs: Fix formatting of request arg in docstring (#632)

    9e066ce
  19. parthea
    added a commit that references this issue on Aug 21, 2025

    chore(deps): update dependency tqdm to v4.65.2 (#632)

    f60f939
  20. parthea
    added a commit that references this issue on Sep 16, 2025

    chore(deps): update dependency tqdm to v4.65.2 (#632)

    02b736c
  21. parthea
    added 5 commits that reference this issue on Nov 22, 2025

    chore(main): release 2.11.2 (#632)

    e3ffb92

    chore(python): add requirements for docs build (#632)

    ab06d47

    chore(python): exclude `grpcio==1.49.0rc1` in tests (#632)

    c0a472a

    fix(deps): Revert "fix: pin 'aoihttp < 3.7.0dev' (#634)" (#632) (#640)

    311dd6f

    chore: release 1.23.0 (#641)

    305fa93
  22. parthea
    added a commit that references this issue on Mar 2, 2026

    chore(python): Enable size-label bot (#632)

    732fdbe
  23. parthea
    added 2 commits that reference this issue on Mar 9, 2026

    chore(deps): update dependency sqlalchemy to v2.0.40 (#632)

    646df1e

    test: update iam test public bucket visibility (#632)

    d5c9ea5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @lukesneeringer
    lukesneeringer

Labels

api: storageIssues related to the Cloud Storage API.

Type

No type

Projects

No projects

    Milestone

    • Storage Stable

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.