-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Add gcp storage #26963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add gcp storage #26963
Conversation
} | ||
|
||
// GCPStorage returns a gcp bucket storage | ||
type GCPStorage struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this file is weirdly structured:
You start with the assertment that the GCPStorage is a storage.
Okay.
But then I'd expect to see the definition of that type immediately afterward, with all its object methods, then the child types contained within, then the error, and only then the package methods.
Or something like that, that is at least the structure I've seen the most in Gitea so far.
|
||
// Convert two responses to standard analogues | ||
// switch errResp.Code { | ||
// case "NoSuchKey": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why commented out?
if pl > count { | ||
p = p[0:count] | ||
} else { | ||
count = pl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
count = min(count, int64(len(p)))
p = p[0:count]
} | ||
|
||
func (g *gcpObject) Read(p []byte) (int, error) { | ||
c, err := g.downloadStream(p) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return directly?
offset += g.Size | ||
} | ||
if offset < 0 { | ||
return 0, fmt.Errorf("Seek: invalid offset") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return 0, fmt.Errorf("Seek: invalid offset") | |
return 0, fmt.Errorf("Seek: invalid offset to read GCP bucket: " + offset) |
|
||
// createBucket creates a new bucket in the specified location (region). | ||
func createBucket(ctx context.Context, client *storage.Client, projectID, bucketName, location string) error { | ||
bkt := client.Bucket(bucketName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bucket :=...
Would something like https://github.com/beyondstorage/go-storage help? It also helps Azure Blob Storage #25458 |
|
I'm not sure that is still actively developed. The domain was taken over by domain squatters, the only commits and PRs appear to be from dependabot. https://gocloud.dev might be one we want to look at instead, pulumi is a project that uses it. |
closing as gcp has s3 API support, so this is not needed. |
@techknowlogick perhaps we should document that. |
WIP as missing docs, tests, and probably more