trailer

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

README

简介

Trailer就是拖车,带着小车一起跑,比喻了Trailer实际上是个进程管理器。在RULEX里面这个概念用来和外部的异构端进行交互,其内部原理用RPC实现。 1697961072043 Trailer主要用来做三方开发对接使用。比如有新设备的协议是保密或者不公开的,只提供了一套规范,此时就可以用Trailer概念来加载这个规范进来。Trailer主要针对的是设备的协议对接和开发者。开发者开发RPC协议的时候,直接规范好自己的表以及行定义,RULEX和组件交互的时候,会问他要他的规范。RULEX的用户级接口实际上就是在调用RPC的接口,权限由开发者完全控制。

开发

可参考这两个示例

Documentation

Index

Constants

View Source
const (
	Trailer_Init_FullMethodName     = "/trailer.Trailer/Init"
	Trailer_Start_FullMethodName    = "/trailer.Trailer/Start"
	Trailer_Status_FullMethodName   = "/trailer.Trailer/Status"
	Trailer_Service_FullMethodName  = "/trailer.Trailer/Service"
	Trailer_OnStream_FullMethodName = "/trailer.Trailer/OnStream"
	Trailer_Query_FullMethodName    = "/trailer.Trailer/Query"
	Trailer_Schema_FullMethodName   = "/trailer.Trailer/Schema"
	Trailer_Stop_FullMethodName     = "/trailer.Trailer/Stop"
)

Variables

View Source
var (
	ValueType_name = map[int32]string{
		0: "STRING",
		1: "NUMBER",
		2: "BOOL",
	}
	ValueType_value = map[string]int32{
		"STRING": 0,
		"NUMBER": 1,
		"BOOL":   2,
	}
)

Enum value maps for ValueType.

View Source
var (
	StatusResponse_Status_name = map[int32]string{
		0: "RUNNING",
		1: "ERROR",
		2: "STOPED",
	}
	StatusResponse_Status_value = map[string]int32{
		"RUNNING": 0,
		"ERROR":   1,
		"STOPED":  2,
	}
)

Enum value maps for StatusResponse_Status.

View Source
var ExecuteType = map[string]string{
	".jar": "JAVA",
	".exe": "EXE",
	".py":  "PYTHON",
	".js":  "NODEJS",
	".lua": "LUA",
}

* * 针对脚本语言 *

View Source
var File_trailer_proto protoreflect.FileDescriptor
View Source
var Trailer_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "trailer.Trailer",
	HandlerType: (*TrailerServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Init",
			Handler:    _Trailer_Init_Handler,
		},
		{
			MethodName: "Start",
			Handler:    _Trailer_Start_Handler,
		},
		{
			MethodName: "Status",
			Handler:    _Trailer_Status_Handler,
		},
		{
			MethodName: "Service",
			Handler:    _Trailer_Service_Handler,
		},
		{
			MethodName: "Query",
			Handler:    _Trailer_Query_Handler,
		},
		{
			MethodName: "Schema",
			Handler:    _Trailer_Schema_Handler,
		},
		{
			MethodName: "Stop",
			Handler:    _Trailer_Stop_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "OnStream",
			Handler:       _Trailer_OnStream_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "trailer.proto",
}

Trailer_ServiceDesc is the grpc.ServiceDesc for Trailer service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func AllGoods

func AllGoods() *sync.Map

* * 返回外挂MAP *

func CreateUnzipPath

func CreateUnzipPath(dir string) error

*

  • 解压文件的路径: unzip -d ./upload/TrailerGoods/GOODSQUNK3Z/ app.zip 路径下应该包含了所有解压的文件 ll ./upload/TrailerGoods/GOODSQUNK3Z
  • manifest.json
  • app.exe

*

func NewSysProcAttr

func NewSysProcAttr() *syscall.SysProcAttr

func NewWSStdInOut

func NewWSStdInOut(ps *GoodsProcess) goodsStdInOut

func RegisterTrailerServer

func RegisterTrailerServer(s grpc.ServiceRegistrar, srv TrailerServer)

func Remove

func Remove(uuid string)

从内存里删除, 删除后记得停止挂件, 通常外部配置表也要删除, 比如Sqlite

func RemoveBy

func RemoveBy(uuid, by string)

从内存里删除, 删除后记得停止挂件, 通常外部配置表也要删除, 比如Sqlite

func RemoveUnzipPath

func RemoveUnzipPath(dir string) error

* * 删除解压文件夹 rm -r ./upload/TrailerGoods/GOODSQUNK3Z *

func StartProcess

func StartProcess(goods GoodsInfo) error

* * 直接启动 *

func Stop

func Stop()

停止外挂运行时管理器, 这个要是停了基本上就是程序结束了

func StopProcess

func StopProcess(goods GoodsInfo) error

* * 直接关闭 *

func Unzip

func Unzip(zipPath string, targetDir string) error

解压缩文件到指定目录

func ValidatePackage

func ValidatePackage(mf AppManifest) error

func Zip

func Zip(files []string, targetPath string) error

* * APP包构建器, 用来解压ZIP包, 不过0.6.4暂不支持 *

压缩多个文件到指定目录

Types

type AppManifest

type AppManifest struct {
	Native     bool     `json:"native"`
	ScriptHost string   `json:"scripthost"`
	Executable string   `json:"executable"`
	Env        []string `json:"env"`
}

* * 包内部配置 *

func ReadManifestFromZip

func ReadManifestFromZip(zipPath string, targetFile string) (AppManifest, error)

type Column

type Column struct {
	Name        string    `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Type        ValueType `protobuf:"varint,2,opt,name=type,proto3,enum=trailer.ValueType" json:"type,omitempty"`
	Description string    `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	// contains filtered or unexported fields
}

列定义

func (*Column) Descriptor deprecated

func (*Column) Descriptor() ([]byte, []int)

Deprecated: Use Column.ProtoReflect.Descriptor instead.

func (*Column) GetDescription

func (x *Column) GetDescription() string

func (*Column) GetName

func (x *Column) GetName() string

func (*Column) GetType

func (x *Column) GetType() ValueType

func (*Column) ProtoMessage

func (*Column) ProtoMessage()

func (*Column) ProtoReflect

func (x *Column) ProtoReflect() protoreflect.Message

func (*Column) Reset

func (x *Column) Reset()

func (*Column) String

func (x *Column) String() string

type ColumnValue

type ColumnValue struct {
	Name  string    `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Type  ValueType `protobuf:"varint,2,opt,name=type,proto3,enum=trailer.ValueType" json:"type,omitempty"`
	Id    string    `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"`
	Value []byte    `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

查出来的数据列

func (*ColumnValue) Descriptor deprecated

func (*ColumnValue) Descriptor() ([]byte, []int)

Deprecated: Use ColumnValue.ProtoReflect.Descriptor instead.

func (*ColumnValue) GetId

func (x *ColumnValue) GetId() string

func (*ColumnValue) GetName

func (x *ColumnValue) GetName() string

func (*ColumnValue) GetType

func (x *ColumnValue) GetType() ValueType

func (*ColumnValue) GetValue

func (x *ColumnValue) GetValue() []byte

func (*ColumnValue) ProtoMessage

func (*ColumnValue) ProtoMessage()

func (*ColumnValue) ProtoReflect

func (x *ColumnValue) ProtoReflect() protoreflect.Message

func (*ColumnValue) Reset

func (x *ColumnValue) Reset()

func (*ColumnValue) String

func (x *ColumnValue) String() string

type Config

type Config struct {
	Kv []byte `protobuf:"bytes,1,opt,name=kv,proto3" json:"kv,omitempty"`
	// contains filtered or unexported fields
}

通用配置

func (*Config) Descriptor deprecated

func (*Config) Descriptor() ([]byte, []int)

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetKv

func (x *Config) GetKv() []byte

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

func (x *Config) ProtoReflect() protoreflect.Message

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

type DataRow

type DataRow struct {
	Column []*ColumnValue `protobuf:"bytes,1,rep,name=column,proto3" json:"column,omitempty"` // 一行多列
	// contains filtered or unexported fields
}

行定义

func (*DataRow) Descriptor deprecated

func (*DataRow) Descriptor() ([]byte, []int)

Deprecated: Use DataRow.ProtoReflect.Descriptor instead.

func (*DataRow) GetColumn

func (x *DataRow) GetColumn() []*ColumnValue

func (*DataRow) ProtoMessage

func (*DataRow) ProtoMessage()

func (*DataRow) ProtoReflect

func (x *DataRow) ProtoReflect() protoreflect.Message

func (*DataRow) Reset

func (x *DataRow) Reset()

func (*DataRow) String

func (x *DataRow) String() string

type DataRowsRequest

type DataRowsRequest struct {
	Query []byte `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` // SQL or other query
	// contains filtered or unexported fields
}

请求查询

func (*DataRowsRequest) Descriptor deprecated

func (*DataRowsRequest) Descriptor() ([]byte, []int)

Deprecated: Use DataRowsRequest.ProtoReflect.Descriptor instead.

func (*DataRowsRequest) GetQuery

func (x *DataRowsRequest) GetQuery() []byte

func (*DataRowsRequest) ProtoMessage

func (*DataRowsRequest) ProtoMessage()

func (*DataRowsRequest) ProtoReflect

func (x *DataRowsRequest) ProtoReflect() protoreflect.Message

func (*DataRowsRequest) Reset

func (x *DataRowsRequest) Reset()

func (*DataRowsRequest) String

func (x *DataRowsRequest) String() string

type DataRowsResponse

type DataRowsResponse struct {
	Row []*DataRow `protobuf:"bytes,1,rep,name=row,proto3" json:"row,omitempty"` // 多行
	// contains filtered or unexported fields
}

查询结果

func (*DataRowsResponse) Descriptor deprecated

func (*DataRowsResponse) Descriptor() ([]byte, []int)

Deprecated: Use DataRowsResponse.ProtoReflect.Descriptor instead.

func (*DataRowsResponse) GetRow

func (x *DataRowsResponse) GetRow() []*DataRow

func (*DataRowsResponse) ProtoMessage

func (*DataRowsResponse) ProtoMessage()

func (*DataRowsResponse) ProtoReflect

func (x *DataRowsResponse) ProtoReflect() protoreflect.Message

func (*DataRowsResponse) Reset

func (x *DataRowsResponse) Reset()

func (*DataRowsResponse) String

func (x *DataRowsResponse) String() string

type GoodsInfo

type GoodsInfo struct {
	UUID        string `json:"uuid"`
	Name        string `json:"name"`         // 进程名
	GoodsType   string `json:"goods_type"`   // LOCAL(RULEX原始设备), EXTERNAL(外部RPC设备)
	ExecuteType string `json:"execute_type"` // exe,elf,jar,py, nodejs....
	AutoStart   *bool  `json:"auto_start"`   // 是否开启自启动,目前全部是自启动
	LocalPath   string `json:"local_path"`   // TCP or Unix Socket
	NetAddr     string `json:"net_addr"`     // RPC addr
	Description string `json:"description"`  // Description text
	// Additional Args
	Args     string `json:"args"` // 使用空格分割 , such: la -al
	KilledBy string // 进程被谁干死的, 一般用来处理要不要抢救进程
}

* * 子进程的配置, 将 SocketAddr 传入 GRPC 客户端, Args 传入外挂的启动参数 * $> /test_driver Args

type GoodsProcess

type GoodsProcess struct {
	Info GoodsInfo
	// contains filtered or unexported fields
}

func Get

func Get(uuid string) *GoodsProcess

获取某个外挂

func NewGoodsProcess

func NewGoodsProcess() *GoodsProcess

func (*GoodsProcess) ConnectToRpc

func (goodsProcess *GoodsProcess) ConnectToRpc() (TrailerClient, error)

* * 尝试新建一个RPC客户端 *

func (*GoodsProcess) Pid

func (goodsProcess *GoodsProcess) Pid() int

func (*GoodsProcess) PsRunning

func (goodsProcess *GoodsProcess) PsRunning() bool

func (*GoodsProcess) Stop

func (goodsPs *GoodsProcess) Stop()

func (*GoodsProcess) StopBy

func (goodsPs *GoodsProcess) StopBy(r string)

func (GoodsProcess) String

func (g GoodsProcess) String() string

type ProcessInfo

type ProcessInfo struct {
	CPU     string `json:"cpu"`
	Memory  string `json:"memory"`
	VSZ     string `json:"vsz"`
	RSS     string `json:"rss"`
	TTY     string `json:"tty"`
	Stat    string `json:"stat"`
	Start   string `json:"start"`
	Time    string `json:"time"`
	Command string `json:"command"`
}

func RunningProcessDetail

func RunningProcessDetail(pid int) (ProcessInfo, error)

`ps` 命令的输出中各列的含义如下: 1. `%CPU`:进程的 CPU 使用率百分比。它表示进程占用 CPU 时间的百分比。 2. `%MEM`:进程的内存使用率百分比。它表示进程占用系统内存的百分比。 3. `VSZ`:进程的虚拟内存大小(以KB为单位)。它包括了进程占用的实际内存和虚拟内存,虚拟内存是物理内存和交换空间的组合。 4. `RSS`:进程的常驻内存大小(以KB为单位)。它表示实际分配给进程的物理内存。 5. `TT`:进程的终端类型,指示与进程关联的终端。 6. `STAT`:进程的状态,表示进程当前的状态。常见的状态包括 R(运行)、S(睡眠)、Z(僵尸)、T(暂停)等。 7. `STARTED`:进程的启动时间,表示进程启动的日期和时间。 8. `TIME`:进程的累积 CPU 时间,表示进程自启动以来已经占用的 CPU 时间。 9. `COMMAND`:进程的命令行,显示了启动进程的命令和参数。 这些列提供了有关正在运行的进程的重要信息,包括它们的 CPU 和内存使用情况、状态以及启动时间等。在分析和监视进程时,这些信息非常有用。

type Request

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

func (*Request) Descriptor deprecated

func (*Request) Descriptor() ([]byte, []int)

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

func (x *Request) ProtoReflect() protoreflect.Message

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

type Response

type Response struct {
	Code    int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*Response) Descriptor deprecated

func (*Response) Descriptor() ([]byte, []int)

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetCode

func (x *Response) GetCode() int32

func (*Response) GetMessage

func (x *Response) GetMessage() string

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

func (x *Response) ProtoReflect() protoreflect.Message

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

type SchemaRequest

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

请求拿表结构

func (*SchemaRequest) Descriptor deprecated

func (*SchemaRequest) Descriptor() ([]byte, []int)

Deprecated: Use SchemaRequest.ProtoReflect.Descriptor instead.

func (*SchemaRequest) ProtoMessage

func (*SchemaRequest) ProtoMessage()

func (*SchemaRequest) ProtoReflect

func (x *SchemaRequest) ProtoReflect() protoreflect.Message

func (*SchemaRequest) Reset

func (x *SchemaRequest) Reset()

func (*SchemaRequest) String

func (x *SchemaRequest) String() string

type SchemaResponse

type SchemaResponse struct {
	Code    int32     `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message string    `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	Columns []*Column `protobuf:"bytes,3,rep,name=columns,proto3" json:"columns,omitempty"`
	// contains filtered or unexported fields
}

表结构返回

func (*SchemaResponse) Descriptor deprecated

func (*SchemaResponse) Descriptor() ([]byte, []int)

Deprecated: Use SchemaResponse.ProtoReflect.Descriptor instead.

func (*SchemaResponse) GetCode

func (x *SchemaResponse) GetCode() int32

func (*SchemaResponse) GetColumns

func (x *SchemaResponse) GetColumns() []*Column

func (*SchemaResponse) GetMessage

func (x *SchemaResponse) GetMessage() string

func (*SchemaResponse) ProtoMessage

func (*SchemaResponse) ProtoMessage()

func (*SchemaResponse) ProtoReflect

func (x *SchemaResponse) ProtoReflect() protoreflect.Message

func (*SchemaResponse) Reset

func (x *SchemaResponse) Reset()

func (*SchemaResponse) String

func (x *SchemaResponse) String() string

type ServiceRequest

type ServiceRequest struct {
	Cmd  []byte `protobuf:"bytes,1,opt,name=cmd,proto3" json:"cmd,omitempty"`
	Args []byte `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty"`
	// contains filtered or unexported fields
}

func (*ServiceRequest) Descriptor deprecated

func (*ServiceRequest) Descriptor() ([]byte, []int)

Deprecated: Use ServiceRequest.ProtoReflect.Descriptor instead.

func (*ServiceRequest) GetArgs

func (x *ServiceRequest) GetArgs() []byte

func (*ServiceRequest) GetCmd

func (x *ServiceRequest) GetCmd() []byte

func (*ServiceRequest) ProtoMessage

func (*ServiceRequest) ProtoMessage()

func (*ServiceRequest) ProtoReflect

func (x *ServiceRequest) ProtoReflect() protoreflect.Message

func (*ServiceRequest) Reset

func (x *ServiceRequest) Reset()

func (*ServiceRequest) String

func (x *ServiceRequest) String() string

type ServiceResponse

type ServiceResponse struct {
	Code int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*ServiceResponse) Descriptor deprecated

func (*ServiceResponse) Descriptor() ([]byte, []int)

Deprecated: Use ServiceResponse.ProtoReflect.Descriptor instead.

func (*ServiceResponse) GetCode

func (x *ServiceResponse) GetCode() int32

func (*ServiceResponse) GetData

func (x *ServiceResponse) GetData() []byte

func (*ServiceResponse) ProtoMessage

func (*ServiceResponse) ProtoMessage()

func (*ServiceResponse) ProtoReflect

func (x *ServiceResponse) ProtoReflect() protoreflect.Message

func (*ServiceResponse) Reset

func (x *ServiceResponse) Reset()

func (*ServiceResponse) String

func (x *ServiceResponse) String() string

type StatusResponse

type StatusResponse struct {
	Status  StatusResponse_Status `protobuf:"varint,1,opt,name=status,proto3,enum=trailer.StatusResponse_Status" json:"status,omitempty"`
	Message string                `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*StatusResponse) Descriptor deprecated

func (*StatusResponse) Descriptor() ([]byte, []int)

Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead.

func (*StatusResponse) GetMessage

func (x *StatusResponse) GetMessage() string

func (*StatusResponse) GetStatus

func (x *StatusResponse) GetStatus() StatusResponse_Status

func (*StatusResponse) ProtoMessage

func (*StatusResponse) ProtoMessage()

func (*StatusResponse) ProtoReflect

func (x *StatusResponse) ProtoReflect() protoreflect.Message

func (*StatusResponse) Reset

func (x *StatusResponse) Reset()

func (*StatusResponse) String

func (x *StatusResponse) String() string

type StatusResponse_Status

type StatusResponse_Status int32
const (
	StatusResponse_RUNNING StatusResponse_Status = 0
	StatusResponse_ERROR   StatusResponse_Status = 1
	StatusResponse_STOPED  StatusResponse_Status = 2
)

func (StatusResponse_Status) Descriptor

func (StatusResponse_Status) Enum

func (StatusResponse_Status) EnumDescriptor deprecated

func (StatusResponse_Status) EnumDescriptor() ([]byte, []int)

Deprecated: Use StatusResponse_Status.Descriptor instead.

func (StatusResponse_Status) Number

func (StatusResponse_Status) String

func (x StatusResponse_Status) String() string

func (StatusResponse_Status) Type

type StreamRequest

type StreamRequest struct {
	Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*StreamRequest) Descriptor deprecated

func (*StreamRequest) Descriptor() ([]byte, []int)

Deprecated: Use StreamRequest.ProtoReflect.Descriptor instead.

func (*StreamRequest) GetData

func (x *StreamRequest) GetData() []byte

func (*StreamRequest) ProtoMessage

func (*StreamRequest) ProtoMessage()

func (*StreamRequest) ProtoReflect

func (x *StreamRequest) ProtoReflect() protoreflect.Message

func (*StreamRequest) Reset

func (x *StreamRequest) Reset()

func (*StreamRequest) String

func (x *StreamRequest) String() string

type StreamResponse

type StreamResponse struct {
	Code int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*StreamResponse) Descriptor deprecated

func (*StreamResponse) Descriptor() ([]byte, []int)

Deprecated: Use StreamResponse.ProtoReflect.Descriptor instead.

func (*StreamResponse) GetCode

func (x *StreamResponse) GetCode() int32

func (*StreamResponse) GetData

func (x *StreamResponse) GetData() []byte

func (*StreamResponse) ProtoMessage

func (*StreamResponse) ProtoMessage()

func (*StreamResponse) ProtoReflect

func (x *StreamResponse) ProtoReflect() protoreflect.Message

func (*StreamResponse) Reset

func (x *StreamResponse) Reset()

func (*StreamResponse) String

func (x *StreamResponse) String() string

type TrailerClient

type TrailerClient interface {
	// 初始化, 主要是为了传配置进去
	Init(ctx context.Context, in *Config, opts ...grpc.CallOption) (*Response, error)
	// 启动
	Start(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// 获取状态
	Status(ctx context.Context, in *Request, opts ...grpc.CallOption) (*StatusResponse, error)
	// 服务调用
	Service(ctx context.Context, in *ServiceRequest, opts ...grpc.CallOption) (*ServiceResponse, error)
	// 流数据
	OnStream(ctx context.Context, opts ...grpc.CallOption) (Trailer_OnStreamClient, error)
	// 数据查询
	Query(ctx context.Context, in *DataRowsRequest, opts ...grpc.CallOption) (*DataRowsResponse, error)
	// 数据模型
	Schema(ctx context.Context, in *SchemaRequest, opts ...grpc.CallOption) (*SchemaResponse, error)
	// 停止
	Stop(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
}

TrailerClient is the client API for Trailer service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewTrailerClient

func NewTrailerClient(cc grpc.ClientConnInterface) TrailerClient

type TrailerRuntime

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

func InitTrailerRuntime

func InitTrailerRuntime(re typex.RuleX) *TrailerRuntime

* * RULEX RPC Server 默认运行在 2588 *

type TrailerServer

type TrailerServer interface {
	// 初始化, 主要是为了传配置进去
	Init(context.Context, *Config) (*Response, error)
	// 启动
	Start(context.Context, *Request) (*Response, error)
	// 获取状态
	Status(context.Context, *Request) (*StatusResponse, error)
	// 服务调用
	Service(context.Context, *ServiceRequest) (*ServiceResponse, error)
	// 流数据
	OnStream(Trailer_OnStreamServer) error
	// 数据查询
	Query(context.Context, *DataRowsRequest) (*DataRowsResponse, error)
	// 数据模型
	Schema(context.Context, *SchemaRequest) (*SchemaResponse, error)
	// 停止
	Stop(context.Context, *Request) (*Response, error)
	// contains filtered or unexported methods
}

TrailerServer is the server API for Trailer service. All implementations must embed UnimplementedTrailerServer for forward compatibility

type Trailer_OnStreamClient

type Trailer_OnStreamClient interface {
	Send(*StreamRequest) error
	Recv() (*StreamResponse, error)
	grpc.ClientStream
}

type Trailer_OnStreamServer

type Trailer_OnStreamServer interface {
	Send(*StreamResponse) error
	Recv() (*StreamRequest, error)
	grpc.ServerStream
}

type UnimplementedTrailerServer

type UnimplementedTrailerServer struct {
}

UnimplementedTrailerServer must be embedded to have forward compatible implementations.

func (UnimplementedTrailerServer) Init

func (UnimplementedTrailerServer) OnStream

func (UnimplementedTrailerServer) Query

func (UnimplementedTrailerServer) Schema

func (UnimplementedTrailerServer) Service

func (UnimplementedTrailerServer) Start

func (UnimplementedTrailerServer) Status

func (UnimplementedTrailerServer) Stop

type UnsafeTrailerServer

type UnsafeTrailerServer interface {
	// contains filtered or unexported methods
}

UnsafeTrailerServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to TrailerServer will result in compilation errors.

type ValueType

type ValueType int32

数据列类型, 主要为了和前端JavaScript匹配,分了3类

const (
	ValueType_STRING ValueType = 0
	ValueType_NUMBER ValueType = 1
	ValueType_BOOL   ValueType = 2
)

func (ValueType) Descriptor

func (ValueType) Descriptor() protoreflect.EnumDescriptor

func (ValueType) Enum

func (x ValueType) Enum() *ValueType

func (ValueType) EnumDescriptor deprecated

func (ValueType) EnumDescriptor() ([]byte, []int)

Deprecated: Use ValueType.Descriptor instead.

func (ValueType) Number

func (x ValueType) Number() protoreflect.EnumNumber

func (ValueType) String

func (x ValueType) String() string

func (ValueType) Type

Jump to

Keyboard shortcuts

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