server

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: MIT Imports: 23 Imported by: 13

Documentation

Overview

Package server provides a GRPC based server

Index

Constants

This section is empty.

Variables

View Source
var File_pkg_server_server_proto protoreflect.FileDescriptor
View Source
var Runner_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "server.Runner",
	HandlerType: (*RunnerServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Run",
			Handler:    _Runner_Run_Handler,
		},
		{
			MethodName: "Sample",
			Handler:    _Runner_Sample_Handler,
		},
		{
			MethodName: "GetVersion",
			Handler:    _Runner_GetVersion_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "pkg/server/server.proto",
}

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

Functions

func GetProtos

func GetProtos() map[string]string

GetProtos returns the proto files. Key is filename, value is the content.

func RegisterRunnerServer

func RegisterRunnerServer(s grpc.ServiceRegistrar, srv RunnerServer)

Types

type Empty added in v0.0.8

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

func (*Empty) Descriptor deprecated added in v0.0.8

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

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) ProtoMessage added in v0.0.8

func (*Empty) ProtoMessage()

func (*Empty) ProtoReflect added in v0.0.12

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

func (*Empty) Reset added in v0.0.8

func (x *Empty) Reset()

func (*Empty) String added in v0.0.8

func (x *Empty) String() string

type HelloReply

type HelloReply struct {
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	Error   string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*HelloReply) Descriptor deprecated

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

Deprecated: Use HelloReply.ProtoReflect.Descriptor instead.

func (*HelloReply) GetError added in v0.0.9

func (x *HelloReply) GetError() string

func (*HelloReply) GetMessage

func (x *HelloReply) GetMessage() string

func (*HelloReply) ProtoMessage

func (*HelloReply) ProtoMessage()

func (*HelloReply) ProtoReflect added in v0.0.12

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

func (*HelloReply) Reset

func (x *HelloReply) Reset()

func (*HelloReply) String

func (x *HelloReply) String() string

type RunnerClient

type RunnerClient interface {
	Run(ctx context.Context, in *TestTask, opts ...grpc.CallOption) (*HelloReply, error)
	Sample(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*HelloReply, error)
	GetVersion(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*HelloReply, error)
}

RunnerClient is the client API for Runner 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 NewFakeClient added in v0.0.9

func NewFakeClient(ctx context.Context, version string, err error) (RunnerClient, func())

NewFakeClient creates a fake client

func NewRunnerClient

func NewRunnerClient(cc grpc.ClientConnInterface) RunnerClient

type RunnerServer

type RunnerServer interface {
	Run(context.Context, *TestTask) (*HelloReply, error)
	Sample(context.Context, *Empty) (*HelloReply, error)
	GetVersion(context.Context, *Empty) (*HelloReply, error)
	// contains filtered or unexported methods
}

RunnerServer is the server API for Runner service. All implementations must embed UnimplementedRunnerServer for forward compatibility

func NewRemoteServer

func NewRemoteServer() RunnerServer

NewRemoteServer creates a remote server instance

func NewServer added in v0.0.9

func NewServer(version string, err error) RunnerServer

NewServer creates a fake server

type TestTask

type TestTask struct {
	Data     string            `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	Kind     string            `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty"`
	CaseName string            `protobuf:"bytes,3,opt,name=caseName,proto3" json:"caseName,omitempty"`
	Level    string            `protobuf:"bytes,4,opt,name=level,proto3" json:"level,omitempty"`
	Env      map[string]string `` /* 147-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*TestTask) Descriptor deprecated

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

Deprecated: Use TestTask.ProtoReflect.Descriptor instead.

func (*TestTask) GetCaseName added in v0.0.8

func (x *TestTask) GetCaseName() string

func (*TestTask) GetData

func (x *TestTask) GetData() string

func (*TestTask) GetEnv added in v0.0.8

func (x *TestTask) GetEnv() map[string]string

func (*TestTask) GetKind

func (x *TestTask) GetKind() string

func (*TestTask) GetLevel added in v0.0.9

func (x *TestTask) GetLevel() string

func (*TestTask) ProtoMessage

func (*TestTask) ProtoMessage()

func (*TestTask) ProtoReflect added in v0.0.12

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

func (*TestTask) Reset

func (x *TestTask) Reset()

func (*TestTask) String

func (x *TestTask) String() string

type UnimplementedRunnerServer

type UnimplementedRunnerServer struct {
}

UnimplementedRunnerServer must be embedded to have forward compatible implementations.

func (UnimplementedRunnerServer) GetVersion added in v0.0.8

func (UnimplementedRunnerServer) Run

func (UnimplementedRunnerServer) Sample added in v0.0.12

type UniqueSlice added in v0.0.9

type UniqueSlice[T comparable] struct {
	// contains filtered or unexported fields
}

UniqueSlice represents an unique slice

func (*UniqueSlice[T]) Exist added in v0.0.9

func (s *UniqueSlice[T]) Exist(item T) bool

Exist checks if the item exist, return true it exists

func (*UniqueSlice[T]) GetAll added in v0.0.9

func (s *UniqueSlice[T]) GetAll() []T

GetAll returns all the items

func (*UniqueSlice[T]) Push added in v0.0.9

func (s *UniqueSlice[T]) Push(item T) *UniqueSlice[T]

Push pushes an item if it's not exist

type UnsafeRunnerServer

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

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

Jump to

Keyboard shortcuts

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