registry

package
v0.5.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Discovery

type Discovery interface {
	GetService(ctx context.Context, serviceName string) ([]*ServiceInstance, error)
	Watch(ctx context.Context, serviceName string) (Watcher, error)
}

type Registrar

type Registrar interface {
	Register(ctx context.Context, service *ServiceInstance) error
	Deregister(ctx context.Context, service *ServiceInstance) error
}

type ServiceInstance

type ServiceInstance struct {
	ID        string            `json:"id"`        //注册到注册中心的服务id
	Name      string            `json:"name"`      //服务名称
	Version   string            `json:"version"`   //服务版本
	Metadata  map[string]string `json:"metadata"`  //服务元数据
	Endpoints []string          `json:"endpoints"` //http://127.0.0.1:8000 ,grpc://127.0.0.1:9000
}

type Watcher

type Watcher interface {
	Next() ([]*ServiceInstance, error) //1. 第一次监听时,如果服务实例列表不为空,则返回服务实例列表。2. 如果服务实例发生变化,则返回服务实例列表。3. 如果上面两种情况都不满足,则会阻塞到context deadline或者cancel
	Stop() error
}

Directories

Path Synopsis
Package kuberegistry registry simply implements the Kubernetes-based Registry
Package kuberegistry registry simply implements the Kubernetes-based Registry

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL