plugin.go 721 字节
Newer Older
O
ob-robot 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
package plugins

import (
	"context"

	"github.com/oceanbase/obagent/monitor/message"
)

// Source Data sources, production data
type Source interface {
	Start(out chan<- []*message.Message) (err error)
	Stop()
}

type Input interface {
	Collect(ctx context.Context) []*message.Message
}

// Processor Process the data
type Processor interface {
	Start(in <-chan []*message.Message, out chan<- []*message.Message) (err error)
	Stop()
}

type Mapper interface {
	Map(in *message.Message) *message.Message
}

// Sink Output the data in a specified manner
type Sink interface {
	Start(in <-chan []*message.Message) error
	Stop()
}

type PipeFunc func(in <-chan []*message.Message, out chan<- []*message.Message) (err error)