added barebones terminal, refactoring coordinators to be unique again :(
parent
95a00cb940
commit
31c1a702a7
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,899 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.1
|
||||
// protoc v3.6.1
|
||||
// source: internal/pkg/grpc/management.proto
|
||||
|
||||
package grpc
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type GetReactorsRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ClientId uint32 `protobuf:"varint,1,opt,name=clientId,proto3" json:"clientId,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetReactorsRequest) Reset() {
|
||||
*x = GetReactorsRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetReactorsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetReactorsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetReactorsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetReactorsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetReactorsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_internal_pkg_grpc_management_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *GetReactorsRequest) GetClientId() uint32 {
|
||||
if x != nil {
|
||||
return x.ClientId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetReactorsResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ClientId uint32 `protobuf:"varint,1,opt,name=clientId,proto3" json:"clientId,omitempty"`
|
||||
Reactors []*Reactor `protobuf:"bytes,2,rep,name=reactors,proto3" json:"reactors,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetReactorsResponse) Reset() {
|
||||
*x = GetReactorsResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetReactorsResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetReactorsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetReactorsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetReactorsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetReactorsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_internal_pkg_grpc_management_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *GetReactorsResponse) GetClientId() uint32 {
|
||||
if x != nil {
|
||||
return x.ClientId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GetReactorsResponse) GetReactors() []*Reactor {
|
||||
if x != nil {
|
||||
return x.Reactors
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetReactorDevicesRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ClientId uint32 `protobuf:"varint,1,opt,name=clientId,proto3" json:"clientId,omitempty"`
|
||||
ReactorId uint32 `protobuf:"varint,2,opt,name=reactorId,proto3" json:"reactorId,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetReactorDevicesRequest) Reset() {
|
||||
*x = GetReactorDevicesRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetReactorDevicesRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetReactorDevicesRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetReactorDevicesRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetReactorDevicesRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetReactorDevicesRequest) Descriptor() ([]byte, []int) {
|
||||
return file_internal_pkg_grpc_management_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *GetReactorDevicesRequest) GetClientId() uint32 {
|
||||
if x != nil {
|
||||
return x.ClientId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GetReactorDevicesRequest) GetReactorId() uint32 {
|
||||
if x != nil {
|
||||
return x.ReactorId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetReactorDevicesResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ClientId uint32 `protobuf:"varint,1,opt,name=clientId,proto3" json:"clientId,omitempty"`
|
||||
ReactorId uint32 `protobuf:"varint,2,opt,name=reactorId,proto3" json:"reactorId,omitempty"`
|
||||
Devices []*Dev `protobuf:"bytes,3,rep,name=devices,proto3" json:"devices,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetReactorDevicesResponse) Reset() {
|
||||
*x = GetReactorDevicesResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetReactorDevicesResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetReactorDevicesResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetReactorDevicesResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetReactorDevicesResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetReactorDevicesResponse) Descriptor() ([]byte, []int) {
|
||||
return file_internal_pkg_grpc_management_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *GetReactorDevicesResponse) GetClientId() uint32 {
|
||||
if x != nil {
|
||||
return x.ClientId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GetReactorDevicesResponse) GetReactorId() uint32 {
|
||||
if x != nil {
|
||||
return x.ReactorId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GetReactorDevicesResponse) GetDevices() []*Dev {
|
||||
if x != nil {
|
||||
return x.Devices
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteReactorRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ClientId uint32 `protobuf:"varint,1,opt,name=clientId,proto3" json:"clientId,omitempty"`
|
||||
ReactorId uint32 `protobuf:"varint,2,opt,name=reactorId,proto3" json:"reactorId,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DeleteReactorRequest) Reset() {
|
||||
*x = DeleteReactorRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DeleteReactorRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteReactorRequest) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteReactorRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DeleteReactorRequest.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteReactorRequest) Descriptor() ([]byte, []int) {
|
||||
return file_internal_pkg_grpc_management_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *DeleteReactorRequest) GetClientId() uint32 {
|
||||
if x != nil {
|
||||
return x.ClientId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DeleteReactorRequest) GetReactorId() uint32 {
|
||||
if x != nil {
|
||||
return x.ReactorId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type DeleteReactorResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ClientId uint32 `protobuf:"varint,1,opt,name=clientId,proto3" json:"clientId,omitempty"`
|
||||
ReactorId uint32 `protobuf:"varint,2,opt,name=reactorId,proto3" json:"reactorId,omitempty"`
|
||||
Success bool `protobuf:"varint,3,opt,name=success,proto3" json:"success,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DeleteReactorResponse) Reset() {
|
||||
*x = DeleteReactorResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DeleteReactorResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteReactorResponse) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteReactorResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DeleteReactorResponse.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteReactorResponse) Descriptor() ([]byte, []int) {
|
||||
return file_internal_pkg_grpc_management_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *DeleteReactorResponse) GetClientId() uint32 {
|
||||
if x != nil {
|
||||
return x.ClientId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DeleteReactorResponse) GetReactorId() uint32 {
|
||||
if x != nil {
|
||||
return x.ReactorId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DeleteReactorResponse) GetSuccess() bool {
|
||||
if x != nil {
|
||||
return x.Success
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type DeleteReactorDeviceRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ClientId uint32 `protobuf:"varint,1,opt,name=clientId,proto3" json:"clientId,omitempty"`
|
||||
ReactorId uint32 `protobuf:"varint,2,opt,name=reactorId,proto3" json:"reactorId,omitempty"`
|
||||
DevAddr int32 `protobuf:"varint,3,opt,name=devAddr,proto3" json:"devAddr,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DeleteReactorDeviceRequest) Reset() {
|
||||
*x = DeleteReactorDeviceRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DeleteReactorDeviceRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteReactorDeviceRequest) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteReactorDeviceRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DeleteReactorDeviceRequest.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteReactorDeviceRequest) Descriptor() ([]byte, []int) {
|
||||
return file_internal_pkg_grpc_management_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *DeleteReactorDeviceRequest) GetClientId() uint32 {
|
||||
if x != nil {
|
||||
return x.ClientId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DeleteReactorDeviceRequest) GetReactorId() uint32 {
|
||||
if x != nil {
|
||||
return x.ReactorId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DeleteReactorDeviceRequest) GetDevAddr() int32 {
|
||||
if x != nil {
|
||||
return x.DevAddr
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type DeleteReactorDeviceResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ClientId uint32 `protobuf:"varint,1,opt,name=clientId,proto3" json:"clientId,omitempty"`
|
||||
ReactorId uint32 `protobuf:"varint,2,opt,name=reactorId,proto3" json:"reactorId,omitempty"`
|
||||
DevAddr int32 `protobuf:"varint,3,opt,name=devAddr,proto3" json:"devAddr,omitempty"`
|
||||
Success bool `protobuf:"varint,4,opt,name=success,proto3" json:"success,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DeleteReactorDeviceResponse) Reset() {
|
||||
*x = DeleteReactorDeviceResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DeleteReactorDeviceResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteReactorDeviceResponse) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteReactorDeviceResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[7]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DeleteReactorDeviceResponse.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteReactorDeviceResponse) Descriptor() ([]byte, []int) {
|
||||
return file_internal_pkg_grpc_management_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *DeleteReactorDeviceResponse) GetClientId() uint32 {
|
||||
if x != nil {
|
||||
return x.ClientId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DeleteReactorDeviceResponse) GetReactorId() uint32 {
|
||||
if x != nil {
|
||||
return x.ReactorId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DeleteReactorDeviceResponse) GetDevAddr() int32 {
|
||||
if x != nil {
|
||||
return x.DevAddr
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DeleteReactorDeviceResponse) GetSuccess() bool {
|
||||
if x != nil {
|
||||
return x.Success
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type Reactor struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Status bool `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Reactor) Reset() {
|
||||
*x = Reactor{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Reactor) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Reactor) ProtoMessage() {}
|
||||
|
||||
func (x *Reactor) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[8]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Reactor.ProtoReflect.Descriptor instead.
|
||||
func (*Reactor) Descriptor() ([]byte, []int) {
|
||||
return file_internal_pkg_grpc_management_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *Reactor) GetId() uint32 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Reactor) GetStatus() bool {
|
||||
if x != nil {
|
||||
return x.Status
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type Dev struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Addr int32 `protobuf:"varint,1,opt,name=addr,proto3" json:"addr,omitempty"`
|
||||
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
|
||||
Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
|
||||
Data string `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Dev) Reset() {
|
||||
*x = Dev{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Dev) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Dev) ProtoMessage() {}
|
||||
|
||||
func (x *Dev) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_pkg_grpc_management_proto_msgTypes[9]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Dev.ProtoReflect.Descriptor instead.
|
||||
func (*Dev) Descriptor() ([]byte, []int) {
|
||||
return file_internal_pkg_grpc_management_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *Dev) GetAddr() int32 {
|
||||
if x != nil {
|
||||
return x.Addr
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Dev) GetType() string {
|
||||
if x != nil {
|
||||
return x.Type
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Dev) GetStatus() string {
|
||||
if x != nil {
|
||||
return x.Status
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Dev) GetData() string {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_internal_pkg_grpc_management_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_internal_pkg_grpc_management_proto_rawDesc = []byte{
|
||||
0x0a, 0x22, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x67,
|
||||
0x72, 0x70, 0x63, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, 0x72, 0x70, 0x63, 0x22, 0x30, 0x0a, 0x12, 0x47, 0x65,
|
||||
0x74, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0d, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x5c, 0x0a, 0x13,
|
||||
0x47, 0x65, 0x74, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12,
|
||||
0x29, 0x0a, 0x08, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28,
|
||||
0x0b, 0x32, 0x0d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72,
|
||||
0x52, 0x08, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x22, 0x54, 0x0a, 0x18, 0x47, 0x65,
|
||||
0x74, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74,
|
||||
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74,
|
||||
0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64,
|
||||
0x22, 0x7a, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x44, 0x65,
|
||||
0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a,
|
||||
0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52,
|
||||
0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x61,
|
||||
0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65,
|
||||
0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x07, 0x64, 0x65, 0x76, 0x69, 0x63,
|
||||
0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e,
|
||||
0x44, 0x65, 0x76, 0x52, 0x07, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0x50, 0x0a, 0x14,
|
||||
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64,
|
||||
0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x22, 0x6b,
|
||||
0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e,
|
||||
0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e,
|
||||
0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49,
|
||||
0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x70, 0x0a, 0x1a, 0x44,
|
||||
0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x44, 0x65, 0x76, 0x69,
|
||||
0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6c, 0x69,
|
||||
0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x63, 0x6c, 0x69,
|
||||
0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72,
|
||||
0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f,
|
||||
0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x76, 0x41, 0x64, 0x64, 0x72, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x64, 0x65, 0x76, 0x41, 0x64, 0x64, 0x72, 0x22, 0x8b, 0x01,
|
||||
0x0a, 0x1b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x44,
|
||||
0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a,
|
||||
0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52,
|
||||
0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x61,
|
||||
0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65,
|
||||
0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x76, 0x41, 0x64,
|
||||
0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x64, 0x65, 0x76, 0x41, 0x64, 0x64,
|
||||
0x72, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01,
|
||||
0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x31, 0x0a, 0x07, 0x52,
|
||||
0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x59,
|
||||
0x0a, 0x03, 0x44, 0x65, 0x76, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a,
|
||||
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73,
|
||||
0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x32, 0xcc, 0x02, 0x0a, 0x0a, 0x6d, 0x61,
|
||||
0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x42, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52,
|
||||
0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x18, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47,
|
||||
0x65, 0x74, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x19, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x61, 0x63,
|
||||
0x74, 0x6f, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x11,
|
||||
0x47, 0x65, 0x74, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
|
||||
0x73, 0x12, 0x1e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x61, 0x63,
|
||||
0x74, 0x6f, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x1f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x61, 0x63,
|
||||
0x74, 0x6f, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x12, 0x48, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63,
|
||||
0x74, 0x6f, 0x72, 0x12, 0x1a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74,
|
||||
0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x1b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61,
|
||||
0x63, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5a, 0x0a, 0x13,
|
||||
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x44, 0x65, 0x76,
|
||||
0x69, 0x63, 0x65, 0x12, 0x20, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74,
|
||||
0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x6c,
|
||||
0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x13, 0x5a, 0x11, 0x69, 0x6e, 0x74, 0x65,
|
||||
0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_internal_pkg_grpc_management_proto_rawDescOnce sync.Once
|
||||
file_internal_pkg_grpc_management_proto_rawDescData = file_internal_pkg_grpc_management_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_internal_pkg_grpc_management_proto_rawDescGZIP() []byte {
|
||||
file_internal_pkg_grpc_management_proto_rawDescOnce.Do(func() {
|
||||
file_internal_pkg_grpc_management_proto_rawDescData = protoimpl.X.CompressGZIP(file_internal_pkg_grpc_management_proto_rawDescData)
|
||||
})
|
||||
return file_internal_pkg_grpc_management_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_internal_pkg_grpc_management_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
||||
var file_internal_pkg_grpc_management_proto_goTypes = []interface{}{
|
||||
(*GetReactorsRequest)(nil), // 0: grpc.GetReactorsRequest
|
||||
(*GetReactorsResponse)(nil), // 1: grpc.GetReactorsResponse
|
||||
(*GetReactorDevicesRequest)(nil), // 2: grpc.GetReactorDevicesRequest
|
||||
(*GetReactorDevicesResponse)(nil), // 3: grpc.GetReactorDevicesResponse
|
||||
(*DeleteReactorRequest)(nil), // 4: grpc.DeleteReactorRequest
|
||||
(*DeleteReactorResponse)(nil), // 5: grpc.DeleteReactorResponse
|
||||
(*DeleteReactorDeviceRequest)(nil), // 6: grpc.DeleteReactorDeviceRequest
|
||||
(*DeleteReactorDeviceResponse)(nil), // 7: grpc.DeleteReactorDeviceResponse
|
||||
(*Reactor)(nil), // 8: grpc.Reactor
|
||||
(*Dev)(nil), // 9: grpc.Dev
|
||||
}
|
||||
var file_internal_pkg_grpc_management_proto_depIdxs = []int32{
|
||||
8, // 0: grpc.GetReactorsResponse.reactors:type_name -> grpc.Reactor
|
||||
9, // 1: grpc.GetReactorDevicesResponse.devices:type_name -> grpc.Dev
|
||||
0, // 2: grpc.management.GetReactors:input_type -> grpc.GetReactorsRequest
|
||||
2, // 3: grpc.management.GetReactorDevices:input_type -> grpc.GetReactorDevicesRequest
|
||||
4, // 4: grpc.management.DeleteReactor:input_type -> grpc.DeleteReactorRequest
|
||||
6, // 5: grpc.management.DeleteReactorDevice:input_type -> grpc.DeleteReactorDeviceRequest
|
||||
1, // 6: grpc.management.GetReactors:output_type -> grpc.GetReactorsResponse
|
||||
3, // 7: grpc.management.GetReactorDevices:output_type -> grpc.GetReactorDevicesResponse
|
||||
5, // 8: grpc.management.DeleteReactor:output_type -> grpc.DeleteReactorResponse
|
||||
7, // 9: grpc.management.DeleteReactorDevice:output_type -> grpc.DeleteReactorDeviceResponse
|
||||
6, // [6:10] is the sub-list for method output_type
|
||||
2, // [2:6] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_internal_pkg_grpc_management_proto_init() }
|
||||
func file_internal_pkg_grpc_management_proto_init() {
|
||||
if File_internal_pkg_grpc_management_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_internal_pkg_grpc_management_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetReactorsRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_internal_pkg_grpc_management_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetReactorsResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_internal_pkg_grpc_management_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetReactorDevicesRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_internal_pkg_grpc_management_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetReactorDevicesResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_internal_pkg_grpc_management_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DeleteReactorRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_internal_pkg_grpc_management_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DeleteReactorResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_internal_pkg_grpc_management_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DeleteReactorDeviceRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_internal_pkg_grpc_management_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DeleteReactorDeviceResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_internal_pkg_grpc_management_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Reactor); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_internal_pkg_grpc_management_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Dev); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_internal_pkg_grpc_management_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 10,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_internal_pkg_grpc_management_proto_goTypes,
|
||||
DependencyIndexes: file_internal_pkg_grpc_management_proto_depIdxs,
|
||||
MessageInfos: file_internal_pkg_grpc_management_proto_msgTypes,
|
||||
}.Build()
|
||||
File_internal_pkg_grpc_management_proto = out.File
|
||||
file_internal_pkg_grpc_management_proto_rawDesc = nil
|
||||
file_internal_pkg_grpc_management_proto_goTypes = nil
|
||||
file_internal_pkg_grpc_management_proto_depIdxs = nil
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
syntax = "proto3";
|
||||
package grpc;
|
||||
|
||||
option go_package = "internal/pkg/grpc";
|
||||
|
||||
service management {
|
||||
rpc GetReactors(GetReactorsRequest) returns (GetReactorsResponse);
|
||||
rpc GetReactorDevices(GetReactorDevicesRequest) returns (GetReactorDevicesResponse);
|
||||
rpc DeleteReactor(DeleteReactorRequest) returns (DeleteReactorResponse);
|
||||
rpc DeleteReactorDevice(DeleteReactorDeviceRequest) returns (DeleteReactorDeviceResponse);
|
||||
}
|
||||
|
||||
message GetReactorsRequest {
|
||||
uint32 clientId = 1;
|
||||
}
|
||||
|
||||
message GetReactorsResponse {
|
||||
uint32 clientId = 1;
|
||||
repeated Reactor reactors = 2;
|
||||
}
|
||||
|
||||
message GetReactorDevicesRequest {
|
||||
uint32 clientId = 1;
|
||||
uint32 reactorId = 2;
|
||||
}
|
||||
|
||||
message GetReactorDevicesResponse {
|
||||
uint32 clientId = 1;
|
||||
uint32 reactorId = 2;
|
||||
repeated Dev devices = 3;
|
||||
}
|
||||
|
||||
message DeleteReactorRequest {
|
||||
uint32 clientId = 1;
|
||||
uint32 reactorId = 2;
|
||||
}
|
||||
|
||||
message DeleteReactorResponse {
|
||||
uint32 clientId = 1;
|
||||
uint32 reactorId = 2;
|
||||
bool success = 3;
|
||||
}
|
||||
|
||||
message DeleteReactorDeviceRequest {
|
||||
uint32 clientId = 1;
|
||||
uint32 reactorId = 2;
|
||||
int32 devAddr = 3;
|
||||
}
|
||||
|
||||
message DeleteReactorDeviceResponse {
|
||||
uint32 clientId = 1;
|
||||
uint32 reactorId = 2;
|
||||
int32 devAddr = 3;
|
||||
bool success = 4;
|
||||
}
|
||||
|
||||
message Reactor {
|
||||
uint32 id = 1;
|
||||
bool status = 2;
|
||||
}
|
||||
|
||||
message Dev {
|
||||
int32 addr = 1;
|
||||
string type = 2;
|
||||
string status = 3;
|
||||
string data = 4;
|
||||
}
|
@ -0,0 +1,213 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.6.1
|
||||
// source: internal/pkg/grpc/management.proto
|
||||
|
||||
package grpc
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// ManagementClient is the client API for Management 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 ManagementClient interface {
|
||||
GetReactors(ctx context.Context, in *GetReactorsRequest, opts ...grpc.CallOption) (*GetReactorsResponse, error)
|
||||
GetReactorDevices(ctx context.Context, in *GetReactorDevicesRequest, opts ...grpc.CallOption) (*GetReactorDevicesResponse, error)
|
||||
DeleteReactor(ctx context.Context, in *DeleteReactorRequest, opts ...grpc.CallOption) (*DeleteReactorResponse, error)
|
||||
DeleteReactorDevice(ctx context.Context, in *DeleteReactorDeviceRequest, opts ...grpc.CallOption) (*DeleteReactorDeviceResponse, error)
|
||||
}
|
||||
|
||||
type managementClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewManagementClient(cc grpc.ClientConnInterface) ManagementClient {
|
||||
return &managementClient{cc}
|
||||
}
|
||||
|
||||
func (c *managementClient) GetReactors(ctx context.Context, in *GetReactorsRequest, opts ...grpc.CallOption) (*GetReactorsResponse, error) {
|
||||
out := new(GetReactorsResponse)
|
||||
err := c.cc.Invoke(ctx, "/grpc.management/GetReactors", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *managementClient) GetReactorDevices(ctx context.Context, in *GetReactorDevicesRequest, opts ...grpc.CallOption) (*GetReactorDevicesResponse, error) {
|
||||
out := new(GetReactorDevicesResponse)
|
||||
err := c.cc.Invoke(ctx, "/grpc.management/GetReactorDevices", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *managementClient) DeleteReactor(ctx context.Context, in *DeleteReactorRequest, opts ...grpc.CallOption) (*DeleteReactorResponse, error) {
|
||||
out := new(DeleteReactorResponse)
|
||||
err := c.cc.Invoke(ctx, "/grpc.management/DeleteReactor", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *managementClient) DeleteReactorDevice(ctx context.Context, in *DeleteReactorDeviceRequest, opts ...grpc.CallOption) (*DeleteReactorDeviceResponse, error) {
|
||||
out := new(DeleteReactorDeviceResponse)
|
||||
err := c.cc.Invoke(ctx, "/grpc.management/DeleteReactorDevice", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ManagementServer is the server API for Management service.
|
||||
// All implementations must embed UnimplementedManagementServer
|
||||
// for forward compatibility
|
||||
type ManagementServer interface {
|
||||
GetReactors(context.Context, *GetReactorsRequest) (*GetReactorsResponse, error)
|
||||
GetReactorDevices(context.Context, *GetReactorDevicesRequest) (*GetReactorDevicesResponse, error)
|
||||
DeleteReactor(context.Context, *DeleteReactorRequest) (*DeleteReactorResponse, error)
|
||||
DeleteReactorDevice(context.Context, *DeleteReactorDeviceRequest) (*DeleteReactorDeviceResponse, error)
|
||||
mustEmbedUnimplementedManagementServer()
|
||||
}
|
||||
|
||||
// UnimplementedManagementServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedManagementServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedManagementServer) GetReactors(context.Context, *GetReactorsRequest) (*GetReactorsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetReactors not implemented")
|
||||
}
|
||||
func (UnimplementedManagementServer) GetReactorDevices(context.Context, *GetReactorDevicesRequest) (*GetReactorDevicesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetReactorDevices not implemented")
|
||||
}
|
||||
func (UnimplementedManagementServer) DeleteReactor(context.Context, *DeleteReactorRequest) (*DeleteReactorResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteReactor not implemented")
|
||||
}
|
||||
func (UnimplementedManagementServer) DeleteReactorDevice(context.Context, *DeleteReactorDeviceRequest) (*DeleteReactorDeviceResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteReactorDevice not implemented")
|
||||
}
|
||||
func (UnimplementedManagementServer) mustEmbedUnimplementedManagementServer() {}
|
||||
|
||||
// UnsafeManagementServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ManagementServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeManagementServer interface {
|
||||
mustEmbedUnimplementedManagementServer()
|
||||
}
|
||||
|
||||
func RegisterManagementServer(s grpc.ServiceRegistrar, srv ManagementServer) {
|
||||
s.RegisterService(&Management_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Management_GetReactors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetReactorsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ManagementServer).GetReactors(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.management/GetReactors",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ManagementServer).GetReactors(ctx, req.(*GetReactorsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Management_GetReactorDevices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetReactorDevicesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ManagementServer).GetReactorDevices(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.management/GetReactorDevices",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ManagementServer).GetReactorDevices(ctx, req.(*GetReactorDevicesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Management_DeleteReactor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteReactorRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ManagementServer).DeleteReactor(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.management/DeleteReactor",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ManagementServer).DeleteReactor(ctx, req.(*DeleteReactorRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Management_DeleteReactorDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteReactorDeviceRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ManagementServer).DeleteReactorDevice(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.management/DeleteReactorDevice",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ManagementServer).DeleteReactorDevice(ctx, req.(*DeleteReactorDeviceRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Management_ServiceDesc is the grpc.ServiceDesc for Management service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Management_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "grpc.management",
|
||||
HandlerType: (*ManagementServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetReactors",
|
||||
Handler: _Management_GetReactors_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetReactorDevices",
|
||||
Handler: _Management_GetReactorDevices_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteReactor",
|
||||
Handler: _Management_DeleteReactor_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteReactorDevice",
|
||||
Handler: _Management_DeleteReactorDevice_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "internal/pkg/grpc/management.proto",
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
// package will create and maintain a concurrent system structure
|
||||
// allows for multiple readers/writers
|
||||
|
||||
type System struct {
|
||||
sync.Mutex
|
||||
Reactors map[uint32]*Reactor
|
||||
}
|
||||
|
||||
type Reactor struct {
|
||||
Status bool
|
||||
Devices map[int]*Device
|
||||
sync.Mutex
|
||||
}
|
||||
|
||||
type Device struct {
|
||||
Type string
|
||||
Status string
|
||||
Data string
|
||||
}
|
||||
|
||||
type ReactorInfo struct {
|
||||
Id uint32
|
||||
Status bool
|
||||
}
|
||||
|
||||
type DeviceInfo struct {
|
||||
Addr int
|
||||
Type string
|
||||
Status string
|
||||
Data string
|
||||
}
|
||||
|
||||
func NewSystemStruct() *System {
|
||||
s := &System{}
|
||||
r := make(map[uint32]*Reactor)
|
||||
s.Reactors = r
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *System) UpdateReactor(id uint32, status bool) {
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
if _, exists := s.Reactors[id]; exists {
|
||||
s.Reactors[id].Status = status
|
||||
} else {
|
||||
m := make(map[int]*Device)
|
||||
s.Reactors[id] = &Reactor{Status:status,Devices:m}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *System) UpdateReactorDevice(id uint32, addr int, t, st, d string) {
|
||||
dev := &Device{Type:t, Status:st, Data:d}
|
||||
go s.Reactors[id].UpdateDevice(addr, dev)
|
||||
}
|
||||
|
||||
func (r *Reactor) UpdateDevice(addr int, d *Device) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
r.Devices[addr] = d
|
||||
}
|
||||
|
||||
func (s *System) GetReactors() []*ReactorInfo {
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
rinfo := []*ReactorInfo{}
|
||||
for id, r := range s.Reactors {
|
||||
rinfo = append(rinfo,&ReactorInfo{Id:id,Status:r.Status})
|
||||
}
|
||||
return rinfo
|
||||
}
|
||||
|
||||
func (s *System) GetReactorDevices(id uint32) []*DeviceInfo {
|
||||
return s.Reactors[id].GetDevices()
|
||||
}
|
||||
|
||||
func (r *Reactor) GetDevices() []*DeviceInfo {
|
||||
//
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
di := []*DeviceInfo{}
|
||||
for a,v := range r.Devices {
|
||||
di = append(di, &DeviceInfo{Addr:a,Status:v.Status,Type:v.Type,Data:v.Data})
|
||||
}
|
||||
return di
|
||||
}
|
@ -0,0 +1,143 @@
|
||||
package tui
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"fmt"
|
||||
"log"
|
||||
"time"
|
||||
"math"
|
||||
"context"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
pb "FRMS/internal/pkg/grpc"
|
||||
)
|
||||
|
||||
// this package will interact with the server to get system status
|
||||
|
||||
type TUIClient struct {
|
||||
Ip string
|
||||
Port int
|
||||
client pb.ManagementClient
|
||||
Active
|
||||
}
|
||||
type Active struct {
|
||||
sync.Mutex
|
||||
bool
|
||||
int
|
||||
}
|
||||
|
||||
func NewTUIClient(ip string, port int) *TUIClient {
|
||||
t := &TUIClient{Ip:ip,Port:port}
|
||||
return t
|
||||
}
|
||||
|
||||
func (t *TUIClient) Start() error {
|
||||
t.Connect()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *TUIClient) Timeout() int {
|
||||
t.Active.Lock()
|
||||
defer t.Active.Unlock()
|
||||
if t.Active.int < 9 {
|
||||
v := int( 5 * math.Pow(float64(2), float64(t.Active.int)))
|
||||
t.Active.int += 1
|
||||
return v
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
func (t *TUIClient) Connect() {
|
||||
// connect to server and register as client
|
||||
var conn *grpc.ClientConn
|
||||
var err error
|
||||
var opts []grpc.DialOption
|
||||
opts = append(opts,grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
for {
|
||||
conn, err = grpc.Dial(fmt.Sprintf("%v:%v",t.Ip,t.Port),opts...)
|
||||
code := status.Code(err)
|
||||
if code != 0 {
|
||||
if code == (5 | 14) {
|
||||
to := t.Timeout()
|
||||
if to == 0 {
|
||||
log.Fatal("Failed to connect to central server")
|
||||
}
|
||||
fmt.Printf("Server currently down, reconnecting in %v ms\n",to)
|
||||
time.Sleep(time.Duration(to) * time.Millisecond)
|
||||
} else {
|
||||
log.Fatal("Central server currently unavailable")
|
||||
}
|
||||
}
|
||||
//t.client = pb.NewManagementClient(conn)
|
||||
break;
|
||||
}
|
||||
// handle handshake logic here
|
||||
client := pb.NewHandshakeClient(conn)
|
||||
req := &pb.TUIClientRequest{ClientId:10120}
|
||||
resp, err := client.TUIClientDiscoveryHandler(context.Background(),req)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
// setting up server connection with provided port
|
||||
t.Ip = resp.GetServerIp()
|
||||
t.Port = int(resp.GetServerPort())
|
||||
for {
|
||||
conn, err = grpc.Dial(fmt.Sprintf("%v:%v",t.Ip,t.Port),opts...)
|
||||
code := status.Code(err)
|
||||
if code != 0 {
|
||||
if code == (5 | 14) {
|
||||
to := t.Timeout()
|
||||
if to == 0 {
|
||||
log.Fatal("Failed to connect to central server")
|
||||
}
|
||||
fmt.Printf("Server currently down, reconnecting in %v ms\n",to)
|
||||
time.Sleep(time.Duration(to) * time.Millisecond)
|
||||
} else {
|
||||
log.Fatal("Central server currently unavailable")
|
||||
}
|
||||
}
|
||||
t.client = pb.NewManagementClient(conn)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
func (t *TUIClient) GetReactors() (map[uint32]*Reactor, error) {
|
||||
req := &pb.GetReactorsRequest{}
|
||||
r := make(map[uint32]*Reactor)
|
||||
resp, err := t.client.GetReactors(context.Background(), req)
|
||||
if err != nil {
|
||||
return r, err
|
||||
}
|
||||
for _, v := range resp.GetReactors() {
|
||||
m := make(map[int]*Device)
|
||||
r[v.GetId()] = &Reactor{Status:v.GetStatus(),Devices:m}
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func (t *TUIClient) GetReactorDevices(id uint32) (map[int]*Device, error) {
|
||||
req := &pb.GetReactorDevicesRequest{}
|
||||
r := make(map[int]*Device)
|
||||
resp, err := t.client.GetReactorDevices(context.Background(), req)
|
||||
if err != nil {
|
||||
return r, nil
|
||||
}
|
||||
for _, v := range resp.GetDevices() {
|
||||
r[int(v.GetAddr())] = &Device{Type:v.GetType(),Status:v.GetStatus()}
|
||||
}
|
||||
return r, err
|
||||
}
|
||||
|
||||
func (t *TUIClient) DeleteReactor(id uint32) error {
|
||||
req := &pb.DeleteReactorRequest{}
|
||||
_, err := t.client.DeleteReactor(context.Background(), req)
|
||||
return err
|
||||
}
|
||||
|
||||
func (t *TUIClient) DeleteReactorDevice(id uint32, addr int) error {
|
||||
req := &pb.DeleteReactorDeviceRequest{}
|
||||
_, err := t.client.DeleteReactorDevice(context.Background(), req)
|
||||
return err
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package tui
|
||||
|
||||
import (
|
||||
_ "fmt"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type LocalView struct {
|
||||
sync.Mutex
|
||||
Reactors map[uint32]*Reactor
|
||||
*TUIClient // embedding for easy grpc calls
|
||||
}
|
||||
|
||||
type Reactor struct {
|
||||
Status bool
|
||||
Devices map[int]*Device
|
||||
}
|
||||
|
||||
type Device struct {
|
||||
Type string
|
||||
Status string
|
||||
Data string
|
||||
}
|
||||
|
||||
func (l *LocalView) UpdateReactors(id uint32, r *Reactor) {
|
||||
l.Lock()
|
||||
defer l.Unlock()
|
||||
l.Reactors[id] = r
|
||||
}
|
||||
|
||||
func (l *LocalView) UpdateReactorDevices(id uint32, addr int, d *Device) {
|
||||
l.Lock()
|
||||
defer l.Unlock()
|
||||
if _, exists := l.Reactors[id]; !exists {
|
||||
m := make(map[int]*Device)
|
||||
l.Reactors[id] = &Reactor{Devices:m}
|
||||
l.Reactors[id].Devices[addr] = d
|
||||
}
|
||||
l.Reactors[id].Devices[addr] = d
|
||||
}
|
||||
|
||||
func (l *LocalView) GetReactors() map[uint32]bool {
|
||||
l.Lock()
|
||||
defer l.Unlock()
|
||||
r := make(map[uint32]bool)
|
||||
for a,s := range l.Reactors {
|
||||
r[a] = s.Status
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func (l *LocalView) GetReactorDevices(id uint32) map[int]*Device {
|
||||
l.Lock()
|
||||
defer l.Unlock()
|
||||
return l.Reactors[id].Devices
|
||||
}
|
@ -1,145 +1,171 @@
|
||||
package tui
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"fmt"
|
||||
"log"
|
||||
"strconv"
|
||||
"time"
|
||||
"github.com/rivo/tview"
|
||||
tcell "github.com/gdamore/tcell/v2"
|
||||
_ "github.com/gdamore/tcell/v2"
|
||||
)
|
||||
// gonna start from scratch :/
|
||||
type TUI struct {
|
||||
*Display
|
||||
*LocalView
|
||||
*TUIClient
|
||||
SelectedReactor <-chan uint32
|
||||
Err chan error
|
||||
}
|
||||
|
||||
type System struct {
|
||||
// struct to hold actual system state
|
||||
Display
|
||||
Connected map[uint32]*Reactor
|
||||
err chan error
|
||||
|
||||
|
||||
type Display struct {
|
||||
app *tview.Application
|
||||
flex *tview.Flex
|
||||
reactorlist *tview.List
|
||||
sensortable *tview.Table
|
||||
mu sync.Mutex
|
||||
func NewTUI(ip string, port int, ch chan error) *TUI {
|
||||
r := make(map[uint32]*Reactor)
|
||||
t := &TUI{}
|
||||
l := new(LocalView)
|
||||
l.Reactors = r
|
||||
t.LocalView = l
|
||||
c := make(chan uint32)
|
||||
t.Display = NewDisplay(c)
|
||||
t.SelectedReactor = c
|
||||
t.Err = ch
|
||||
client := NewTUIClient(ip, port)
|
||||
t.TUIClient = client
|
||||
return t
|
||||
}
|
||||
|
||||
type Reactor struct {
|
||||
Index int // index into list
|
||||
Id uint32
|
||||
Ip string
|
||||
Port int
|
||||
Model string
|
||||
Status bool
|
||||
Sensors map[int]*Sensor
|
||||
func (t *TUI) Start() {
|
||||
// setup tview app and wait for user connection in standin modal
|
||||
t.Display.Start()
|
||||
t.Connect()
|
||||
go t.Monitor()
|
||||
go t.Listen()
|
||||
//go t.Refresh()
|
||||
}
|
||||
|
||||
func (r Reactor) String() string {
|
||||
s := ""
|
||||
if r.Status {
|
||||
s = "[green]ONLINE"
|
||||
} else {
|
||||
s = "[red]OFFLINE"
|
||||
func (t *TUI) Refresh() {
|
||||
for {
|
||||
//
|
||||
}
|
||||
}
|
||||
func (t *TUI) Listen() {
|
||||
for {
|
||||
select {
|
||||
case <-t.SelectedReactor:
|
||||
//blah
|
||||
}
|
||||
}
|
||||
return fmt.Sprintf("Reactor %v (%v) is %v on %v:%v",r.Id,r.Model,s,r.Ip,r.Port)
|
||||
}
|
||||
|
||||
type Sensor struct {
|
||||
Id uint32
|
||||
Addr int
|
||||
Type string
|
||||
Status string
|
||||
func (t *TUI) Monitor() {
|
||||
// orchestrates updates and grpc requests
|
||||
timer := make(chan struct{})
|
||||
go func(signal chan struct{}){
|
||||
for {
|
||||
signal <- struct{}{}
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
}(timer)
|
||||
|
||||
for {
|
||||
select {
|
||||
case reactor := <-t.SelectedReactor:
|
||||
// reactor has been selected in tui, grabbing devs
|
||||
go t.UpdateDevices(reactor)
|
||||
//devs := t.GetReactorDevices(reactor)
|
||||
//t.DisplayReactorDevices(devs)
|
||||
case <-timer:
|
||||
// time to ping for status
|
||||
go t.UpdateReactors()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func NewDisplay(ch chan error) *Display {
|
||||
m := make(map[uint32]*Reactor)
|
||||
a := tview.NewApplication()
|
||||
f := tview.NewFlex()
|
||||
f.AddItem(tview.NewBox().SetTitle("Connected Reactors").SetBorder(true),0,1, true)
|
||||
f.AddItem(tview.NewBox().SetTitle("Sensor Info").SetBorder(true),0,2, false)
|
||||
if err := a.SetRoot(f,true).SetFocus(f).Run(); err != nil {
|
||||
panic(err)
|
||||
func (t *TUI) UpdateDevices(r uint32) {
|
||||
// get devices for the reactor and update the tui
|
||||
devs, err := t.TUIClient.GetReactorDevices(r)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
a.Stop()
|
||||
return &Display{app:a,Connected:m,err:ch}
|
||||
for a, d := range devs {
|
||||
go t.LocalView.UpdateReactorDevices(r,a,d)
|
||||
}
|
||||
t.DisplayReactorDevices(devs)
|
||||
}
|
||||
|
||||
func NewReactor(ip,model string, status bool, id uint32, port int) *Reactor {
|
||||
s := map[int]*Sensor{}
|
||||
return &Reactor{Ip:ip,Model:model,Status:status,Id:id,Port:port,Sensors:s}
|
||||
func (t *TUI) UpdateReactors() {
|
||||
// get all reactors and update the tui
|
||||
reactors, err := t.TUIClient.GetReactors()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
for id, r := range reactors {
|
||||
go t.LocalView.UpdateReactors(id, r)
|
||||
}
|
||||
t.DisplayReactors(reactors)
|
||||
}
|
||||
|
||||
func NewSensor(addr int, t, status string) *Sensor {
|
||||
return &Sensor{Addr:addr,Type:t,Status:status}
|
||||
|
||||
// display struct and logic
|
||||
type Display struct {
|
||||
App *tview.Application
|
||||
Flex *tview.Flex
|
||||
ReactorList *tview.List
|
||||
DeviceList *tview.List
|
||||
SelectedReactor chan<- uint32
|
||||
}
|
||||
|
||||
func (d *Display) Start () {
|
||||
go d.Refresh()
|
||||
func NewDisplay(ch chan uint32) *Display {
|
||||
d := &Display{}
|
||||
d.App = tview.NewApplication()
|
||||
d.Flex = tview.NewFlex()
|
||||
d.ReactorList = tview.NewList().ShowSecondaryText(false)
|
||||
d.DeviceList = tview.NewList().ShowSecondaryText(false)
|
||||
d.SelectedReactor = ch
|
||||
d.ReactorList.SetSelectedFunc(d.SelectReactor)
|
||||
return d
|
||||
}
|
||||
|
||||
func (d *Display) UpdateReactor(r *Reactor) {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
if _, ok := d.Connected[r.Id]; ok {
|
||||
// reactor exists in memory
|
||||
d.Connected[r.Id] = r
|
||||
d.reactorlist.SetItemText(r.Index,fmt.Sprint(r),"")
|
||||
} else {
|
||||
r.Index = d.reactorlist.GetItemCount() // get before adding
|
||||
d.reactorlist.AddItem(fmt.Sprint(r),"",rune(r.Index), func () {d.SelectSensor(r.Id)})
|
||||
func (d *Display) Start() {
|
||||
d.Flex.AddItem(d.ReactorList.SetBorder(true).SetTitle("Reactors"),0,1,true)
|
||||
d.Flex.AddItem(d.DeviceList.SetBorder(true).SetTitle("Devices"),0,3,false)
|
||||
if err := d.App.SetRoot(d.Flex, true).Run(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
d.app.Run()
|
||||
d.app.Stop()
|
||||
}
|
||||
|
||||
func (d *Display) UpdateSensor(s *Sensor) {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
if r,ok := d.Connected[s.Id]; ok {
|
||||
r.Sensors[s.Addr] = s
|
||||
func (d *Display) DisplayReactors(r map[uint32]*Reactor) {
|
||||
// function to display reactor list to table
|
||||
for id, reactor := range r {
|
||||
var status string
|
||||
if reactor.Status {
|
||||
status = "[green]ONLINE"
|
||||
} else {
|
||||
status = "[red]OFFLINE"
|
||||
}
|
||||
txt := fmt.Sprintf("Reactor %v is %v", id, status)
|
||||
d.ReactorList.AddItem(txt,string(id),0,nil)
|
||||
}
|
||||
}
|
||||
|
||||
func (d *Display) SelectSensor(id uint32) {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
if reactor, ok := d.Connected[id]; ok {
|
||||
d.sensortable.Clear()
|
||||
row := 0
|
||||
ch := []string{"Type","Addr","Status"}
|
||||
for i,v := range ch {
|
||||
// create column headings
|
||||
c := tview.NewTableCell(v).SetTextColor(tcell.ColorGray)
|
||||
d.sensortable.SetCell(row,i,c)
|
||||
}
|
||||
row += 1
|
||||
for a,s := range reactor.Sensors {
|
||||
addr := tview.NewTableCell(string(a))
|
||||
typ := tview.NewTableCell(s.Type)
|
||||
st := ""
|
||||
col := tcell.ColorWhite
|
||||
if s.Status == "ACTIVE" {
|
||||
col = tcell.ColorGreen
|
||||
} else if s.Status == "KILLED" {
|
||||
col = tcell.ColorRed
|
||||
} else {
|
||||
st = "UNKNOWN"
|
||||
col = tcell.ColorYellow
|
||||
}
|
||||
status := tview.NewTableCell(st).SetTextColor(col)
|
||||
d.sensortable.SetCell(row,0,typ)
|
||||
d.sensortable.SetCell(row,1,addr)
|
||||
d.sensortable.SetCell(row,2,status)
|
||||
row += 1
|
||||
}
|
||||
func (d *Display) SelectReactor(index int, main, id string, r rune) {
|
||||
// called when reactor in list in selected
|
||||
if id, err := strconv.Atoi(id); err != nil {
|
||||
log.Fatal(err)
|
||||
} else {
|
||||
d.SelectedReactor <-uint32(id)
|
||||
}
|
||||
}
|
||||
|
||||
func (d *Display) Refresh() {
|
||||
tick := time.NewTicker(500 * time.Millisecond)
|
||||
for {
|
||||
select {
|
||||
case <-tick.C:
|
||||
d.app.Draw()
|
||||
func (d *Display) DisplayReactorDevices(devs map[int]*Device) {
|
||||
//Function that displays devices to the table
|
||||
d.DeviceList.Clear()
|
||||
for addr, dev := range devs {
|
||||
var status string
|
||||
if dev.Status == "ACTIVE" {
|
||||
status = "[green]ACTIVE[white]"
|
||||
} else if dev.Status == "KILLED" {
|
||||
status = "[red]KILLED[white]"
|
||||
}
|
||||
txt := fmt.Sprintf("%v is %v at %x",dev.Type,status,addr)
|
||||
d.DeviceList.AddItem(txt,"",0,nil)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue