servicecenter

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: Apache-2.0 Imports: 14 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 added in v1.2.2

func GetCriteria() []*proto.FindService

GetCriteria generate batch find criteria from provider cache

func GetCriteriaByService added in v1.2.2

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

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

func NewRegistrator added in v1.1.1

func NewRegistrator(options registry.Options) registry.Registrator

NewRegistrator new Service center registrator

func NewServiceDiscovery added in v1.1.1

func NewServiceDiscovery(options registry.Options) registry.ServiceDiscovery

NewServiceDiscovery new service center discovery

func ToMicroService

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

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

func ToMicroServiceInstance

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

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

func ToSCDependency

func ToSCDependency(dep *registry.MicroServiceDependency) *client.MircroServiceDependencyRequest

ToSCDependency assign registry micro-service dependencies to model micro-service dependencies

func ToSCInstance

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

func ToSCOptions

func ToSCOptions(options registry.Options) client.Options

ToSCOptions convert registry opstions into sc client options

func ToSCService

func ToSCService(cs *registry.MicroService) *proto.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) ([]*proto.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(*client.MicroServiceInstanceChangedEvent))

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

Jump to

Keyboard shortcuts

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