Skip to content

Commit

Permalink
enhancement: add changelog and simplify registry package
Browse files Browse the repository at this point in the history
  • Loading branch information
fschade committed Jun 6, 2023
1 parent 458c6e4 commit e275423
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 35 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/client-selector-pool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: client selector pool

Add the ability to use iterable client pools for the grpc service communication,
the underlying grpc client and connection is fetched randomly from the available services.

https://github.com/cs3org/reva/pull/3939
13 changes: 13 additions & 0 deletions pkg/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package registry

import (
mRegistry "go-micro.dev/v4/registry"
"go-micro.dev/v4/selector"
)

var (
Expand All @@ -37,6 +38,18 @@ func Init(nRegistry mRegistry.Registry) error {
return nil
}

// GetRegistry exposes the registry
func GetRegistry() mRegistry.Registry {
return gRegistry
}

// GetNodeAddress returns a random address from the service nodes
func GetNodeAddress(services []*mRegistry.Service) (string, error) {
next := selector.Random(services)
node, err := next()
if err != nil {
return "", err
}

return node.Address, nil
}
35 changes: 0 additions & 35 deletions pkg/registry/service.go

This file was deleted.

0 comments on commit e275423

Please sign in to comment.