Open joe-getcouragenow opened 3 years ago
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
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 ?