flow_extionsion

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MODULE_HEALTHCHECK = "健康检查"
	MODULE_SCHEMA      = "Schema"
	MODULE_RUN         = "执行扩展节点"
)

Variables

View Source
var Cfg = new(Config)

Cfg 全局配置(需要先执行MustLoad,否则拿不到配置)

Functions

func GetGrpcContext

func GetGrpcContext(ctx context.Context, id, name string) context.Context

func Init

func Init()

Types

type App

type App interface {
	Start(ext Extension)
}

func NewApp

func NewApp() App

NewApp 创建App

type Client

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

func (*Client) Run

func (c *Client) Run(ctx context.Context) error

func (*Client) Schema

func (c *Client) Schema(ctx context.Context) error

func (*Client) Start

func (c *Client) Start(app App, extension Extension) *Client

func (*Client) Stop

func (c *Client) Stop()

type Config

type Config struct {
	Log        logger.Config `json:"log" yaml:"log"`
	FlowEngine Grpc          `json:"flowEngine" yaml:"flowEngine"`
	Extension  struct {
		Id      string `json:"id" yaml:"id"`
		Name    string `json:"name" yaml:"name"`
		Timeout uint   `json:"timeout" yaml:"timeout"`
	} `json:"extension" yaml:"extension"`
	Pprof struct {
		Enable bool   `json:"enable" yaml:"enable"`
		Host   string `json:"host" yaml:"host"`
		Port   string `json:"port" yaml:"port"`
	} `json:"pprof" yaml:"pprof"`
	EtcdConfig string           `json:"etcdConfig" yaml:"etcdConfig"`
	Etcd       etcd.Config      `json:"etcd" yaml:"etcd"`
	API        apiConfig.Config `json:"api" yaml:"api"`
}

type Extension

type Extension interface {
	// Schema
	// @description 查询schema
	// @param locale 国际化
	// @return schema "驱动配置schema"
	Schema(ctx context.Context, app App, locale string) (schema string, err error)

	// Run
	// @description 执行算法服务
	// @param input 执行参数 {} input 执行参数,应与输出的schema格式相同
	// @return result "自定义返回的格式,应与输出的schema格式相同"
	Run(ctx context.Context, app App, input []byte) (result map[string]interface{}, err error)
}

type Grpc

type Grpc struct {
	Host  string `json:"host" yaml:"host"`
	Port  int    `json:"port" yaml:"port"`
	Limit int    `json:"limit" yaml:"limit"`
}

type Request

type Request struct {
	ProjectId  string `json:"projectId,omitempty"`
	FlowId     string `json:"flowId,omitempty"`
	Job        string `json:"job,omitempty"`
	ElementId  string `json:"elementId,omitempty"`
	ElementJob string `json:"elementJob,omitempty"`
	Config     []byte `json:"config,omitempty"`
}

Jump to

Keyboard shortcuts

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