Documentation ¶
Index ¶
- Constants
- func CircuitBreakerRuleJsonArrayParser(src []byte) (interface{}, error)
- func CircuitBreakerRulesUpdater(data interface{}) error
- func FlowRuleJsonArrayParser(src []byte) (interface{}, error)
- func FlowRulesUpdater(data interface{}) error
- func HotSpotParamRuleJsonArrayParser(src []byte) (interface{}, error)
- func HotSpotParamRulesUpdater(data interface{}) error
- func SystemRuleJsonArrayParser(src []byte) (interface{}, error)
- func SystemRulesUpdater(data interface{}) error
- type Base
- type Code
- type DataSource
- type DefaultPropertyHandler
- type Error
- type MockPropertyHandler
- type PropertyConverter
- type PropertyHandler
- type PropertyUpdater
Constants ¶
const ( OK = iota ConvertSourceError = 1 UpdatePropertyError = 2 HandleSourceError = 3 )
Variables ¶
This section is empty.
Functions ¶
func CircuitBreakerRulesUpdater ¶
func CircuitBreakerRulesUpdater(data interface{}) error
CircuitBreakerRulesUpdater load the newest []cb.Rule to downstream circuit breaker component.
func FlowRuleJsonArrayParser ¶
FlowRuleJsonArrayParser provide JSON as the default serialization for list of flow.Rule
func FlowRulesUpdater ¶
func FlowRulesUpdater(data interface{}) error
FlowRulesUpdater load the newest []flow.Rule to downstream flow component.
func HotSpotParamRuleJsonArrayParser ¶
HotSpotParamRuleJsonArrayParser decodes list of param flow rules from JSON bytes.
func HotSpotParamRulesUpdater ¶
func HotSpotParamRulesUpdater(data interface{}) error
HotSpotParamRulesUpdater loads the provided hot-spot param rules to downstream rule manager.
func SystemRuleJsonArrayParser ¶
SystemRuleJsonArrayParser provide JSON as the default serialization for list of system.Rule
func SystemRulesUpdater ¶
func SystemRulesUpdater(data interface{}) error
SystemRulesUpdater load the newest []system.Rule to downstream system component.
Types ¶
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
func (*Base) AddPropertyHandler ¶
func (b *Base) AddPropertyHandler(h PropertyHandler)
func (*Base) RemovePropertyHandler ¶
func (b *Base) RemovePropertyHandler(h PropertyHandler)
type DataSource ¶
type DataSource interface { // Add specified property handler in current datasource AddPropertyHandler(h PropertyHandler) // Remove specified property handler in current datasource RemovePropertyHandler(h PropertyHandler) // Read original data from the data source. // return source bytes if succeed to read, if not, return error when reading ReadSource() ([]byte, error) // Initialize the datasource and load initial rules // start listener to listen on dynamic source // return error if initialize failed; // once initialized, listener should recover all panic and error. Initialize() error // Close the data source. io.Closer }
The generic interface to describe the datasource Each DataSource instance listen in one property type.
type DefaultPropertyHandler ¶
type DefaultPropertyHandler struct {
// contains filtered or unexported fields
}
DefaultPropertyHandler encapsulate the Converter and updater of property. One DefaultPropertyHandler instance is to handle one property type. DefaultPropertyHandler should check whether current property is consistent with last update property converter convert the message to the specific property updater update the specific property to downstream.
func NewCircuitBreakerRulesHandler ¶
func NewCircuitBreakerRulesHandler(converter PropertyConverter) *DefaultPropertyHandler
func NewDefaultPropertyHandler ¶
func NewDefaultPropertyHandler(converter PropertyConverter, updater PropertyUpdater) *DefaultPropertyHandler
func NewSystemRulesHandler ¶
func NewSystemRulesHandler(converter PropertyConverter) *DefaultPropertyHandler
func (*DefaultPropertyHandler) Handle ¶
func (h *DefaultPropertyHandler) Handle(src []byte) error
type MockPropertyHandler ¶
func (*MockPropertyHandler) Handle ¶
func (m *MockPropertyHandler) Handle(src []byte) error
type PropertyConverter ¶
PropertyConverter func is to convert source message bytes to the specific property. the first return value: is the real property; the second return value: return nil if succeed to convert src, if not return the detailed error when convert src. if src is nil or len(src)==0, the return value is (nil,nil)
type PropertyHandler ¶
type PropertyHandler interface { // handle the current property Handle(src []byte) error // contains filtered or unexported methods }
func NewFlowRulesHandler ¶
func NewFlowRulesHandler(converter PropertyConverter) PropertyHandler
func NewHotSpotParamRulesHandler ¶
func NewHotSpotParamRulesHandler(converter PropertyConverter) PropertyHandler
type PropertyUpdater ¶
type PropertyUpdater func(data interface{}) error
PropertyUpdater func is to update the specific properties to downstream. return nil if succeed to update, if not, return the error.