Documentation
¶
Index ¶
- Constants
- func GetFilterRegistry() map[string]Filter
- func Register(f Filter)
- type APIEntry
- type Filter
- type FilterMetaSpec
- type FilterSpec
- func (s *FilterSpec) FilterSpec() interface{}
- func (s *FilterSpec) Kind() string
- func (s *FilterSpec) Name() string
- func (s *FilterSpec) Pipeline() string
- func (s *FilterSpec) Protocol() context.Protocol
- func (s *FilterSpec) RawSpec() map[string]interface{}
- func (s *FilterSpec) Super() *supervisor.Supervisor
- func (s *FilterSpec) YAMLConfig() string
- type Flow
- type HTTPFilter
- type MQTTFilter
- type MockMQTTFilter
- func (f *MockMQTTFilter) Close()
- func (m *MockMQTTFilter) DefaultSpec() interface{}
- func (f *MockMQTTFilter) Description() string
- func (m *MockMQTTFilter) HandleMQTT(ctx context.MQTTContext) *context.MQTTResult
- func (f *MockMQTTFilter) Inherit(filterSpec *FilterSpec, previousGeneration Filter)
- func (m *MockMQTTFilter) Init(filterSpec *FilterSpec)
- func (m *MockMQTTFilter) Kind() string
- func (f *MockMQTTFilter) Results() []string
- func (m *MockMQTTFilter) Status() interface{}
- type MockMQTTSpec
- type MockMQTTStatus
- type Pipeline
- func (p *Pipeline) Category() supervisor.ObjectCategory
- func (p *Pipeline) Close()
- func (p *Pipeline) DefaultSpec() interface{}
- func (p *Pipeline) HandleMQTT(ctx context.MQTTContext)
- func (p *Pipeline) Inherit(superSpec *supervisor.Spec, previousGeneration supervisor.Object)
- func (p *Pipeline) Init(superSpec *supervisor.Spec)
- func (p *Pipeline) Kind() string
- func (p *Pipeline) Status() *supervisor.Status
- type Spec
- type Status
- type TCPFilter
- type UDPFilter
Constants ¶
const ( // Category is the category of Pipeline. Category = supervisor.CategoryBusinessController // Kind is the kind of Pipeline. Kind = "Pipeline" )
Variables ¶
This section is empty.
Functions ¶
func GetFilterRegistry ¶
GetFilterRegistry get the filter registry.
Types ¶
type APIEntry ¶
type APIEntry struct {
Path string
Method string
Handler http.HandlerFunc
}
APIEntry contains filter api information
type Filter ¶
type Filter interface {
// Kind returns the unique kind name to represent itself.
Kind() string
// DefaultSpec returns the default spec.
DefaultSpec() interface{}
// Description returns the description of the filter.
Description() string
// Results returns all possible results, excluding the default result value (empty string).
Results() []string
// Init initializes the Filter.
Init(filterSpec *FilterSpec)
// Inherit also initializes the Filter.
// But it needs to handle the lifecycle of the previous generation.
// So it is Filter's responsibility to inherit and clean the previous generation.
// The http pipeline won't call Close for the previous generation.
Inherit(filterSpec *FilterSpec, previousGeneration Filter)
// Status returns its runtime status.
// It could return nil.
Status() interface{}
// Close closes itself.
Close()
}
Filter is the common interface for filters.
func MockGetFilter ¶ added in v1.5.0
MockGetFilter is used to get running filter from pipeline
type FilterMetaSpec ¶
type FilterMetaSpec struct {
Name string `yaml:"name" jsonschema:"required,format=urlname"`
Kind string `yaml:"kind" jsonschema:"required"`
Pipeline string `yaml:"-" jsonschema:"-"`
Protocol context.Protocol `yaml:"-" jsonschema:"-"`
}
FilterMetaSpec is metadata for all specs.
type FilterSpec ¶
type FilterSpec struct {
// contains filtered or unexported fields
}
FilterSpec is the universal spec for all filters.
func MockFilterSpec ¶
func MockFilterSpec(super *supervisor.Supervisor, rawSpec map[string]interface{}, yamlConfig string, meta *FilterMetaSpec, filterSpec interface{}) *FilterSpec
MockFilterSpec help to create FilterSpec for test
func NewFilterSpec ¶
func NewFilterSpec(originalRawSpec map[string]interface{}, super *supervisor.Supervisor) ( s *FilterSpec, err error)
NewFilterSpec creates a filter spec and validates it.
func (*FilterSpec) FilterSpec ¶
func (s *FilterSpec) FilterSpec() interface{}
FilterSpec returns the filter spec in its own type.
func (*FilterSpec) Pipeline ¶
func (s *FilterSpec) Pipeline() string
Pipeline returns the name of the pipeline this filter belongs to.
func (*FilterSpec) Protocol ¶
func (s *FilterSpec) Protocol() context.Protocol
Protocol return protocol for this filter
func (*FilterSpec) RawSpec ¶
func (s *FilterSpec) RawSpec() map[string]interface{}
RawSpec returns raw spec in type map[string]interface{}.
func (*FilterSpec) YAMLConfig ¶
func (s *FilterSpec) YAMLConfig() string
YAMLConfig returns the config in yaml format.
type Flow ¶
type Flow struct {
Filter string `yaml:"filter" jsonschema:"required,format=urlname"`
}
Flow controls the flow of pipeline.
type HTTPFilter ¶
type HTTPFilter interface {
Filter
// Handle handles one HTTP request, all possible results
// need be registered in Results.
HandleHTTP(context.HTTPContext) *context.HTTPResult
}
HTTPFilter is the common interface for filters to handle http traffic.
type MQTTFilter ¶
type MQTTFilter interface {
Filter
// Handle handles one MQTT request, all possible results
// need be registered in Results.
HandleMQTT(context.MQTTContext) *context.MQTTResult
}
MQTTFilter is the common interface for filters to handle mqtt traffic.
type MockMQTTFilter ¶
type MockMQTTFilter struct {
// contains filtered or unexported fields
}
MockMQTTFilter is used for test pipeline, which will count the client number of MQTTContext
func (*MockMQTTFilter) DefaultSpec ¶
func (m *MockMQTTFilter) DefaultSpec() interface{}
DefaultSpec retrun default spec of MockMQTTFilter
func (*MockMQTTFilter) Description ¶
func (f *MockMQTTFilter) Description() string
func (*MockMQTTFilter) HandleMQTT ¶
func (m *MockMQTTFilter) HandleMQTT(ctx context.MQTTContext) *context.MQTTResult
HandleMQTT handle MQTTContext
func (*MockMQTTFilter) Inherit ¶
func (f *MockMQTTFilter) Inherit(filterSpec *FilterSpec, previousGeneration Filter)
func (*MockMQTTFilter) Init ¶
func (m *MockMQTTFilter) Init(filterSpec *FilterSpec)
Init init MockMQTTFilter
func (*MockMQTTFilter) Kind ¶
func (m *MockMQTTFilter) Kind() string
Kind retrun kind of MockMQTTFilter
func (*MockMQTTFilter) Status ¶
func (m *MockMQTTFilter) Status() interface{}
Status return status of MockMQTTFilter
type MockMQTTSpec ¶
type MockMQTTSpec struct {
UserName string `yaml:"userName" jsonschema:"required"`
Password string `yaml:"password" jsonschema:"required"`
Port uint16 `yaml:"port" jsonschema:"required"`
BackendType string `yaml:"backendType" jsonschema:"required"`
EarlyStop bool `yaml:"earlyStop" jsonschema:"omitempty"`
KeysToStore []string `yaml:"keysToStore" jsonschema:"omitempty"`
ConnectKey string `yaml:"connectKey" jsonschema:"omitempty"`
}
MockMQTTSpec is spec of MockMQTTFilter
type MockMQTTStatus ¶
type MockMQTTStatus struct {
ClientCount map[string]int
ClientDisconnect map[string]struct{}
Subscribe map[string][]string
Unsubscribe map[string][]string
}
MockMQTTStatus is status of MockMQTTFilter
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline is general pipeline of Easegress
func GetPipeline ¶
GetPipeline is used to get pipeline with given name and protocol
func (*Pipeline) Category ¶
func (p *Pipeline) Category() supervisor.ObjectCategory
Category return category of pipeline
func (*Pipeline) DefaultSpec ¶
func (p *Pipeline) DefaultSpec() interface{}
DefaultSpec return default spec of pipeline
func (*Pipeline) HandleMQTT ¶
func (p *Pipeline) HandleMQTT(ctx context.MQTTContext)
HandleMQTT used to handle MQTT context
func (*Pipeline) Inherit ¶
func (p *Pipeline) Inherit(superSpec *supervisor.Spec, previousGeneration supervisor.Object)
Inherit init new pipeline based on previous pipeline
func (*Pipeline) Status ¶
func (p *Pipeline) Status() *supervisor.Status
Status return status of pipeline
type Spec ¶
type Spec struct {
Name string `yaml:"-" jsonschema:"-"`
Protocol context.Protocol `yaml:"protocol" jsonschema:"required"`
Flow []Flow `yaml:"flow" jsonschema:"omitempty"`
Filters []map[string]interface{} `yaml:"filters" jsonschema:"required"`
}
Spec describes the Pipeline.
type Status ¶
type Status struct {
Health string `yaml:"health"`
Filters map[string]interface{} `yaml:"filters"`
}
Status is the status of HTTPPipeline.