-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
client: service discovery can watch core with auth
- Loading branch information
1 parent
c1c82a6
commit e6b5d62
Showing
12 changed files
with
113 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ import ( | |
"google.golang.org/grpc" | ||
) | ||
|
||
// RetryOptions . | ||
type RetryOptions struct { | ||
Max int | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package servicediscovery | ||
|
||
import "google.golang.org/grpc/resolver" | ||
|
||
// LBResolverBuilder for service discovery lb | ||
type LBResolverBuilder struct { | ||
updateCh chan []string | ||
} | ||
|
||
var lbResolverBuilder *LBResolverBuilder | ||
|
||
func init() { // nolint | ||
lbResolverBuilder = &LBResolverBuilder{ | ||
updateCh: make(chan []string), | ||
} | ||
resolver.Register(lbResolverBuilder) | ||
} | ||
|
||
// Scheme for interface | ||
func (b *LBResolverBuilder) Scheme() string { | ||
return "lb" | ||
} | ||
|
||
// Build for interface | ||
func (b *LBResolverBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) { | ||
return newLBResolver(cc, target.Endpoint, b.updateCh), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 1 addition & 22 deletions
23
client/service_discovery/resolver.go → client/servicediscovery/resolver.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...nt/service_discovery/service_discovery.go → client/servicediscovery/service_discovery.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
package service_discovery | ||
package servicediscovery | ||
|
||
import "context" | ||
|
||
// ServiceDiscovery notifies current core service addresses | ||
type ServiceDiscovery interface { | ||
Watch(context.Context) (<-chan []string, error) | ||
} |
Oops, something went wrong.