api

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FAIL    = Status(0)
	SUCCESS = Status(1)
	TIMEOUT = Status(2)
	DROP    = Status(3)

	SOURCE      = Category("source")
	QUEUE       = Category("queue")
	SINK        = Category("sink")
	INTERCEPTOR = Category("interceptor")
	SELECTOR    = Category("selector")

	VERSION = "0.0.1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch interface {
	Meta() map[string]interface{}
	Events() []Event
	Release()
}

type Category

type Category string

type Component

type Component interface {
	Lifecycle
	Describable
	Config
}

type Config

type Config interface {
	Config() interface{}
}

type Consumer

type Consumer interface {
	Consume(batch Batch) Result
}

type Context

type Context interface {
	Name() string
	Category() Category
	Type() Type
	Properties() cfg.CommonCfg
}

type Describable

type Describable interface {
	Category() Category
	Type() Type
	String() string
}

type Event

type Event interface {
	Meta() Meta
	Header() map[string]interface{}
	Body() []byte
	// Fill event with meta,header,body cannot be nil
	Fill(meta Meta, header map[string]interface{}, body []byte)
	Release()
	String() string
}

type ExtensionComponent

type ExtensionComponent interface {
	DependencyInterceptors() []Interceptor
}

type Interceptor

type Interceptor interface {
	Component
}

type Invocation

type Invocation interface {
	Consumers() []Consumer
	Selector() Selector
	Event() Event
	Batch() Batch
	Queue() Queue
}

type Invoker

type Invoker interface {
	Invoke(invocation Invocation) Result
}

type Lifecycle

type Lifecycle interface {
	Init(context Context) error
	Start() error // nonblock
	Stop()
}

type Meta

type Meta interface {
	Source() string
	Get(key string) (value interface{}, exist bool)
	Set(key string, value interface{})
	String() string
	GetAll() map[string]interface{}
}

type OutFunc

type OutFunc func(batch Batch) Result

type Producer

type Producer interface {
	ProductLoop(productFunc ProductFunc)
}

type ProductFunc

type ProductFunc func(event Event) Result

thread safe

type Queue

type Queue interface {
	Component
	In(event Event)
	Out() Batch
	OutChan() chan Batch
}

type Result

type Result interface {
	Status() Status
	ChangeStatusTo(status Status)
	Error() error
}

type Selector

type Selector interface {
	Component
	Select(event Event, consumers []Consumer) []Consumer
}

type Sink

type Sink interface {
	Component
	Consumer
}

type Source

type Source interface {
	Component
	Producer
	Commit(events []Event)
}

type Status

type Status int32

type Type

type Type string

Jump to

Keyboard shortcuts

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