cep

package module
v0.0.0-...-e46f2f7 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2015 License: Apache-2.0 Imports: 4 Imported by: 0

README

cep

experimental complex event processor

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFlowAlreadyExists = fmt.Errorf("flow already exists")
)

Functions

This section is empty.

Types

type And

type And struct {
	Expressions []Expression
}

func (*And) Matches

func (a *And) Matches(event Event) bool

type Context

type Context interface {
	Unregister(id string) bool
}

type Emitter

type Emitter interface {
	OnEvent(Event) (Flow, error)
}

type Equals

type Equals struct {
	Type EventType
}

func (*Equals) Matches

func (e *Equals) Matches(event Event) bool

type Event

type Event struct {
	Time UnixTime
	Type EventType
}

type EventType

type EventType int64
const (
	Undefined EventType = iota
	Foo
	Bar
)

type Expression

type Expression interface {
	Matches(Event) bool
}

type Flow

type Flow interface {
	Id() string
	OnEvent(Context, Event) []Event
}

type FlowUnregisterFunc

type FlowUnregisterFunc func(id string) bool

type Flows

type Flows struct {
	// contains filtered or unexported fields
}

func (Flows) Register

func (f Flows) Register(flow Flow) error

func (Flows) Unregister

func (f Flows) Unregister(id string) bool

type FollowedBy

type FollowedBy struct {
	Statement *Statement
	Within    time.Duration
}

type Graph

type Graph struct {
	Emitters []Emitter
	Flows    Flows
}

func (*Graph) OnEvent

func (g *Graph) OnEvent(event Event) error

type NotEquals

type NotEquals struct {
	Type EventType
}

func (*NotEquals) Matches

func (n *NotEquals) Matches(event Event) bool

type Or

type Or struct {
	Expressions []Expression
}

func (*Or) Matches

func (o *Or) Matches(event Event) bool

type Statement

type Statement struct {
	Expression Expression
	FollowedBy *FollowedBy
	Triggers   EventType

	// may multiple instances of this statement be in effect at one time
	AllowMultiple bool
}

type StatementEmitter

type StatementEmitter struct {
	Statement Statement
}

func (*StatementEmitter) OnEvent

func (e *StatementEmitter) OnEvent(event Event) (Flow, error)

type StatementFlow

type StatementFlow struct {
	Statement *Statement
	// contains filtered or unexported fields
}

func (*StatementFlow) Id

func (s *StatementFlow) Id() string

func (*StatementFlow) OnEvent

func (s *StatementFlow) OnEvent(ctx Context, event Event) []Event

type UnixTime

type UnixTime int64

Jump to

Keyboard shortcuts

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