mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-13 18:00:00 +08:00
chore: refactor config center (#4339)
Signed-off-by: kevin <wanjunfeng@gmail.com>
This commit is contained in:
@@ -15,10 +15,10 @@ type (
|
||||
|
||||
// A Subscriber is used to subscribe the given key on an etcd cluster.
|
||||
Subscriber struct {
|
||||
endpoints []string
|
||||
exclusive bool
|
||||
disablePrefix bool
|
||||
items *container
|
||||
endpoints []string
|
||||
exclusive bool
|
||||
exactMatch bool
|
||||
items *container
|
||||
}
|
||||
)
|
||||
|
||||
@@ -35,7 +35,7 @@ func NewSubscriber(endpoints []string, key string, opts ...SubOption) (*Subscrib
|
||||
}
|
||||
sub.items = newContainer(sub.exclusive)
|
||||
|
||||
if err := internal.GetRegistry().Monitor(endpoints, key, sub.items, sub.disablePrefix); err != nil {
|
||||
if err := internal.GetRegistry().Monitor(endpoints, key, sub.items, sub.exactMatch); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -60,10 +60,10 @@ func Exclusive() SubOption {
|
||||
}
|
||||
}
|
||||
|
||||
// WithDisablePrefix turn off querying using key prefixes.
|
||||
func WithDisablePrefix() SubOption {
|
||||
// WithExactMatch turn off querying using key prefixes.
|
||||
func WithExactMatch() SubOption {
|
||||
return func(sub *Subscriber) {
|
||||
sub.disablePrefix = true
|
||||
sub.exactMatch = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user