Skip to content
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

GCS provider #5

Open
joe-getcouragenow opened this issue Jan 18, 2021 · 1 comment
Open

GCS provider #5

joe-getcouragenow opened this issue Jan 18, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@joe-getcouragenow
Copy link

Would like to add a Provider: GCS.

Example code: https://github.com/rudderlabs/rudder-server/blob/master/services/filemanager/gcsmanager.go

Module used:
https://pkg.go.dev/cloud.google.com/go/storage

What do you think ?

@mouuff
Copy link
Owner

mouuff commented Jan 18, 2021

Yes I guess that would work
If you would like to add a provider you just have to respect the following interface:

type Provider interface {
	Open() error
	Close() error
	GetLatestVersion() (string, error) // Get the latest version (Should be accessible even if Open() was not called)
	Walk(walkFn WalkFunc) error
	Retrieve(srcPath string, destPath string) error
}

Provider definition is here: https://github.com/mouuff/go-rocket-update/blob/master/pkg/provider/types.go#L28

The Retrieve function would be pretty much the same as here: https://github.com/rudderlabs/rudder-server/blob/master/services/filemanager/gcsmanager.go#L61

I guess the Walk function could use this method:
https://cloud.google.com/storage/docs/listing-objects#storage-list-objects-go

And the GetLatestVersion is up to you to decide, you could retrieve a VERSION file / folder or maybe use buckets or maybe GCS already has a method to do that.

And the Open and Close functions would be pretty straightforward :)

Thank you for your interest in this project

@mouuff mouuff added the enhancement New feature or request label Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants