Documentation ¶
Index ¶
- Constants
- func GetServiceName(instanceID string) string
- func UniqInstanceID(serviceName string) string
- type ReadyFunc
- type Server
- func (rcs *Server) CheckRegistryBody(contentType string, reqBody []byte) error
- func (rcs *Server) CheckRegistryURL(w http.ResponseWriter, r *http.Request) error
- func (rcs *Server) Close()
- func (rcs *Server) Discovery() ([]*ServiceRegistryInfo, error)
- func (rcs *Server) DiscoveryService(serviceName string) (*ServiceRegistryInfo, error)
- func (rcs *Server) Register(serviceSpec *spec.Service, ingressReady ReadyFunc, egressReady ReadyFunc)
- func (rcs *Server) Registered() bool
- func (rcs *Server) SplitNacosServiceName(serviceName string) (string, error)
- func (rcs *Server) ToConsulCatalogService(serviceInfo *ServiceRegistryInfo) []*api.CatalogService
- func (rcs *Server) ToConsulHealthService(serviceInfo *ServiceRegistryInfo) []*api.ServiceEntry
- func (rcs *Server) ToConsulServices(serviceInfos []*ServiceRegistryInfo) map[string][]string
- func (rcs *Server) ToEurekaApp(serviceInfo *ServiceRegistryInfo) *eureka.Application
- func (rcs *Server) ToEurekaApps(serviceInfos []*ServiceRegistryInfo) *eureka.Applications
- func (rcs *Server) ToEurekaInstanceInfo(serviceInfo *ServiceRegistryInfo) *eureka.InstanceInfo
- func (rcs *Server) ToNacosInstanceInfo(serviceInfo *ServiceRegistryInfo) *model.Instance
- func (rcs *Server) ToNacosService(serviceInfo *ServiceRegistryInfo) *model.Service
- func (rcs *Server) ToNacosServiceDetail(serviceInfo *ServiceRegistryInfo) *model.ServiceDetail
- func (rcs *Server) ToNacosServiceList(serviceInfos []*ServiceRegistryInfo) *model.ServiceList
- type ServiceRegistryInfo
Constants ¶
const ( ContentTypeXML = "text/xml" ContentTypeJSON = "application/json" )
Variables ¶
This section is empty.
Functions ¶
func GetServiceName ¶
GetServiceName split instanceID by '-' then return second field as the service name
func UniqInstanceID ¶
UniqInstanceID creates a virtual uniq ID for every visible service in mesh
Types ¶
type ReadyFunc ¶
type ReadyFunc func() bool
ReadyFunc is a function to check Ingress/Egress ready to work
type Server ¶
type Server struct { // Currently we supports Eureka/Consul RegistryType string IP string // contains filtered or unexported fields }
Server handle all registry about logic
func NewRegistryCenterServer ¶
func NewRegistryCenterServer(registryType string, serviceName string, IP string, port int, instanceID string, serviceLabels map[string]string, service *service.Service) *Server
NewRegistryCenterServer creates a initialized registry center server.
func (*Server) CheckRegistryBody ¶
CheckRegistryBody tries to decode Eureka/Consul register request body according to the registry type.
func (*Server) CheckRegistryURL ¶
CheckRegistryURL tries to decode Nacos register request URL parameters.
func (*Server) Discovery ¶
func (rcs *Server) Discovery() ([]*ServiceRegistryInfo, error)
Discovery gets all services' spec and default instance(local sidecar for ever) which are visible for local service
func (*Server) DiscoveryService ¶
func (rcs *Server) DiscoveryService(serviceName string) (*ServiceRegistryInfo, error)
DiscoveryService gets one service specs with default instance
func (*Server) Register ¶
func (rcs *Server) Register(serviceSpec *spec.Service, ingressReady ReadyFunc, egressReady ReadyFunc)
Register registers itself into mesh
func (*Server) Registered ¶
Registered checks whether service registry or not.
func (*Server) SplitNacosServiceName ¶
SplitNacosServiceName gets nacos servicename in GROUP_NAME@@SERVICE_NAME format
func (*Server) ToConsulCatalogService ¶
func (rcs *Server) ToConsulCatalogService(serviceInfo *ServiceRegistryInfo) []*api.CatalogService
ToConsulCatalogService transforms service registry info to consul's service
func (*Server) ToConsulHealthService ¶
func (rcs *Server) ToConsulHealthService(serviceInfo *ServiceRegistryInfo) []*api.ServiceEntry
ToConsulHealthService transforms service registry info to consul's serviceEntry
func (*Server) ToConsulServices ¶
func (rcs *Server) ToConsulServices(serviceInfos []*ServiceRegistryInfo) map[string][]string
ToConsulServices transforms registry center's service info to map[string][]string structure
func (*Server) ToEurekaApp ¶
func (rcs *Server) ToEurekaApp(serviceInfo *ServiceRegistryInfo) *eureka.Application
ToEurekaApp transforms registry center's service info to eureka's app
func (*Server) ToEurekaApps ¶
func (rcs *Server) ToEurekaApps(serviceInfos []*ServiceRegistryInfo) *eureka.Applications
ToEurekaApps transforms registry center's service info to eureka's apps
func (*Server) ToEurekaInstanceInfo ¶
func (rcs *Server) ToEurekaInstanceInfo(serviceInfo *ServiceRegistryInfo) *eureka.InstanceInfo
ToEurekaInstanceInfo transforms service registry info to eureka's instance
func (*Server) ToNacosInstanceInfo ¶
func (rcs *Server) ToNacosInstanceInfo(serviceInfo *ServiceRegistryInfo) *model.Instance
ToNacosInstanceInfo transforms service registry info to nacos's instance
func (*Server) ToNacosService ¶
func (rcs *Server) ToNacosService(serviceInfo *ServiceRegistryInfo) *model.Service
ToNacosService transforms servie registry info to nacos's service
func (*Server) ToNacosServiceDetail ¶
func (rcs *Server) ToNacosServiceDetail(serviceInfo *ServiceRegistryInfo) *model.ServiceDetail
ToNacosServiceDetail transforms servie registry info to nacos's service
func (*Server) ToNacosServiceList ¶
func (rcs *Server) ToNacosServiceList(serviceInfos []*ServiceRegistryInfo) *model.ServiceList
ToNacosServiceList transforms registry center's service info to eureka's apps
type ServiceRegistryInfo ¶
type ServiceRegistryInfo struct { Service *spec.Service Ins *spec.ServiceInstanceSpec // indicates local egress Version int64 // tenant ETCD key version, }
ServiceRegistryInfo contains service's spec,
and its instance, which is the sidecar+egress port address