Documentation ¶
Index ¶
- Constants
- Variables
- func GenKey(args ...interface{}) (key string)
- func Logger() log.ILogger
- func ParseKey(key string) (etcdRoot string, section string, serviceName string, serviceID int, err error)
- func ParseKeyS(key string) (etcdRoot string, section string, serviceName string, strServiceID string, ...)
- func SetLogger(l log.ILogger)
- type Cluster
- func (c *Cluster) AddWatchCallback(cb WatchCallback) (err error)
- func (c *Cluster) Close()
- func (c *Cluster) EtcdConfig() netcd.Config
- func (c *Cluster) GenConfigKey(serviceName string, serviceID int) string
- func (c *Cluster) GenConfigKeyPrefix(serviceName string) string
- func (c *Cluster) GenConfigKeyS(serviceName string, strServiceID string) string
- func (c *Cluster) GenInstanceKey(serviceName string, serviceID int) string
- func (c *Cluster) GenInstanceKeyPrefix(serviceName string) string
- func (c *Cluster) GenInstanceKeyS(serviceName string, strServiceID string) string
- func (c *Cluster) GenPayloadKey(serviceName string, serviceID int) string
- func (c *Cluster) GenPayloadKeyPrefix(serviceName string) string
- func (c *Cluster) GenPayloadKeyS(serviceName string, strServiceID string) string
- func (c *Cluster) GetGlobalConfig() (nexport.IGlobalConfig, error)
- func (c *Cluster) GetGlobalConfigKey() string
- func (c *Cluster) GetServiceConfig(serviceName string, serviceID int) (nexport.IServiceConfig, error)
- func (c *Cluster) GetServiceGlobalConfig(serviceName string) (nexport.IServiceGlobalConfig, error)
- func (c *Cluster) GetServiceGroupAllInfo(serviceName string) ([]*nservice.Info, error)
- func (c *Cluster) GetServiceInfo(serviceName string, serviceID nexport.ServiceID) (*nservice.Info, error)
- func (c *Cluster) GetServiceInfoNum(serviceName string) (num int, err error)
- func (c *Cluster) GetServiceInstance(serviceName string, serviceID nexport.ServiceID) (*nservice.Instance, error)
- func (c *Cluster) GetServiceInstanceNum(serviceName string) (num int, err error)
- func (c *Cluster) GetServicePayload(serviceName string, serviceID nexport.ServiceID) (nexport.Payload, error)
- func (c *Cluster) Init(etcdConfigFilePath string, globalConfig nexport.IClusterGlobalConfig, ...) (err error)
- func (c *Cluster) LeaseID() clientv3.LeaseID
- func (c *Cluster) ParseConfigKey(key string) (serviceName string, serviceID int, err error)
- func (c *Cluster) ParseConfigKeyS(key string) (serviceName string, strServiceID string, err error)
- func (c *Cluster) ParseInstanceKey(key string) (serviceName string, serviceID int, err error)
- func (c *Cluster) ParseInstanceKeyS(key string) (serviceName string, strServiceID string, err error)
- func (c *Cluster) ParsePayloadKey(key string) (serviceName string, serviceID int, err error)
- func (c *Cluster) ParsePayloadKeyS(key string) (serviceName string, strServiceID string, err error)
- func (c *Cluster) PutServiceInstance(serviceName string, serviceID nexport.ServiceID, instance *nservice.Instance) error
- func (c *Cluster) PutServicePayload(serviceName string, serviceID nexport.ServiceID, payload nexport.Payload) error
- func (c *Cluster) RoundRobinPickServiceInstance(serviceName string) (info *nservice.Info, err error)
- func (c *Cluster) TryLockServicePosition(serviceName string, serviceID nexport.ServiceID, instance *nservice.Instance) error
- type ServiceGroupConfig
- type ServiceGroupConfigMap
- type WatchCallback
Constants ¶
const ( KeySep = ":" SectionConfig = "config" SectionInstance = "instance" SectionPayload = "payload" )
const GlobalConfigName = "global"
Variables ¶
var C = NewCluster(nil, netcdv3.C)
var ErrCallbackIsNil = errors.New("callback is nil")
var ErrServiceGroupNotExist = errors.New("service group not exist")
var ErrServiceInfoNotExist = errors.New("service info not exist")
var ErrServiceInstanceAlreadyExist = errors.New("service instance already exist")
Functions ¶
func GenKey ¶
func GenKey(args ...interface{}) (key string)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Types ¶
type Cluster ¶
func (*Cluster) AddWatchCallback ¶
func (c *Cluster) AddWatchCallback(cb WatchCallback) (err error)
func (*Cluster) Close ¶
func (c *Cluster) Close()
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Cluster) EtcdConfig ¶
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Cluster) GenConfigKey ¶
func (*Cluster) GenConfigKeyPrefix ¶
func (*Cluster) GenConfigKeyS ¶
func (*Cluster) GenInstanceKey ¶
func (*Cluster) GenInstanceKeyPrefix ¶
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Cluster) GenInstanceKeyS ¶
func (*Cluster) GenPayloadKey ¶
func (*Cluster) GenPayloadKeyPrefix ¶
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Cluster) GenPayloadKeyS ¶
func (*Cluster) GetGlobalConfig ¶
func (c *Cluster) GetGlobalConfig() (nexport.IGlobalConfig, error)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Cluster) GetGlobalConfigKey ¶
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Cluster) GetServiceConfig ¶
func (*Cluster) GetServiceGlobalConfig ¶
func (c *Cluster) GetServiceGlobalConfig(serviceName string) (nexport.IServiceGlobalConfig, error)
func (*Cluster) GetServiceGroupAllInfo ¶
func (*Cluster) GetServiceInfo ¶
func (*Cluster) GetServiceInfoNum ¶
func (*Cluster) GetServiceInstance ¶
func (*Cluster) GetServiceInstanceNum ¶
func (*Cluster) GetServicePayload ¶
func (*Cluster) Init ¶
func (c *Cluster) Init(etcdConfigFilePath string, globalConfig nexport.IClusterGlobalConfig, serviceGroupConfigMap ServiceGroupConfigMap) (err error)
func (*Cluster) ParseConfigKey ¶
func (*Cluster) ParseConfigKeyS ¶
func (*Cluster) ParseInstanceKey ¶
func (*Cluster) ParseInstanceKeyS ¶
func (*Cluster) ParsePayloadKey ¶
func (*Cluster) ParsePayloadKeyS ¶
func (*Cluster) PutServiceInstance ¶
func (*Cluster) PutServicePayload ¶
func (*Cluster) RoundRobinPickServiceInstance ¶
type ServiceGroupConfig ¶
type ServiceGroupConfig struct { GlobalConfig nexport.IServiceGlobalConfig Config nexport.IServiceConfig }
type ServiceGroupConfigMap ¶
type ServiceGroupConfigMap = map[string]ServiceGroupConfig