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

Service/Storage Config Support #723

Closed
Xuanwo opened this issue Aug 25, 2021 · 1 comment
Closed

Service/Storage Config Support #723

Xuanwo opened this issue Aug 25, 2021 · 1 comment

Comments

@Xuanwo
Copy link
Contributor

Xuanwo commented Aug 25, 2021

We have a internal struct now:

type pairServiceNew struct {
	pairs []Pair

	// Required pairs
	HasCredential bool
	Credential    string
	// Optional pairs
	HasDefaultServicePairs bool
	DefaultServicePairs    DefaultServicePairs
	HasDisable100Continue  bool
	Disable100Continue     bool
	HasEndpoint            bool
	Endpoint               string
	HasForcePathStyle      bool
	ForcePathStyle         bool
	HasHTTPClientOptions   bool
	HTTPClientOptions      *httpclient.Options
	HasServiceFeatures     bool
	ServiceFeatures        ServiceFeatures
	HasUseAccelerate       bool
	UseAccelerate          bool
	HasUseArnRegion        bool
	UseArnRegion           bool
}

Maybe we can export this struct as StorageConfig and implement following methods for it:

  • FromPairs(ps Pair...) -> parse from pairs, just like NewStorage(ps Pair...)
  • FromString(conn string) -> parse from connection string, just like NewStorageFromString(conn string)
  • Add json/toml/yaml tags (so that user can unmarshal it directly)

We need the following changes:

  • Add new function like NewStorageFromConfig(cfg StorageConfig)?
  • field HasUseAccelerate needs to be converted to internal -> hasUseAccelerate?
  • struct should be renamed to StorageConfig?
  • Extact new interface including FromPairs, FromString so that we can register it?
  • Can we keep all public API compatible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant