servicecenter

package
v2.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultExpireTime      = 0
	DefaultRefreshInterval = time.Second * 30
)

constant values for default expiration time, and refresh interval

View Source
const (
	InstanceIDIsExist    = "instanceIdIsExist"
	InstanceIDIsNotExist = "instanceIdIsNotExist"
)

constant values for checking instance ID status

View Source
const (
	// ServiceCenter constant string
	ServiceCenter = "servicecenter"
)

Variables

This section is empty.

Functions

func GetCriteria

func GetCriteria() []*scregistry.FindService

GetCriteria generate batch find criteria from provider cache

func GetCriteriaByService

func GetCriteriaByService(sn string) []*scregistry.FindService

GetCriteriaByService generate batch find criteria from provider cache with same service name and different app

func NewRegistrator

func NewRegistrator(options registry.Options) registry.Registrator

NewRegistrator new Service center registrator

func NewServiceDiscovery

func NewServiceDiscovery(options registry.Options) registry.ServiceDiscovery

NewServiceDiscovery new service center discovery

func RegroupInstances

RegroupInstances organize raw data to better format

func ToMicroService

func ToMicroService(scs *scregistry.MicroService) *registry.MicroService

ToMicroService assign sc micro-service to go chassis micro-service

func ToMicroServiceInstance

func ToMicroServiceInstance(ins *scregistry.MicroServiceInstance) *registry.MicroServiceInstance

ToMicroServiceInstance assign model micro-service instance parameters to registry micro-service instance parameters

func ToSCInstance

ToSCInstance assign registry micro-service instance parameters to model micro-service instance parameters

func ToSCOptions

func ToSCOptions(options registry.Options) sc.Options

ToSCOptions convert registry opstions into sc client options

func ToSCService

func ToSCService(cs *registry.MicroService) *scregistry.MicroService

ToSCService assign go chassis micro-service to the sc micro-service

Types

type CacheManager

type CacheManager struct {
	// contains filtered or unexported fields
}

CacheManager cache manager

func (*CacheManager) AutoSync

func (c *CacheManager) AutoSync()

AutoSync automatically sync the running instances

func (*CacheManager) MakeIPIndex

func (c *CacheManager) MakeIPIndex() error

MakeIPIndex make ip index if store instance metadata into tags it will be used in route management

func (*CacheManager) MakeSchemaIndex

func (c *CacheManager) MakeSchemaIndex() error

MakeSchemaIndex make schema index

type ContractDiscovery

type ContractDiscovery struct {
	Name string
	// contains filtered or unexported fields
}

ContractDiscovery to represent the object of service center to call the APIs of service center

func (*ContractDiscovery) Close

func (r *ContractDiscovery) Close() error

Close close client connection

func (*ContractDiscovery) GetMicroServicesByInterface

func (r *ContractDiscovery) GetMicroServicesByInterface(interfaceName string) (microService []*registry.MicroService)

GetMicroServicesByInterface get micro-services by interface

func (*ContractDiscovery) GetSchema

func (r *ContractDiscovery) GetSchema(microServiceID, schemaName string) ([]byte, error)

GetSchema from service center

func (*ContractDiscovery) GetSchemaContentByInterface

func (r *ContractDiscovery) GetSchemaContentByInterface(interfaceName string) (schemas registry.SchemaContent)

GetSchemaContentByInterface get schema content by interface

func (*ContractDiscovery) GetSchemaContentByServiceName

func (r *ContractDiscovery) GetSchemaContentByServiceName(svcName, version, appID, env string) (schemas []*registry.SchemaContent)

GetSchemaContentByServiceName get schema content by service name

type Registrator

type Registrator struct {
	Name string
	// contains filtered or unexported fields
}

Registrator to represent the object of service center to call the APIs of service center

func (*Registrator) AddSchemas

func (r *Registrator) AddSchemas(microServiceID, schemaName, schemaInfo string) error

AddSchemas to service center

func (*Registrator) Close

func (r *Registrator) Close() error

Close : Close all client connection.

func (*Registrator) Heartbeat

func (r *Registrator) Heartbeat(microServiceID, microServiceInstanceID string) (bool, error)

Heartbeat : Keep instance heartbeats.

func (*Registrator) RegisterService

func (r *Registrator) RegisterService(ms *registry.MicroService) (string, error)

RegisterService : 注册微服务

func (*Registrator) RegisterServiceAndInstance

func (r *Registrator) RegisterServiceAndInstance(cMicroService *registry.MicroService, cInstance *registry.MicroServiceInstance) (string, string, error)

RegisterServiceAndInstance : 注册微服务

func (*Registrator) RegisterServiceInstance

func (r *Registrator) RegisterServiceInstance(sid string, cIns *registry.MicroServiceInstance) (string, error)

RegisterServiceInstance : 注册微服务

func (*Registrator) UnRegisterMicroServiceInstance

func (r *Registrator) UnRegisterMicroServiceInstance(microServiceID, microServiceInstanceID string) error

UnRegisterMicroServiceInstance : 去注册微服务实例

func (*Registrator) UpdateMicroServiceInstanceProperties

func (r *Registrator) UpdateMicroServiceInstanceProperties(microServiceID, microServiceInstanceID string, properties map[string]string) error

UpdateMicroServiceInstanceProperties : 更新微服务实例properties信息

func (*Registrator) UpdateMicroServiceInstanceStatus

func (r *Registrator) UpdateMicroServiceInstanceStatus(microServiceID, microServiceInstanceID, status string) error

UpdateMicroServiceInstanceStatus : 更新微服务实例状态信息

func (*Registrator) UpdateMicroServiceProperties

func (r *Registrator) UpdateMicroServiceProperties(microServiceID string, properties map[string]string) error

UpdateMicroServiceProperties 更新微服务properties信息

func (*Registrator) WSHeartbeat added in v2.4.0

func (r *Registrator) WSHeartbeat(microServiceID string, microServiceInstanceID string, callback func()) (bool, error)

WSHeartbeat : Keep instance heartbeats.

type ServiceDiscovery

type ServiceDiscovery struct {
	Name string
	// contains filtered or unexported fields
}

ServiceDiscovery to represent the object of service center to call the APIs of service center

func (*ServiceDiscovery) AutoSync

func (r *ServiceDiscovery) AutoSync()

AutoSync updating the cache manager

func (*ServiceDiscovery) Close

func (r *ServiceDiscovery) Close() error

Close : Close all websocket connection.

func (*ServiceDiscovery) FindMicroServiceInstances

func (r *ServiceDiscovery) FindMicroServiceInstances(consumerID, microServiceName string, tags utiltags.Tags) ([]*registry.MicroServiceInstance, error)

FindMicroServiceInstances find micro-service instances

func (*ServiceDiscovery) GetAllApplications

func (r *ServiceDiscovery) GetAllApplications() ([]string, error)

GetAllApplications : Get all Applications information.

func (*ServiceDiscovery) GetAllMicroServices

func (r *ServiceDiscovery) GetAllMicroServices() ([]*registry.MicroService, error)

GetAllMicroServices : Get all MicroService information.

func (*ServiceDiscovery) GetMicroService

func (r *ServiceDiscovery) GetMicroService(microServiceID string) (*registry.MicroService, error)

GetMicroService : 根据microServiceID获取对应的微服务信息

func (*ServiceDiscovery) GetMicroServiceInstances

func (r *ServiceDiscovery) GetMicroServiceInstances(consumerID, providerID string) ([]*registry.MicroServiceInstance, error)

GetMicroServiceInstances : 获取指定微服务的所有实例

func (*ServiceDiscovery) WatchMicroService

func (r *ServiceDiscovery) WatchMicroService(selfMicroServiceID string, callback func(*sc.MicroServiceInstanceChangedEvent))

WatchMicroService : 支持用户自调用主动监听实例变化功能

Jump to

Keyboard shortcuts

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