pluginapi

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntryPoint = "EntryPoint"
	NameArg    = "--name"

	HTTPMethodGET  HTTPMethod = http.MethodGet
	HTTPMethodPOST HTTPMethod = http.MethodPost
)

Variables

View Source
var ErrPluginNotHandledPath = errors.New("not found path")
View Source
var File_pluginapi_plugin_proto protoreflect.FileDescriptor
View Source
var OnstaticPlugin_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "plugin.OnstaticPlugin",
	HandlerType: (*OnstaticPluginServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Name",
			Handler:    _OnstaticPlugin_Name_Handler,
		},
		{
			MethodName: "Start",
			Handler:    _OnstaticPlugin_Start_Handler,
		},
		{
			MethodName: "Stop",
			Handler:    _OnstaticPlugin_Stop_Handler,
		},
		{
			MethodName: "Handle",
			Handler:    _OnstaticPlugin_Handle_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "pluginapi/plugin.proto",
}

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

Functions

func HandshakeConfig

func HandshakeConfig() plugin.HandshakeConfig

func Log

func Log(format string, a ...any)

func PluginMap

func PluginMap() map[string]plugin.Plugin

func RegisterOnstaticPluginServer

func RegisterOnstaticPluginServer(s grpc.ServiceRegistrar, srv OnstaticPluginServer)

func Serve

func Serve(server OnstaticPluginServer)

Serve can call from only plugin side. Host must not call this func.

func SignalChan

func SignalChan() chan os.Signal

Types

type BasicServer

type BasicServer struct {
	OnstaticPluginServer
	// contains filtered or unexported fields
}

func (*BasicServer) Handle

func (b *BasicServer) Handle(ctx context.Context, req *HandleRequest) (*HandleResponse, error)

func (*BasicServer) Name

func (*BasicServer) RegisterHandler

func (b *BasicServer) RegisterHandler(method HTTPMethod, path string, callback http.HandlerFunc)

func (*BasicServer) Start

func (*BasicServer) Stop

type EmptyMessage

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

func (*EmptyMessage) Descriptor deprecated

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

Deprecated: Use EmptyMessage.ProtoReflect.Descriptor instead.

func (*EmptyMessage) ProtoMessage

func (*EmptyMessage) ProtoMessage()

func (*EmptyMessage) ProtoReflect

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

func (*EmptyMessage) Reset

func (x *EmptyMessage) Reset()

func (*EmptyMessage) String

func (x *EmptyMessage) String() string

type HTTPMethod

type HTTPMethod string

type HandleRequest

type HandleRequest struct {
	Path   string    `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
	Header []*Header `protobuf:"bytes,2,rep,name=header,proto3" json:"header,omitempty"`
	Body   string    `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"`
	// contains filtered or unexported fields
}

func (*HandleRequest) Descriptor deprecated

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

Deprecated: Use HandleRequest.ProtoReflect.Descriptor instead.

func (*HandleRequest) GetBody

func (x *HandleRequest) GetBody() string

func (*HandleRequest) GetHeader

func (x *HandleRequest) GetHeader() []*Header

func (*HandleRequest) GetPath

func (x *HandleRequest) GetPath() string

func (*HandleRequest) ProtoMessage

func (*HandleRequest) ProtoMessage()

func (*HandleRequest) ProtoReflect

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

func (*HandleRequest) Reset

func (x *HandleRequest) Reset()

func (*HandleRequest) String

func (x *HandleRequest) String() string

type HandleResponse

type HandleResponse struct {
	Header []*Header `protobuf:"bytes,1,rep,name=header,proto3" json:"header,omitempty"`
	Body   string    `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"`
	// contains filtered or unexported fields
}

func (*HandleResponse) Descriptor deprecated

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

Deprecated: Use HandleResponse.ProtoReflect.Descriptor instead.

func (*HandleResponse) GetBody

func (x *HandleResponse) GetBody() string

func (*HandleResponse) GetHeader

func (x *HandleResponse) GetHeader() []*Header

func (*HandleResponse) ProtoMessage

func (*HandleResponse) ProtoMessage()

func (*HandleResponse) ProtoReflect

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

func (*HandleResponse) Reset

func (x *HandleResponse) Reset()

func (*HandleResponse) String

func (x *HandleResponse) String() string
type Header struct {
	Key   string   `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value []string `protobuf:"bytes,2,rep,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*Header) Descriptor deprecated

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

Deprecated: Use Header.ProtoReflect.Descriptor instead.

func (*Header) GetKey

func (x *Header) GetKey() string

func (*Header) GetValue

func (x *Header) GetValue() []string

func (*Header) ProtoMessage

func (*Header) ProtoMessage()

func (*Header) ProtoReflect

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

func (*Header) Reset

func (x *Header) Reset()

func (*Header) String

func (x *Header) String() string

type NameResponse

type NameResponse struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*NameResponse) Descriptor deprecated

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

Deprecated: Use NameResponse.ProtoReflect.Descriptor instead.

func (*NameResponse) GetName

func (x *NameResponse) GetName() string

func (*NameResponse) ProtoMessage

func (*NameResponse) ProtoMessage()

func (*NameResponse) ProtoReflect

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

func (*NameResponse) Reset

func (x *NameResponse) Reset()

func (*NameResponse) String

func (x *NameResponse) String() string

type OnstaticPluginClient

type OnstaticPluginClient interface {
	Name(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*NameResponse, error)
	Start(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*EmptyMessage, error)
	Stop(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*EmptyMessage, error)
	Handle(ctx context.Context, in *HandleRequest, opts ...grpc.CallOption) (*HandleResponse, error)
}

OnstaticPluginClient is the client API for OnstaticPlugin 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 OnstaticPluginServer

type OnstaticPluginServer interface {
	Name(context.Context, *EmptyMessage) (*NameResponse, error)
	Start(context.Context, *EmptyMessage) (*EmptyMessage, error)
	Stop(context.Context, *EmptyMessage) (*EmptyMessage, error)
	Handle(context.Context, *HandleRequest) (*HandleResponse, error)
	// contains filtered or unexported methods
}

OnstaticPluginServer is the server API for OnstaticPlugin service. All implementations must embed UnimplementedOnstaticPluginServer for forward compatibility

type UnimplementedOnstaticPluginServer

type UnimplementedOnstaticPluginServer struct {
}

UnimplementedOnstaticPluginServer must be embedded to have forward compatible implementations.

func (UnimplementedOnstaticPluginServer) Handle

func (UnimplementedOnstaticPluginServer) Name

func (UnimplementedOnstaticPluginServer) Start

func (UnimplementedOnstaticPluginServer) Stop

type UnsafeOnstaticPluginServer

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

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

Jump to

Keyboard shortcuts

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