Documentation
¶
Index ¶
- type CCApi
- type CCClientApi
- type CCClientReadApi
- type CCClientWriteApi
- type CCInit
- type CCServerReadApi
- type CCServerWriteApi
- type CCService
- func (cc *CCService) GetConfig(serviceID string) (map[string]ConfigItem, error)
- func (cc *CCService) GetInstanceList(serviceID string) (map[string]map[string]interface{}, error)
- func (cc *CCService) GetSchema(serviceID string) (map[string]SchemaItem, error)
- func (cc *CCService) GetServiceInfoList(serviceID string) (map[string]string, error)
- func (cc *CCService) GetServiceList() (ServiceList, error)
- func (cc *CCService) InitCCentral(etcdHost string) error
- func (cc *CCService) SetConfigItem(serviceID string, keyID string, value string) (string, error)
- func (cc *CCService) SetSchema(serviceID string, schema map[string]SchemaItem) error
- type CCentralService
- func (s *CCentralService) AddSchema(configID string, defaultValue string, valueType string, title string, ...)
- func (s *CCentralService) ForceUpdateConfig() error
- func (s *CCentralService) GetConfig(configID string) (string, error)
- func (s *CCentralService) GetConfigBool(configID string) (bool, error)
- func (s *CCentralService) GetConfigInt(configID string) (int, error)
- func (s *CCentralService) UpdateConfig() error
- type ConfigItem
- type InstanceItem
- type SchemaItem
- type Service
- type ServiceList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CCApi ¶
type CCApi interface { GetServiceInfoList(serviceID string) (map[string]string, error) GetServiceList() (ServiceList, error) InitCCentral(etcdHost string) error GetInstanceList(serviceID string) (map[string]map[string]interface{}, error) SetConfigItem(serviceID string, keyID string, value string) (string, error) GetSchema(serviceID string) (map[string]SchemaItem, error) SetSchema(serviceID string, schema map[string]SchemaItem) error GetConfig(serviceID string) (map[string]ConfigItem, error) }
CCApi - Interface for CCentral methods
type CCClientApi ¶
type CCClientApi interface { SetSchema(serviceID string, schema map[string]SchemaItem) error GetConfig(serviceID string) (map[string]ConfigItem, error) }
type CCClientReadApi ¶
type CCClientReadApi interface {
GetConfig(serviceID string) (map[string]ConfigItem, error)
}
type CCClientWriteApi ¶
type CCClientWriteApi interface {
SetSchema(serviceID string, schema map[string]SchemaItem) error
}
type CCServerReadApi ¶
type CCServerReadApi interface { GetServiceInfoList(serviceID string) (map[string]string, error) GetServiceList() (ServiceList, error) GetInstanceList(serviceID string) (map[string]map[string]interface{}, error) GetSchema(serviceID string) (map[string]SchemaItem, error) GetConfig(serviceID string) (map[string]ConfigItem, error) }
type CCServerWriteApi ¶
type CCService ¶
type CCService struct {
// contains filtered or unexported fields
}
CCService - ...
func (*CCService) GetConfig ¶
func (cc *CCService) GetConfig(serviceID string) (map[string]ConfigItem, error)
GetConfig returns full listing of service configuration
func (*CCService) GetInstanceList ¶
GetInstanceList returns full information of each running service instance
func (*CCService) GetSchema ¶
func (cc *CCService) GetSchema(serviceID string) (map[string]SchemaItem, error)
GetSchema returns configuration schema
func (*CCService) GetServiceInfoList ¶
GetServiceInfoList returns list of service shared service information reported by the clients
func (*CCService) GetServiceList ¶
func (cc *CCService) GetServiceList() (ServiceList, error)
GetServiceList returns list of available services
func (*CCService) InitCCentral ¶
InitCCentral will initialize everything required for CCentral usage
func (*CCService) SetConfigItem ¶
SetConfigItem allows changing the service configuration
type CCentralService ¶
type CCentralService struct { CheckIntervalSeconds int64 // contains filtered or unexported fields }
CCentralService is base struct for CCentral services
func InitCCentralService ¶
func InitCCentralService(cc CCApi, serviceID string) *CCentralService
InitCCentralService returns service struct for easier configuration access
func (*CCentralService) AddSchema ¶
func (s *CCentralService) AddSchema(configID string, defaultValue string, valueType string, title string, description string)
AddSchema adds a single schema item into configuration
func (*CCentralService) ForceUpdateConfig ¶
func (s *CCentralService) ForceUpdateConfig() error
ForceUpdateConfig will force configuration update
func (*CCentralService) GetConfig ¶
func (s *CCentralService) GetConfig(configID string) (string, error)
GetConfig returns single configuration option
func (*CCentralService) GetConfigBool ¶
func (s *CCentralService) GetConfigBool(configID string) (bool, error)
GetConfigBool returns boolean value of the configuration options
func (*CCentralService) GetConfigInt ¶
func (s *CCentralService) GetConfigInt(configID string) (int, error)
GetConfigInt returns integer value of the configuration options
func (*CCentralService) UpdateConfig ¶
func (s *CCentralService) UpdateConfig() error
UpdateConfig updates configuration CheckIntervalSeconds has passed since last check
type ConfigItem ¶
ConfigItem contains value and timestamp when the value was last changed
func NewConfigItem ¶
func NewConfigItem(value string, changed int64) *ConfigItem
NewConfigItem - Value container for configuration entry (based on SchemaItem)
type InstanceItem ¶
InstanceItem contains required fields for each instance
type SchemaItem ¶
type SchemaItem struct { Default string `json:"default"` Type string `json:"type"` Title string `json:"title"` Description string `json:"description"` }
SchemaItem describes single configuration schema
func NewSchemaItem ¶
func NewSchemaItem(defaultValue, itemType, title, description string) *SchemaItem
NewSchemaItem - Represents single entry in schema which contains metadata for ConfigItem
type Service ¶
type Service struct { Schema map[string]SchemaItem `json:"schema"` Config map[string]ConfigItem `json:"config"` Instances map[string]map[string]interface{} `json:"clients"` Info map[string]string `json:"info"` }
Service is a container for all service data
func NewService ¶
func NewService( schema map[string]SchemaItem, config map[string]ConfigItem, instances map[string]map[string]interface{}, info map[string]string) *Service
NewService - Create a new service container
type ServiceList ¶
type ServiceList struct {
Services []string `json:"services"`
}
ServiceList contains list of serviceIDs