plugin

package
v0.0.0-...-b03bf0d Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsoleOutput

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

func (*ConsoleOutput) Send

func (c *ConsoleOutput) Send(msg *msg.Message)

func (*ConsoleOutput) Start

func (c *ConsoleOutput) Start()

func (*ConsoleOutput) Status

func (c *ConsoleOutput) Status() Status

func (*ConsoleOutput) Stop

func (c *ConsoleOutput) Stop()

type Filter

type Filter interface {
	Plugin
	Process(msg *msg.Message) *msg.Message
}

type HelloInput

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

func (*HelloInput) Receive

func (h *HelloInput) Receive() *msg.Message

func (*HelloInput) Start

func (h *HelloInput) Start()

func (*HelloInput) Status

func (h *HelloInput) Status() Status

func (*HelloInput) Stop

func (h *HelloInput) Stop()

type Input

type Input interface {
	Plugin
	Receive() *msg.Message
}

Input、Filter、Output三类插件接口的定义跟上一篇文章类似 这里使用Message结构体替代了原来的string,使得语义更清晰

type Output

type Output interface {
	Plugin
	Send(msg *msg.Message)
}

type Plugin

type Plugin interface {
	// 启动插件
	Start()
	// 停止插件
	Stop()
	// 返回插件当前的运行状态
	Status() Status
}

type Status

type Status uint8

插件运行状态

const (
	Stopped Status = iota
	Started
)

type UpperFilter

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

func (*UpperFilter) Process

func (u *UpperFilter) Process(msg *msg.Message) *msg.Message

func (*UpperFilter) Start

func (u *UpperFilter) Start()

func (*UpperFilter) Status

func (u *UpperFilter) Status() Status

func (*UpperFilter) Stop

func (u *UpperFilter) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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