grpc_server

package
v0.0.0-...-6252159 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_simulator_service_proto protoreflect.FileDescriptor
View Source
var SimulatorService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "service.SimulatorService",
	HandlerType: (*SimulatorServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Init",
			Handler:    _SimulatorService_Init_Handler,
		},
		{
			MethodName: "Goto",
			Handler:    _SimulatorService_Goto_Handler,
		},
		{
			MethodName: "GetTime",
			Handler:    _SimulatorService_GetTime_Handler,
		},
		{
			MethodName: "GetMachines",
			Handler:    _SimulatorService_GetMachines_Handler,
		},
		{
			MethodName: "GetQueue",
			Handler:    _SimulatorService_GetQueue_Handler,
		},
		{
			MethodName: "Schdule",
			Handler:    _SimulatorService_Schdule_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "simulator_service.proto",
}

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

Functions

func RegisterSimulatorServiceServer

func RegisterSimulatorServiceServer(s grpc.ServiceRegistrar, srv SimulatorServiceServer)

Types

type Empty

type Empty struct {
	NoUse int32 `protobuf:"varint,10,opt,name=NoUse,proto3" json:"NoUse,omitempty"`
	// contains filtered or unexported fields
}

func (*Empty) Descriptor deprecated

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

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) GetNoUse

func (x *Empty) GetNoUse() int32

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 EndTime

type EndTime struct {
	Time int64 `protobuf:"varint,10,opt,name=Time,proto3" json:"Time,omitempty"`
	// contains filtered or unexported fields
}

func (*EndTime) Descriptor deprecated

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

Deprecated: Use EndTime.ProtoReflect.Descriptor instead.

func (*EndTime) GetTime

func (x *EndTime) GetTime() int64

func (*EndTime) ProtoMessage

func (*EndTime) ProtoMessage()

func (*EndTime) ProtoReflect

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

func (*EndTime) Reset

func (x *EndTime) Reset()

func (*EndTime) String

func (x *EndTime) String() string

type GrpcServer

type GrpcServer struct {
	Sim  *core.Simulator
	Addr string
}

func NewGrpcServer

func NewGrpcServer(ipaddr string, s *core.Simulator) *GrpcServer

func (*GrpcServer) GetMachines

func (s *GrpcServer) GetMachines(context.Context, *Empty) (*MachinesState, error)

func (*GrpcServer) GetQueue

func (s *GrpcServer) GetQueue(context.Context, *Empty) (*QueueState, error)

func (*GrpcServer) GetTime

func (s *GrpcServer) GetTime(context.Context, *Empty) (*TimeState, error)

func (*GrpcServer) Goto

func (s *GrpcServer) Goto(ctx context.Context, end *EndTime) (*RequestState, error)

func (*GrpcServer) Init

func (s *GrpcServer) Init(ctx context.Context, ir *InitRequest) (*RequestState, error)

func (*GrpcServer) Schdule

func (s *GrpcServer) Schdule(ctx context.Context, sr *SchduleRequest) (*RequestState, error)

func (*GrpcServer) Serve

func (s *GrpcServer) Serve()

type InitRequest

type InitRequest struct {
	BeginHour  int32 `protobuf:"varint,10,opt,name=BeginHour,proto3" json:"BeginHour,omitempty"`
	FinishHour int32 `protobuf:"varint,20,opt,name=FinishHour,proto3" json:"FinishHour,omitempty"`
	// contains filtered or unexported fields
}

func (*InitRequest) Descriptor deprecated

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

Deprecated: Use InitRequest.ProtoReflect.Descriptor instead.

func (*InitRequest) GetBeginHour

func (x *InitRequest) GetBeginHour() int32

func (*InitRequest) GetFinishHour

func (x *InitRequest) GetFinishHour() int32

func (*InitRequest) ProtoMessage

func (*InitRequest) ProtoMessage()

func (*InitRequest) ProtoReflect

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

func (*InitRequest) Reset

func (x *InitRequest) Reset()

func (*InitRequest) String

func (x *InitRequest) String() string

type InstanceInfo

type InstanceInfo struct {
	InstanceKey *InstanceKey `protobuf:"bytes,10,opt,name=InstanceKey,proto3" json:"InstanceKey,omitempty"`
	QueueTime   int64        `protobuf:"varint,20,opt,name=QueueTime,proto3" json:"QueueTime,omitempty"`
	CpuRequest  float64      `protobuf:"fixed64,30,opt,name=CpuRequest,proto3" json:"CpuRequest,omitempty"`
	RamRequest  float64      `protobuf:"fixed64,40,opt,name=RamRequest,proto3" json:"RamRequest,omitempty"`
	// contains filtered or unexported fields
}

func (*InstanceInfo) Descriptor deprecated

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

Deprecated: Use InstanceInfo.ProtoReflect.Descriptor instead.

func (*InstanceInfo) GetCpuRequest

func (x *InstanceInfo) GetCpuRequest() float64

func (*InstanceInfo) GetInstanceKey

func (x *InstanceInfo) GetInstanceKey() *InstanceKey

func (*InstanceInfo) GetQueueTime

func (x *InstanceInfo) GetQueueTime() int64

func (*InstanceInfo) GetRamRequest

func (x *InstanceInfo) GetRamRequest() float64

func (*InstanceInfo) ProtoMessage

func (*InstanceInfo) ProtoMessage()

func (*InstanceInfo) ProtoReflect

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

func (*InstanceInfo) Reset

func (x *InstanceInfo) Reset()

func (*InstanceInfo) String

func (x *InstanceInfo) String() string

type InstanceKey

type InstanceKey struct {
	CollectionId  int64 `protobuf:"varint,10,opt,name=CollectionId,proto3" json:"CollectionId,omitempty"`
	InstanceIndex int64 `protobuf:"varint,20,opt,name=InstanceIndex,proto3" json:"InstanceIndex,omitempty"`
	// contains filtered or unexported fields
}

func (*InstanceKey) Descriptor deprecated

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

Deprecated: Use InstanceKey.ProtoReflect.Descriptor instead.

func (*InstanceKey) GetCollectionId

func (x *InstanceKey) GetCollectionId() int64

func (*InstanceKey) GetInstanceIndex

func (x *InstanceKey) GetInstanceIndex() int64

func (*InstanceKey) ProtoMessage

func (*InstanceKey) ProtoMessage()

func (*InstanceKey) ProtoReflect

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

func (*InstanceKey) Reset

func (x *InstanceKey) Reset()

func (*InstanceKey) String

func (x *InstanceKey) String() string

type MachineInfo

type MachineInfo struct {
	MachineId   int64   `protobuf:"varint,10,opt,name=MachineId,proto3" json:"MachineId,omitempty"`
	CpuCapacity float64 `protobuf:"fixed64,20,opt,name=CpuCapacity,proto3" json:"CpuCapacity,omitempty"`
	RamCapacity float64 `protobuf:"fixed64,30,opt,name=RamCapacity,proto3" json:"RamCapacity,omitempty"`
	CpuAlloc    float64 `protobuf:"fixed64,40,opt,name=CpuAlloc,proto3" json:"CpuAlloc,omitempty"`
	RamAlloc    float64 `protobuf:"fixed64,50,opt,name=RamAlloc,proto3" json:"RamAlloc,omitempty"`
	// contains filtered or unexported fields
}

func (*MachineInfo) Descriptor deprecated

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

Deprecated: Use MachineInfo.ProtoReflect.Descriptor instead.

func (*MachineInfo) GetCpuAlloc

func (x *MachineInfo) GetCpuAlloc() float64

func (*MachineInfo) GetCpuCapacity

func (x *MachineInfo) GetCpuCapacity() float64

func (*MachineInfo) GetMachineId

func (x *MachineInfo) GetMachineId() int64

func (*MachineInfo) GetRamAlloc

func (x *MachineInfo) GetRamAlloc() float64

func (*MachineInfo) GetRamCapacity

func (x *MachineInfo) GetRamCapacity() float64

func (*MachineInfo) ProtoMessage

func (*MachineInfo) ProtoMessage()

func (*MachineInfo) ProtoReflect

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

func (*MachineInfo) Reset

func (x *MachineInfo) Reset()

func (*MachineInfo) String

func (x *MachineInfo) String() string

type MachinesState

type MachinesState struct {
	IfError  bool           `protobuf:"varint,10,opt,name=IfError,proto3" json:"IfError,omitempty"`
	Machines []*MachineInfo `protobuf:"bytes,20,rep,name=Machines,proto3" json:"Machines,omitempty"`
	// contains filtered or unexported fields
}

服务端返回的当前集群信息

func (*MachinesState) Descriptor deprecated

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

Deprecated: Use MachinesState.ProtoReflect.Descriptor instead.

func (*MachinesState) GetIfError

func (x *MachinesState) GetIfError() bool

func (*MachinesState) GetMachines

func (x *MachinesState) GetMachines() []*MachineInfo

func (*MachinesState) ProtoMessage

func (*MachinesState) ProtoMessage()

func (*MachinesState) ProtoReflect

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

func (*MachinesState) Reset

func (x *MachinesState) Reset()

func (*MachinesState) String

func (x *MachinesState) String() string

type QueueState

type QueueState struct {
	IfError   bool            `protobuf:"varint,10,opt,name=IfError,proto3" json:"IfError,omitempty"`
	Instances []*InstanceInfo `protobuf:"bytes,20,rep,name=Instances,proto3" json:"Instances,omitempty"`
	// contains filtered or unexported fields
}

服务端返回的当前队列信息

func (*QueueState) Descriptor deprecated

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

Deprecated: Use QueueState.ProtoReflect.Descriptor instead.

func (*QueueState) GetIfError

func (x *QueueState) GetIfError() bool

func (*QueueState) GetInstances

func (x *QueueState) GetInstances() []*InstanceInfo

func (*QueueState) ProtoMessage

func (*QueueState) ProtoMessage()

func (*QueueState) ProtoReflect

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

func (*QueueState) Reset

func (x *QueueState) Reset()

func (*QueueState) String

func (x *QueueState) String() string

type RequestState

type RequestState struct {
	IfError bool `protobuf:"varint,10,opt,name=IfError,proto3" json:"IfError,omitempty"`
	// contains filtered or unexported fields
}

func (*RequestState) Descriptor deprecated

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

Deprecated: Use RequestState.ProtoReflect.Descriptor instead.

func (*RequestState) GetIfError

func (x *RequestState) GetIfError() bool

func (*RequestState) ProtoMessage

func (*RequestState) ProtoMessage()

func (*RequestState) ProtoReflect

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

func (*RequestState) Reset

func (x *RequestState) Reset()

func (*RequestState) String

func (x *RequestState) String() string

type SchduleRequest

type SchduleRequest struct {
	InstanceKey *InstanceKey `protobuf:"bytes,10,opt,name=InstanceKey,proto3" json:"InstanceKey,omitempty"`
	MachineId   int64        `protobuf:"varint,20,opt,name=MachineId,proto3" json:"MachineId,omitempty"`
	// contains filtered or unexported fields
}

调度Instance调度到某个机器上的请求

func (*SchduleRequest) Descriptor deprecated

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

Deprecated: Use SchduleRequest.ProtoReflect.Descriptor instead.

func (*SchduleRequest) GetInstanceKey

func (x *SchduleRequest) GetInstanceKey() *InstanceKey

func (*SchduleRequest) GetMachineId

func (x *SchduleRequest) GetMachineId() int64

func (*SchduleRequest) ProtoMessage

func (*SchduleRequest) ProtoMessage()

func (*SchduleRequest) ProtoReflect

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

func (*SchduleRequest) Reset

func (x *SchduleRequest) Reset()

func (*SchduleRequest) String

func (x *SchduleRequest) String() string

type SimulatorServiceClient

type SimulatorServiceClient interface {
	Init(ctx context.Context, in *InitRequest, opts ...grpc.CallOption) (*RequestState, error)
	Goto(ctx context.Context, in *EndTime, opts ...grpc.CallOption) (*RequestState, error)
	GetTime(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TimeState, error)
	GetMachines(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*MachinesState, error)
	GetQueue(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*QueueState, error)
	Schdule(ctx context.Context, in *SchduleRequest, opts ...grpc.CallOption) (*RequestState, error)
}

SimulatorServiceClient is the client API for SimulatorService 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 SimulatorServiceServer

type SimulatorServiceServer interface {
	Init(context.Context, *InitRequest) (*RequestState, error)
	Goto(context.Context, *EndTime) (*RequestState, error)
	GetTime(context.Context, *Empty) (*TimeState, error)
	GetMachines(context.Context, *Empty) (*MachinesState, error)
	GetQueue(context.Context, *Empty) (*QueueState, error)
	Schdule(context.Context, *SchduleRequest) (*RequestState, error)
}

SimulatorServiceServer is the server API for SimulatorService service. All implementations should embed UnimplementedSimulatorServiceServer for forward compatibility

type TimeState

type TimeState struct {
	IfError bool  `protobuf:"varint,10,opt,name=IfError,proto3" json:"IfError,omitempty"`
	Time    int64 `protobuf:"varint,20,opt,name=Time,proto3" json:"Time,omitempty"`
	// contains filtered or unexported fields
}

func (*TimeState) Descriptor deprecated

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

Deprecated: Use TimeState.ProtoReflect.Descriptor instead.

func (*TimeState) GetIfError

func (x *TimeState) GetIfError() bool

func (*TimeState) GetTime

func (x *TimeState) GetTime() int64

func (*TimeState) ProtoMessage

func (*TimeState) ProtoMessage()

func (*TimeState) ProtoReflect

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

func (*TimeState) Reset

func (x *TimeState) Reset()

func (*TimeState) String

func (x *TimeState) String() string

type UnimplementedSimulatorServiceServer

type UnimplementedSimulatorServiceServer struct {
}

UnimplementedSimulatorServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedSimulatorServiceServer) GetMachines

func (UnimplementedSimulatorServiceServer) GetQueue

func (UnimplementedSimulatorServiceServer) GetTime

func (UnimplementedSimulatorServiceServer) Goto

func (UnimplementedSimulatorServiceServer) Init

func (UnimplementedSimulatorServiceServer) Schdule

type UnsafeSimulatorServiceServer

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

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

Jump to

Keyboard shortcuts

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