Documentation ¶
Overview ¶
Package polaris implements service Registry and Discovery using polaris.
Index ¶
- func New(provider polaris.ProviderAPI, consumer polaris.ConsumerAPI, opts ...Option) gsvc.Registry
- func NewWithConfig(conf config.Configuration, opts ...Option) gsvc.Registry
- type Option
- func WithHealthy(healthy bool) Option
- func WithIsolate(isolate bool) Option
- func WithLogger(logger glog.ILogger) Option
- func WithNamespace(namespace string) Option
- func WithProtocol(protocol string) Option
- func WithRetryCount(retryCount int) Option
- func WithServiceToken(serviceToken string) Option
- func WithTTL(TTL int) Option
- func WithTimeout(timeout time.Duration) Option
- func WithWeight(weight int) Option
- type Registry
- func (r *Registry) Deregister(ctx context.Context, service gsvc.Service) error
- func (r *Registry) Register(ctx context.Context, service gsvc.Service) (gsvc.Service, error)
- func (r *Registry) Search(ctx context.Context, in gsvc.SearchInput) ([]gsvc.Service, error)
- func (r *Registry) Watch(ctx context.Context, key string) (gsvc.Watcher, error)
- type Service
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewWithConfig ¶
func NewWithConfig(conf config.Configuration, opts ...Option) gsvc.Registry
NewWithConfig new a registry with config.
Types ¶
type Option ¶
type Option func(o *options)
Option The option is a polaris option.
func WithNamespace ¶
WithNamespace with the Namespace option.
func WithProtocol ¶
WithProtocol with the Protocol option.
func WithRetryCount ¶
WithRetryCount with RetryCount option.
func WithServiceToken ¶
WithServiceToken with ServiceToken option.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is polaris registry.
func (*Registry) Deregister ¶
Deregister the registration.
type Service ¶
type Service struct { gsvc.Service // Common service object. ID string // ID is the unique instance ID as registered, for some registrar server. }
Service for wrapping gsvc.Server and extends extra attributes for polaris purpose.
type Watcher ¶
type Watcher struct { ServiceName string Namespace string Ctx context.Context Cancel context.CancelFunc Channel <-chan model.SubScribeEvent ServiceInstances []gsvc.Service }
Watcher is a service watcher.
Click to show internal directories.
Click to hide internal directories.