interflow

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const Timeout = 10 * time.Second

Variables

This section is empty.

Functions

func GetReceiveInterflowCh

func GetReceiveInterflowCh() <-chan *HookMsg

GetReceiveInterflowCh 获取接收消息的通道

func GetSendInterflowCh

func GetSendInterflowCh() chan<- *HookMsg

GetSendInterflowCh 获取发送消息的通道

Types

type AgentInterflow added in v0.0.16

type AgentInterflow interface {
	Interflow
	// Send 把数据投递给谁
	Send(ctx context.Context, msg *HookMsg) error

	// OnlineNotify 上线通知
	OnlineNotify() error
	// OfflineNotify 下线通知
	OfflineNotify() error
}

type Callback

type Callback func(topic consts.TopicType, value []byte) error

type HookMsg

type HookMsg struct {
	// 投递任务
	Topic string `json:"topic"`
	// 投递数据
	Value []byte `json:"value"`
}

func (*HookMsg) Bytes

func (l *HookMsg) Bytes() []byte

Bytes send message to interflow

type Interflow

type Interflow interface {
	// Receive 接收投递过来的数据
	Receive() error
	// SetHandles 设置回调函数
	SetHandles(handles map[consts.TopicType]Callback) error
	// Close 关闭
	Close() error
}

type Network added in v0.0.16

type Network string
const (
	NetworkHTTP Network = "http"
	NetworkGRPC Network = "grpc"
)

func (Network) IsGRPC added in v0.0.16

func (n Network) IsGRPC() bool

IsGRPC checks whether the network is GRPC.

func (Network) IsHTTP added in v0.0.16

func (n Network) IsHTTP() bool

IsHTTP checks whether the network is HTTP.

func (Network) String added in v0.0.16

func (n Network) String() string

type ServerInterflow added in v0.0.16

type ServerInterflow interface {
	Interflow
	// SendAgent 把数据投递给谁
	SendAgent(ctx context.Context, to string, msg *HookMsg) error

	// ServerOnlineNotify 上线通知
	ServerOnlineNotify(agentUrls []string) error
	// ServerOfflineNotify 下线通知
	ServerOfflineNotify(agentUrls []string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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