Documentation ¶
Index ¶
- Constants
- func ToMicroService(scs *model.MicroService) *registry.MicroService
- func ToMicroServiceInstance(ins *model.MicroServiceInstance) *registry.MicroServiceInstance
- func ToSCDependency(dep *registry.MicroServiceDependency) *model.MircroServiceDependencyRequest
- func ToSCInstance(msi *registry.MicroServiceInstance) *model.MicroServiceInstance
- func ToSCOptions(options registry.Options) client.Options
- func ToSCService(cs *registry.MicroService) *model.MicroService
- type CacheManager
- type ContractDiscovery
- func (r *ContractDiscovery) Close() error
- func (r *ContractDiscovery) GetMicroServicesByInterface(interfaceName string) (microService []*registry.MicroService)
- func (r *ContractDiscovery) GetSchema(microServiceID, schemaName string) ([]byte, error)
- func (r *ContractDiscovery) GetSchemaContentByInterface(interfaceName string) (schemas registry.SchemaContent)
- func (r *ContractDiscovery) GetSchemaContentByServiceName(svcName, version, appID, env string) (schemas []*registry.SchemaContent)
- type Registrator
- func (r *Registrator) AddDependencies(cDep *registry.MicroServiceDependency) error
- func (r *Registrator) AddSchemas(microServiceID, schemaName, schemaInfo string) error
- func (r *Registrator) Close() error
- func (r *Registrator) Heartbeat(microServiceID, microServiceInstanceID string) (bool, error)
- func (r *Registrator) RegisterService(ms *registry.MicroService) (string, error)
- func (r *Registrator) RegisterServiceAndInstance(cMicroService *registry.MicroService, cInstance *registry.MicroServiceInstance) (string, string, error)
- func (r *Registrator) RegisterServiceInstance(sid string, cIns *registry.MicroServiceInstance) (string, error)
- func (r *Registrator) UnRegisterMicroServiceInstance(microServiceID, microServiceInstanceID string) error
- func (r *Registrator) UpdateMicroServiceInstanceProperties(microServiceID, microServiceInstanceID string, properties map[string]string) error
- func (r *Registrator) UpdateMicroServiceInstanceStatus(microServiceID, microServiceInstanceID, status string) error
- func (r *Registrator) UpdateMicroServiceProperties(microServiceID string, properties map[string]string) error
- type ServiceDiscovery
- func (r *ServiceDiscovery) AutoSync()
- func (r *ServiceDiscovery) Close() error
- func (r *ServiceDiscovery) FindMicroServiceInstances(consumerID, microServiceName string, tags utiltags.Tags) ([]*registry.MicroServiceInstance, error)
- func (r *ServiceDiscovery) GetAllApplications() ([]string, error)
- func (r *ServiceDiscovery) GetAllMicroServices() ([]*registry.MicroService, error)
- func (r *ServiceDiscovery) GetDependentMicroServiceInstances(appID, consumerMicroServiceName, version, env string) ([]*model.MicroServiceInstance, error)
- func (r *ServiceDiscovery) GetMicroService(microServiceID string) (*registry.MicroService, error)
- func (r *ServiceDiscovery) GetMicroServiceID(appID, microServiceName, version, env string) (string, error)
- func (r *ServiceDiscovery) GetMicroServiceInstances(consumerID, providerID string) ([]*registry.MicroServiceInstance, error)
- func (r *ServiceDiscovery) WatchMicroService(selfMicroServiceID string, ...)
Constants ¶
const ( DefaultExpireTime = 0 DefaultRefreshInterval = time.Second * 30 )
constant values for default expiration time, and refresh interval
const ( InstanceIDIsExist = "instanceIdIsExist" InstanceIDIsNotExist = "instanceIdIsNotExist" )
constant values for checking instance ID status
const (
// ServiceCenter constant string
ServiceCenter = "servicecenter"
)
Variables ¶
This section is empty.
Functions ¶
func ToMicroService ¶
func ToMicroService(scs *model.MicroService) *registry.MicroService
ToMicroService assign sc micro-service to go chassis micro-service
func ToMicroServiceInstance ¶
func ToMicroServiceInstance(ins *model.MicroServiceInstance) *registry.MicroServiceInstance
ToMicroServiceInstance assign model micro-service instance parameters to registry micro-service instance parameters
func ToSCDependency ¶
func ToSCDependency(dep *registry.MicroServiceDependency) *model.MircroServiceDependencyRequest
ToSCDependency assign registry micro-service dependencies to model micro-service dependencies
func ToSCInstance ¶
func ToSCInstance(msi *registry.MicroServiceInstance) *model.MicroServiceInstance
ToSCInstance assign registry micro-service instance parameters to model micro-service instance parameters
func ToSCOptions ¶
ToSCOptions convert registry opstions into sc client options
func ToSCService ¶
func ToSCService(cs *registry.MicroService) *model.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) AddDependencies ¶
func (r *Registrator) AddDependencies(cDep *registry.MicroServiceDependency) error
AddDependencies : 注册微服务的依赖关系
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信息
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) GetDependentMicroServiceInstances ¶
func (r *ServiceDiscovery) GetDependentMicroServiceInstances(appID, consumerMicroServiceName, version, env string) ([]*model.MicroServiceInstance, error)
GetDependentMicroServiceInstances : 获取指定微服务所依赖的所有实例
func (*ServiceDiscovery) GetMicroService ¶
func (r *ServiceDiscovery) GetMicroService(microServiceID string) (*registry.MicroService, error)
GetMicroService : 根据microServiceID获取对应的微服务信息
func (*ServiceDiscovery) GetMicroServiceID ¶
func (r *ServiceDiscovery) GetMicroServiceID(appID, microServiceName, version, env string) (string, error)
GetMicroServiceID : 获取指定微服务的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(*model.MicroServiceInstanceChangedEvent))
WatchMicroService : 支持用户自调用主动监听实例变化功能