grpc

package
v0.0.0-...-0e1d3c2 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Status_name = map[int32]string{
		0: "PENDING",
		1: "RUNNING",
		2: "FINISHED",
		3: "FAILED",
	}
	Status_value = map[string]int32{
		"PENDING":  0,
		"RUNNING":  1,
		"FINISHED": 2,
		"FAILED":   3,
	}
)

Enum value maps for Status.

View Source
var File_pkg_grpc_message_proto protoreflect.FileDescriptor
View Source
var LlamaGoService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "module.LlamaGoService",
	HandlerType: (*LlamaGoServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Do",
			Handler:       _LlamaGoService_Do_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "pkg/grpc/message.proto",
}

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

Functions

func RegisterLlamaGoServiceServer

func RegisterLlamaGoServiceServer(s grpc.ServiceRegistrar, srv LlamaGoServiceServer)

Types

type Job

type Job struct {
	Id     string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Prompt string `protobuf:"bytes,2,opt,name=prompt,proto3" json:"prompt,omitempty"`
	// contains filtered or unexported fields
}

func (*Job) Descriptor deprecated

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

Deprecated: Use Job.ProtoReflect.Descriptor instead.

func (*Job) GetId

func (x *Job) GetId() string

func (*Job) GetPrompt

func (x *Job) GetPrompt() string

func (*Job) ProtoMessage

func (*Job) ProtoMessage()

func (*Job) ProtoReflect

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

func (*Job) Reset

func (x *Job) Reset()

func (*Job) String

func (x *Job) String() string

type JobStub

type JobStub struct {
	JobCancelFn context.CancelFunc
	// contains filtered or unexported fields
}

func (*JobStub) SendResponse

func (c *JobStub) SendResponse(cmd *Output) error

type LlamaGoServiceClient

type LlamaGoServiceClient interface {
	Do(ctx context.Context, in *Job, opts ...grpc.CallOption) (LlamaGoService_DoClient, error)
}

LlamaGoServiceClient is the client API for LlamaGoService 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 LlamaGoServiceServer

type LlamaGoServiceServer interface {
	Do(*Job, LlamaGoService_DoServer) error
	// contains filtered or unexported methods
}

LlamaGoServiceServer is the server API for LlamaGoService service. All implementations must embed UnimplementedLlamaGoServiceServer for forward compatibility

type LlamaGoService_DoClient

type LlamaGoService_DoClient interface {
	Recv() (*Output, error)
	grpc.ClientStream
}

type LlamaGoService_DoServer

type LlamaGoService_DoServer interface {
	Send(*Output) error
	grpc.ServerStream
}

type Output

type Output struct {
	Id     string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=module.Status" json:"status,omitempty"`
	Output string `protobuf:"bytes,3,opt,name=output,proto3" json:"output,omitempty"`
	// contains filtered or unexported fields
}

func (*Output) Descriptor deprecated

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

Deprecated: Use Output.ProtoReflect.Descriptor instead.

func (*Output) GetId

func (x *Output) GetId() string

func (*Output) GetOutput

func (x *Output) GetOutput() string

func (*Output) GetStatus

func (x *Output) GetStatus() Status

func (*Output) ProtoMessage

func (*Output) ProtoMessage()

func (*Output) ProtoReflect

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

func (*Output) Reset

func (x *Output) Reset()

func (*Output) String

func (x *Output) String() string

type Server

type Server struct {
	LlamaGoServiceServer

	RunningPods int64
	MaxPods     int64
	Vocab       *ml.Vocab
	Model       *llama.Model
	Params      *llama.ModelParams
	// contains filtered or unexported fields
}

func NewServer

func NewServer(addr string, pods int64, vocab *ml.Vocab, model *llama.Model, params *llama.ModelParams, ctx context.Context) (server *Server, err error)

main 从sub获取数据

func (*Server) Do

func (s *Server) Do(job *Job, server LlamaGoService_DoServer) error

下行通道

type Status

type Status int32
const (
	Status_PENDING  Status = 0
	Status_RUNNING  Status = 1
	Status_FINISHED Status = 2
	Status_FAILED   Status = 3
)

func (Status) Descriptor

func (Status) Descriptor() protoreflect.EnumDescriptor

func (Status) Enum

func (x Status) Enum() *Status

func (Status) EnumDescriptor deprecated

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

Deprecated: Use Status.Descriptor instead.

func (Status) Number

func (x Status) Number() protoreflect.EnumNumber

func (Status) String

func (x Status) String() string

func (Status) Type

func (Status) Type() protoreflect.EnumType

type UnimplementedLlamaGoServiceServer

type UnimplementedLlamaGoServiceServer struct {
}

UnimplementedLlamaGoServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedLlamaGoServiceServer) Do

type UnsafeLlamaGoServiceServer

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

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

Jump to

Keyboard shortcuts

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