Skip to content

Commit

Permalink
Making lib/backend/client.getFactory public
Browse files Browse the repository at this point in the history
Mainly to allow writing "wrapper" custom backends, see eg
#278 (comment)
  • Loading branch information
wk8 committed Oct 18, 2020
1 parent e435b83 commit bc73e63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/backend/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ func Register(name string, factory ClientFactory) {
_factories[name] = factory
}

// getFactory returns backend client factory given client name.
func getFactory(name string) (ClientFactory, error) {
// GetFactory returns backend client factory given client name.
// This function should stay public to allow for wrapper custom backends.
func GetFactory(name string) (ClientFactory, error) {
factory, ok := _factories[name]
if !ok {
return nil, fmt.Errorf("no backend client defined with name %s", name)
Expand Down
2 changes: 1 addition & 1 deletion lib/backend/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func NewManager(configs []Config, auth AuthConfig) (*Manager, error) {
var backendConfig interface{}
for name, backendConfig = range config.Backend { // Pull the only key/value out of map
}
factory, err := getFactory(name)
factory, err := GetFactory(name)
if err != nil {
return nil, fmt.Errorf("get backend client factory: %s", err)
}
Expand Down

0 comments on commit bc73e63

Please sign in to comment.