protocol

package
v0.0.0-...-ee9a62b Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginProtocol_RequestConfig_FullMethodName = "/protocol.PluginProtocol/RequestConfig"
	PluginProtocol_CallFunction_FullMethodName  = "/protocol.PluginProtocol/CallFunction"
	PluginProtocol_HeartBeat_FullMethodName     = "/protocol.PluginProtocol/HeartBeat"
	PluginProtocol_Stat_FullMethodName          = "/protocol.PluginProtocol/Stat"
)

Variables

View Source
var File_proto_protocol_proto protoreflect.FileDescriptor
View Source
var PluginProtocol_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "protocol.PluginProtocol",
	HandlerType: (*PluginProtocolServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "RequestConfig",
			Handler:    _PluginProtocol_RequestConfig_Handler,
		},
		{
			MethodName: "CallFunction",
			Handler:    _PluginProtocol_CallFunction_Handler,
		},
		{
			MethodName: "HeartBeat",
			Handler:    _PluginProtocol_HeartBeat_Handler,
		},
		{
			MethodName: "Stat",
			Handler:    _PluginProtocol_Stat_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proto/protocol.proto",
}

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

Functions

func RegisterPluginProtocolServer

func RegisterPluginProtocolServer(s grpc.ServiceRegistrar, srv PluginProtocolServer)

Types

type Client

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

func NewClient

func NewClient(addr string, remote bool, ctx context.Context, logger *zap.Logger) *Client

func (*Client) Call

func (cl *Client) Call(fncname string, strname string, params []InItem) (interface{}, error)

func (*Client) Connect

func (c *Client) Connect() error

func (*Client) ConnectionStatus

func (c *Client) ConnectionStatus() connectivity.State

func (*Client) GetConfig

func (cl *Client) GetConfig() ([]byte, error)

func (*Client) WaitConnect

func (c *Client) WaitConnect()

type ConfigResponse

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

func (*ConfigResponse) Descriptor deprecated

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

Deprecated: Use ConfigResponse.ProtoReflect.Descriptor instead.

func (*ConfigResponse) GetData

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

func (*ConfigResponse) GetSuccess

func (x *ConfigResponse) GetSuccess() bool

func (*ConfigResponse) ProtoMessage

func (*ConfigResponse) ProtoMessage()

func (*ConfigResponse) ProtoReflect

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

func (*ConfigResponse) Reset

func (x *ConfigResponse) Reset()

func (*ConfigResponse) String

func (x *ConfigResponse) String() string

type Empty

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

func (*Empty) Descriptor deprecated

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

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) ProtoReflect

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

func (*Empty) Reset

func (x *Empty) Reset()

func (*Empty) String

func (x *Empty) String() string

type ErrorMessage

type ErrorMessage 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"`
	Data    []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*ErrorMessage) Descriptor deprecated

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

Deprecated: Use ErrorMessage.ProtoReflect.Descriptor instead.

func (*ErrorMessage) GetCode

func (x *ErrorMessage) GetCode() int32

func (*ErrorMessage) GetData

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

func (*ErrorMessage) GetMessage

func (x *ErrorMessage) GetMessage() string

func (*ErrorMessage) ProtoMessage

func (*ErrorMessage) ProtoMessage()

func (*ErrorMessage) ProtoReflect

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

func (*ErrorMessage) Reset

func (x *ErrorMessage) Reset()

func (*ErrorMessage) String

func (x *ErrorMessage) String() string

type FunctionRequest

type FunctionRequest struct {
	In       []*InTypes `protobuf:"bytes,1,rep,name=in,proto3" json:"in,omitempty"`
	Function string     `protobuf:"bytes,2,opt,name=function,proto3" json:"function,omitempty"`
	Struct   string     `protobuf:"bytes,3,opt,name=struct,proto3" json:"struct,omitempty"`
	// contains filtered or unexported fields
}

func (*FunctionRequest) Descriptor deprecated

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

Deprecated: Use FunctionRequest.ProtoReflect.Descriptor instead.

func (*FunctionRequest) GetFunction

func (x *FunctionRequest) GetFunction() string

func (*FunctionRequest) GetIn

func (x *FunctionRequest) GetIn() []*InTypes

func (*FunctionRequest) GetStruct

func (x *FunctionRequest) GetStruct() string

func (*FunctionRequest) ProtoMessage

func (*FunctionRequest) ProtoMessage()

func (*FunctionRequest) ProtoReflect

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

func (*FunctionRequest) Reset

func (x *FunctionRequest) Reset()

func (*FunctionRequest) String

func (x *FunctionRequest) String() string

type FunctionResponse

type FunctionResponse struct {
	Data    []byte        `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	Success bool          `protobuf:"varint,2,opt,name=success,proto3" json:"success,omitempty"`
	Client  string        `protobuf:"bytes,3,opt,name=client,proto3" json:"client,omitempty"`
	Error   *ErrorMessage `protobuf:"bytes,4,opt,name=error,proto3,oneof" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*FunctionResponse) Descriptor deprecated

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

Deprecated: Use FunctionResponse.ProtoReflect.Descriptor instead.

func (*FunctionResponse) GetClient

func (x *FunctionResponse) GetClient() string

func (*FunctionResponse) GetData

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

func (*FunctionResponse) GetError

func (x *FunctionResponse) GetError() *ErrorMessage

func (*FunctionResponse) GetSuccess

func (x *FunctionResponse) GetSuccess() bool

func (*FunctionResponse) ProtoMessage

func (*FunctionResponse) ProtoMessage()

func (*FunctionResponse) ProtoReflect

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

func (*FunctionResponse) Reset

func (x *FunctionResponse) Reset()

func (*FunctionResponse) String

func (x *FunctionResponse) String() string

type Handler

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

func (*Handler) HandleConn

func (h *Handler) HandleConn(c context.Context, s stats.ConnStats)

HandleConn processes the Conn stats.

func (*Handler) HandleRPC

func (h *Handler) HandleRPC(c context.Context, hg stats.RPCStats)

HandleRPC processes the RPC stats.

func (*Handler) TagConn

func (*Handler) TagRPC

type InItem

type InItem struct {
	Index    int
	Type     string
	BaseData interface{}
}

func (*InItem) Populate

func (ii *InItem) Populate() *InTypes

type InTypes

type InTypes struct {
	Index int32  `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
	In    []byte `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"`
	Type  string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
	// contains filtered or unexported fields
}

func (*InTypes) Descriptor deprecated

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

Deprecated: Use InTypes.ProtoReflect.Descriptor instead.

func (*InTypes) GetIn

func (x *InTypes) GetIn() []byte

func (*InTypes) GetIndex

func (x *InTypes) GetIndex() int32

func (*InTypes) GetType

func (x *InTypes) GetType() string

func (*InTypes) ProtoMessage

func (*InTypes) ProtoMessage()

func (*InTypes) ProtoReflect

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

func (*InTypes) Reset

func (x *InTypes) Reset()

func (*InTypes) String

func (x *InTypes) String() string

type OutType

type OutType struct {
	Index int32  `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
	Out   []byte `protobuf:"bytes,2,opt,name=out,proto3" json:"out,omitempty"`
	Type  string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
	// contains filtered or unexported fields
}

func (*OutType) Descriptor deprecated

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

Deprecated: Use OutType.ProtoReflect.Descriptor instead.

func (*OutType) GetIndex

func (x *OutType) GetIndex() int32

func (*OutType) GetOut

func (x *OutType) GetOut() []byte

func (*OutType) GetType

func (x *OutType) GetType() string

func (*OutType) ProtoMessage

func (*OutType) ProtoMessage()

func (*OutType) ProtoReflect

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

func (*OutType) Reset

func (x *OutType) Reset()

func (*OutType) String

func (x *OutType) String() string

type PluginManagerInterface

type PluginManagerInterface interface {
	GenConfig() map[string]interface{}
	GetLogger() *zap.Logger
	PluginCaller(string, string, []*InTypes) any
}

type PluginProtocolClient

type PluginProtocolClient interface {
	RequestConfig(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ConfigResponse, error)
	CallFunction(ctx context.Context, in *FunctionRequest, opts ...grpc.CallOption) (*FunctionResponse, error)
	HeartBeat(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
	Stat(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*StatResponse, error)
}

PluginProtocolClient is the client API for PluginProtocol 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.

type PluginProtocolServer

type PluginProtocolServer interface {
	RequestConfig(context.Context, *Empty) (*ConfigResponse, error)
	CallFunction(context.Context, *FunctionRequest) (*FunctionResponse, error)
	HeartBeat(context.Context, *Empty) (*Empty, error)
	Stat(context.Context, *Empty) (*StatResponse, error)
	// contains filtered or unexported methods
}

PluginProtocolServer is the server API for PluginProtocol service. All implementations must embed UnimplementedPluginProtocolServer for forward compatibility

type Server

type Server struct {
	PluginProtocolServer

	UnimplementedPluginProtocolServer
	ConfigFunction func() map[string]interface{}
	Caller         func(string, string, []*InTypes) any
	// contains filtered or unexported fields
}

func NewServer

func NewServer(ltype string, socket string, p PluginManagerInterface) (Server, error)

func (Server) CallFunction

func (s Server) CallFunction(ctx context.Context, req *FunctionRequest) (*FunctionResponse, error)

func (Server) HeartBeat

func (s Server) HeartBeat(ctx context.Context, req *Empty) (*Empty, error)

func (Server) RequestConfig

func (s Server) RequestConfig(ctx context.Context, req *Empty) (*ConfigResponse, error)

func (Server) Run

func (s Server) Run() error

func (Server) Stat

func (s Server) Stat(ctx context.Context, req *Empty) (*StatResponse, error)

type StatResponse

type StatResponse struct {
	Avgresponse int32 `protobuf:"varint,1,opt,name=avgresponse,proto3" json:"avgresponse,omitempty"`
	// contains filtered or unexported fields
}

func (*StatResponse) Descriptor deprecated

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

Deprecated: Use StatResponse.ProtoReflect.Descriptor instead.

func (*StatResponse) GetAvgresponse

func (x *StatResponse) GetAvgresponse() int32

func (*StatResponse) ProtoMessage

func (*StatResponse) ProtoMessage()

func (*StatResponse) ProtoReflect

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

func (*StatResponse) Reset

func (x *StatResponse) Reset()

func (*StatResponse) String

func (x *StatResponse) String() string

type UnimplementedPluginProtocolServer

type UnimplementedPluginProtocolServer struct {
}

UnimplementedPluginProtocolServer must be embedded to have forward compatible implementations.

func (UnimplementedPluginProtocolServer) CallFunction

func (UnimplementedPluginProtocolServer) HeartBeat

func (UnimplementedPluginProtocolServer) RequestConfig

func (UnimplementedPluginProtocolServer) Stat

type UnsafePluginProtocolServer

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

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

Jump to

Keyboard shortcuts

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