diff --git a/README.md b/README.md index 83715d23..b61969de 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,22 @@ given. Once the config file is set, run the following command from the root dire docker-compose up ``` +## Proto + +### Pre-requisites + +To generate the protobuf files, you need to have the following installed: + +- [Buf](https://buf.build/docs/installation) + +### Generate + +To generate the protobuf files, run the following command: + +```bash +buf generate +``` + ## Contributing We welcome contributions from the community! Before submitting a pull request, please review diff --git a/bothan-api/client/go-client/client.go b/bothan-api/client/go-client/client.go index b90a661a..2d280219 100644 --- a/bothan-api/client/go-client/client.go +++ b/bothan-api/client/go-client/client.go @@ -1,13 +1,12 @@ package client import ( - "github.com/bandprotocol/bothan/bothan-api/client/go-client/proto/price" - "github.com/bandprotocol/bothan/bothan-api/client/go-client/proto/signal" + "github.com/bandprotocol/bothan/bothan-api/client/go-client/proto/bothan/v1" ) type Client interface { - GetInfo() (*signal.GetInfoResponse, error) + GetInfo() (*proto.GetInfoResponse, error) UpdateRegistry(ipfsHash string, version string) error PushMonitoringRecords(uuid, txHash string) error - GetPrices(signalIDs []string) (*price.GetPricesResponse, error) + GetPrices(signalIDs []string) (*proto.GetPricesResponse, error) } diff --git a/bothan-api/client/go-client/go.mod b/bothan-api/client/go-client/go.mod index 64459c50..8e1d1a8d 100644 --- a/bothan-api/client/go-client/go.mod +++ b/bothan-api/client/go-client/go.mod @@ -3,17 +3,17 @@ module github.com/bandprotocol/bothan/bothan-api/client/go-client go 1.22.0 require ( - github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 + github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 github.com/levigross/grequests v0.0.0-20231203190023-9c307ef1f48d - google.golang.org/genproto/googleapis/api v0.0.0-20240506185236-b8a5c65736ae - google.golang.org/grpc v1.63.2 - google.golang.org/protobuf v1.34.1 + google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38 + google.golang.org/grpc v1.67.1 + google.golang.org/protobuf v1.35.1 ) require ( github.com/google/go-querystring v1.1.0 // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/sys v0.17.0 // indirect - golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/text v0.17.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect ) diff --git a/bothan-api/client/go-client/go.sum b/bothan-api/client/go-client/go.sum index 41f0d25e..7c6265dd 100644 --- a/bothan-api/client/go-client/go.sum +++ b/bothan-api/client/go-client/go.sum @@ -5,20 +5,47 @@ github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 h1:/c3QmbOGMGTOumP2iT/rCwB7b0QDGLKzqOmktBjT+Is= github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1/go.mod h1:5SN9VR2LTsRFsrEC6FHgRbTWrTHu6tqPeKxEQv15giM= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I= github.com/levigross/grequests v0.0.0-20231203190023-9c307ef1f48d h1:8fVmm2qScPn4JAF/YdTtqrPP3n58FgZ4GbKTNfaPuRs= github.com/levigross/grequests v0.0.0-20231203190023-9c307ef1f48d/go.mod h1:dFu6nuJHC3u9kCDcyGrEL7LwhK2m6Mt+alyiiIjDrRY= golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/api v0.0.0-20240506185236-b8a5c65736ae h1:AH34z6WAGVNkllnKs5raNq3yRq93VnjBG6rpfub/jYk= google.golang.org/genproto/googleapis/api v0.0.0-20240506185236-b8a5c65736ae/go.mod h1:FfiGhwUm6CJviekPrc0oJ+7h29e+DmWU6UtjX0ZvI7Y= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= +google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38 h1:2oV8dfuIkM1Ti7DwXc0BJfnwr9csz4TDXI9EmiI+Rbw= +google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38/go.mod h1:vuAjtvlwkDKF6L1GQ0SokiRLCGFfeBUXWr/aFFkHACc= google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6 h1:DujSIu+2tC9Ht0aPNA7jgj23Iq8Ewi5sgkQ++wdvonE= google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 h1:X58yt85/IXCx0Y3ZwN6sEIKZzQtDEYaBWrDvErdXrRE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= +google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= diff --git a/bothan-api/client/go-client/grpc.go b/bothan-api/client/go-client/grpc.go index 004a3944..e3b35b9e 100644 --- a/bothan-api/client/go-client/grpc.go +++ b/bothan-api/client/go-client/grpc.go @@ -6,10 +6,8 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" - "google.golang.org/protobuf/types/known/emptypb" - "github.com/bandprotocol/bothan/bothan-api/client/go-client/proto/price" - "github.com/bandprotocol/bothan/bothan-api/client/go-client/proto/signal" + "github.com/bandprotocol/bothan/bothan-api/client/go-client/proto/bothan/v1" ) var _ Client = &GrpcClient{} @@ -27,37 +25,37 @@ func NewGrpcClient(url string, timeout time.Duration) (*GrpcClient, error) { return &GrpcClient{connection, timeout}, nil } -func (c *GrpcClient) GetInfo() (*signal.GetInfoResponse, error) { - client := signal.NewSignalServiceClient(c.connection) +func (c *GrpcClient) GetInfo() (*proto.GetInfoResponse, error) { + client := proto.NewBothanServiceClient(c.connection) ctx, cancel := context.WithTimeout(context.Background(), c.timeout) defer cancel() - return client.GetInfo(ctx, &emptypb.Empty{}) + return client.GetInfo(ctx, &proto.GetInfoRequest{}) } func (c *GrpcClient) UpdateRegistry(ipfsHash string, version string) error { - client := signal.NewSignalServiceClient(c.connection) + client := proto.NewBothanServiceClient(c.connection) ctx, cancel := context.WithTimeout(context.Background(), c.timeout) defer cancel() - _, err := client.UpdateRegistry(ctx, &signal.UpdateRegistryRequest{IpfsHash: ipfsHash, Version: version}) + _, err := client.UpdateRegistry(ctx, &proto.UpdateRegistryRequest{IpfsHash: ipfsHash, Version: version}) return err } func (c *GrpcClient) PushMonitoringRecords(uuid, txHash string) error { - client := signal.NewSignalServiceClient(c.connection) + client := proto.NewBothanServiceClient(c.connection) ctx, cancel := context.WithTimeout(context.Background(), c.timeout) defer cancel() - _, err := client.PushMonitoringRecords(ctx, &signal.PushMonitoringRecordsRequest{Uuid: uuid, TxHash: txHash}) + _, err := client.PushMonitoringRecords(ctx, &proto.PushMonitoringRecordsRequest{Uuid: uuid, TxHash: txHash}) return err } -func (c *GrpcClient) GetPrices(signalIDs []string) (*price.GetPricesResponse, error) { +func (c *GrpcClient) GetPrices(signalIDs []string) (*proto.GetPricesResponse, error) { // Create a client instance using the connection. - client := price.NewPriceServiceClient(c.connection) + client := proto.NewBothanServiceClient(c.connection) ctx, cancel := context.WithTimeout(context.Background(), c.timeout) defer cancel() - return client.GetPrices(ctx, &price.GetPricesRequest{SignalIds: signalIDs}) + return client.GetPrices(ctx, &proto.GetPricesRequest{SignalIds: signalIDs}) } diff --git a/bothan-api/client/go-client/proto/bothan/v1/bothan.pb.go b/bothan-api/client/go-client/proto/bothan/v1/bothan.pb.go new file mode 100644 index 00000000..a53d2ba6 --- /dev/null +++ b/bothan-api/client/go-client/proto/bothan/v1/bothan.pb.go @@ -0,0 +1,820 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.0 +// protoc (unknown) +// source: bothan/v1/bothan.proto + +package proto + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + 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) +) + +// Status defines the status for a signal ID. +type Status int32 + +const ( + // Default status, should not be used. + Status_STATUS_UNSPECIFIED Status = 0 + // Indicates that the signal ID is not supported. + Status_STATUS_UNSUPPORTED Status = 1 + // Indicates that the signal ID is currently unavailable. + Status_STATUS_UNAVAILABLE Status = 2 + // Indicates that the signal ID is available. + Status_STATUS_AVAILABLE Status = 3 +) + +// Enum value maps for Status. +var ( + Status_name = map[int32]string{ + 0: "STATUS_UNSPECIFIED", + 1: "STATUS_UNSUPPORTED", + 2: "STATUS_UNAVAILABLE", + 3: "STATUS_AVAILABLE", + } + Status_value = map[string]int32{ + "STATUS_UNSPECIFIED": 0, + "STATUS_UNSUPPORTED": 1, + "STATUS_UNAVAILABLE": 2, + "STATUS_AVAILABLE": 3, + } +) + +func (x Status) Enum() *Status { + p := new(Status) + *p = x + return p +} + +func (x Status) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Status) Descriptor() protoreflect.EnumDescriptor { + return file_bothan_v1_bothan_proto_enumTypes[0].Descriptor() +} + +func (Status) Type() protoreflect.EnumType { + return &file_bothan_v1_bothan_proto_enumTypes[0] +} + +func (x Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Status.Descriptor instead. +func (Status) EnumDescriptor() ([]byte, []int) { + return file_bothan_v1_bothan_proto_rawDescGZIP(), []int{0} +} + +// GetInfoRequest defines the request message for the GetInfo RPC method. +type GetInfoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetInfoRequest) Reset() { + *x = GetInfoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_bothan_v1_bothan_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetInfoRequest) ProtoMessage() {} + +func (x *GetInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_bothan_v1_bothan_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 GetInfoRequest.ProtoReflect.Descriptor instead. +func (*GetInfoRequest) Descriptor() ([]byte, []int) { + return file_bothan_v1_bothan_proto_rawDescGZIP(), []int{0} +} + +// GetInfoResponse defines the response message for the GetInfo RPC method. +type GetInfoResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The bothan version + BothanVersion string `protobuf:"bytes,1,opt,name=bothan_version,json=bothanVersion,proto3" json:"bothan_version,omitempty"` + // The IPFS hash pointing to the registry data. + RegistryIpfsHash string `protobuf:"bytes,2,opt,name=registry_ipfs_hash,json=registryIpfsHash,proto3" json:"registry_ipfs_hash,omitempty"` + // The version requirements for the registry. + RegistryVersionRequirement string `protobuf:"bytes,3,opt,name=registry_version_requirement,json=registryVersionRequirement,proto3" json:"registry_version_requirement,omitempty"` +} + +func (x *GetInfoResponse) Reset() { + *x = GetInfoResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_bothan_v1_bothan_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetInfoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetInfoResponse) ProtoMessage() {} + +func (x *GetInfoResponse) ProtoReflect() protoreflect.Message { + mi := &file_bothan_v1_bothan_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 GetInfoResponse.ProtoReflect.Descriptor instead. +func (*GetInfoResponse) Descriptor() ([]byte, []int) { + return file_bothan_v1_bothan_proto_rawDescGZIP(), []int{1} +} + +func (x *GetInfoResponse) GetBothanVersion() string { + if x != nil { + return x.BothanVersion + } + return "" +} + +func (x *GetInfoResponse) GetRegistryIpfsHash() string { + if x != nil { + return x.RegistryIpfsHash + } + return "" +} + +func (x *GetInfoResponse) GetRegistryVersionRequirement() string { + if x != nil { + return x.RegistryVersionRequirement + } + return "" +} + +// UpdateRegistryRequest defines the request message for the UpdateRegistry RPC method. +type UpdateRegistryRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The IPFS hash pointing to the registry data. + IpfsHash string `protobuf:"bytes,1,opt,name=ipfs_hash,json=ipfsHash,proto3" json:"ipfs_hash,omitempty"` + // The version of the registry. + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *UpdateRegistryRequest) Reset() { + *x = UpdateRegistryRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_bothan_v1_bothan_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateRegistryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateRegistryRequest) ProtoMessage() {} + +func (x *UpdateRegistryRequest) ProtoReflect() protoreflect.Message { + mi := &file_bothan_v1_bothan_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 UpdateRegistryRequest.ProtoReflect.Descriptor instead. +func (*UpdateRegistryRequest) Descriptor() ([]byte, []int) { + return file_bothan_v1_bothan_proto_rawDescGZIP(), []int{2} +} + +func (x *UpdateRegistryRequest) GetIpfsHash() string { + if x != nil { + return x.IpfsHash + } + return "" +} + +func (x *UpdateRegistryRequest) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +// UpdateRegistryResponse defines the response message for the UpdateRegistry RPC method. +type UpdateRegistryResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateRegistryResponse) Reset() { + *x = UpdateRegistryResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_bothan_v1_bothan_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateRegistryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateRegistryResponse) ProtoMessage() {} + +func (x *UpdateRegistryResponse) ProtoReflect() protoreflect.Message { + mi := &file_bothan_v1_bothan_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 UpdateRegistryResponse.ProtoReflect.Descriptor instead. +func (*UpdateRegistryResponse) Descriptor() ([]byte, []int) { + return file_bothan_v1_bothan_proto_rawDescGZIP(), []int{3} +} + +// PushMonitoringRecordsRequest defines the request message for the PushMonitoringRecords RPC method. +type PushMonitoringRecordsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The uuid of a list of monitoring records to be pushed to the monitoring service. + Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` + // The tx hash of the transaction associated with the monitoring records. + TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` +} + +func (x *PushMonitoringRecordsRequest) Reset() { + *x = PushMonitoringRecordsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_bothan_v1_bothan_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PushMonitoringRecordsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PushMonitoringRecordsRequest) ProtoMessage() {} + +func (x *PushMonitoringRecordsRequest) ProtoReflect() protoreflect.Message { + mi := &file_bothan_v1_bothan_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 PushMonitoringRecordsRequest.ProtoReflect.Descriptor instead. +func (*PushMonitoringRecordsRequest) Descriptor() ([]byte, []int) { + return file_bothan_v1_bothan_proto_rawDescGZIP(), []int{4} +} + +func (x *PushMonitoringRecordsRequest) GetUuid() string { + if x != nil { + return x.Uuid + } + return "" +} + +func (x *PushMonitoringRecordsRequest) GetTxHash() string { + if x != nil { + return x.TxHash + } + return "" +} + +// PushMonitoringRecordsResponse defines the response message for the PushMonitoringRecords RPC method. +type PushMonitoringRecordsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PushMonitoringRecordsResponse) Reset() { + *x = PushMonitoringRecordsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_bothan_v1_bothan_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PushMonitoringRecordsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PushMonitoringRecordsResponse) ProtoMessage() {} + +func (x *PushMonitoringRecordsResponse) ProtoReflect() protoreflect.Message { + mi := &file_bothan_v1_bothan_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 PushMonitoringRecordsResponse.ProtoReflect.Descriptor instead. +func (*PushMonitoringRecordsResponse) Descriptor() ([]byte, []int) { + return file_bothan_v1_bothan_proto_rawDescGZIP(), []int{5} +} + +// GetPricesRequest defines the request message for the GetPrices RPC method. +type GetPricesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A list of signal IDs for which the prices are being requested. + SignalIds []string `protobuf:"bytes,1,rep,name=signal_ids,json=signalIds,proto3" json:"signal_ids,omitempty"` +} + +func (x *GetPricesRequest) Reset() { + *x = GetPricesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_bothan_v1_bothan_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPricesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPricesRequest) ProtoMessage() {} + +func (x *GetPricesRequest) ProtoReflect() protoreflect.Message { + mi := &file_bothan_v1_bothan_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 GetPricesRequest.ProtoReflect.Descriptor instead. +func (*GetPricesRequest) Descriptor() ([]byte, []int) { + return file_bothan_v1_bothan_proto_rawDescGZIP(), []int{6} +} + +func (x *GetPricesRequest) GetSignalIds() []string { + if x != nil { + return x.SignalIds + } + return nil +} + +// GetPricesResponse defines the response message for the GetPrices RPC method. +type GetPricesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A unique identifier for the response. + Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` + // A list of prices for the requested signal IDs. + Prices []*Price `protobuf:"bytes,2,rep,name=prices,proto3" json:"prices,omitempty"` +} + +func (x *GetPricesResponse) Reset() { + *x = GetPricesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_bothan_v1_bothan_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPricesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPricesResponse) ProtoMessage() {} + +func (x *GetPricesResponse) ProtoReflect() protoreflect.Message { + mi := &file_bothan_v1_bothan_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 GetPricesResponse.ProtoReflect.Descriptor instead. +func (*GetPricesResponse) Descriptor() ([]byte, []int) { + return file_bothan_v1_bothan_proto_rawDescGZIP(), []int{7} +} + +func (x *GetPricesResponse) GetUuid() string { + if x != nil { + return x.Uuid + } + return "" +} + +func (x *GetPricesResponse) GetPrices() []*Price { + if x != nil { + return x.Prices + } + return nil +} + +// Price defines the price information for a signal ID. +type Price struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The signal ID. + SignalId string `protobuf:"bytes,1,opt,name=signal_id,json=signalId,proto3" json:"signal_id,omitempty"` + // The price value associated with this signal ID. + Price uint64 `protobuf:"varint,2,opt,name=price,proto3" json:"price,omitempty"` + // The status of the signal ID. + Status Status `protobuf:"varint,3,opt,name=status,proto3,enum=bothan.v1.Status" json:"status,omitempty"` +} + +func (x *Price) Reset() { + *x = Price{} + if protoimpl.UnsafeEnabled { + mi := &file_bothan_v1_bothan_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Price) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Price) ProtoMessage() {} + +func (x *Price) ProtoReflect() protoreflect.Message { + mi := &file_bothan_v1_bothan_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 Price.ProtoReflect.Descriptor instead. +func (*Price) Descriptor() ([]byte, []int) { + return file_bothan_v1_bothan_proto_rawDescGZIP(), []int{8} +} + +func (x *Price) GetSignalId() string { + if x != nil { + return x.SignalId + } + return "" +} + +func (x *Price) GetPrice() uint64 { + if x != nil { + return x.Price + } + return 0 +} + +func (x *Price) GetStatus() Status { + if x != nil { + return x.Status + } + return Status_STATUS_UNSPECIFIED +} + +var File_bothan_v1_bothan_proto protoreflect.FileDescriptor + +var file_bothan_v1_bothan_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x62, 0x6f, 0x74, 0x68, 0x61, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x6f, 0x74, 0x68, + 0x61, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x62, 0x6f, 0x74, 0x68, 0x61, 0x6e, + 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x10, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0xa8, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x62, 0x6f, 0x74, 0x68, 0x61, + 0x6e, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0d, 0x62, 0x6f, 0x74, 0x68, 0x61, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2c, + 0x0a, 0x12, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x69, 0x70, 0x66, 0x73, 0x5f, + 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x49, 0x70, 0x66, 0x73, 0x48, 0x61, 0x73, 0x68, 0x12, 0x40, 0x0a, 0x1c, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x1a, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x4e, + 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x70, 0x66, 0x73, 0x5f, + 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x70, 0x66, 0x73, + 0x48, 0x61, 0x73, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x18, + 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4b, 0x0a, 0x1c, 0x50, 0x75, 0x73, 0x68, + 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x07, + 0x74, 0x78, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, + 0x78, 0x48, 0x61, 0x73, 0x68, 0x22, 0x1f, 0x0a, 0x1d, 0x50, 0x75, 0x73, 0x68, 0x4d, 0x6f, 0x6e, + 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x31, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x50, 0x72, 0x69, + 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x49, 0x64, 0x73, 0x22, 0x51, 0x0a, 0x11, 0x47, 0x65, 0x74, + 0x50, 0x72, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, + 0x69, 0x64, 0x12, 0x28, 0x0a, 0x06, 0x70, 0x72, 0x69, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x62, 0x6f, 0x74, 0x68, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, + 0x72, 0x69, 0x63, 0x65, 0x52, 0x06, 0x70, 0x72, 0x69, 0x63, 0x65, 0x73, 0x22, 0x65, 0x0a, 0x05, + 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, + 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x62, 0x6f, 0x74, 0x68, 0x61, + 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x2a, 0x66, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, + 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, + 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, + 0x55, 0x4e, 0x53, 0x55, 0x50, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x16, 0x0a, + 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x41, 0x56, 0x41, 0x49, 0x4c, 0x41, + 0x42, 0x4c, 0x45, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, + 0x41, 0x56, 0x41, 0x49, 0x4c, 0x41, 0x42, 0x4c, 0x45, 0x10, 0x03, 0x32, 0xba, 0x03, 0x0a, 0x0d, + 0x42, 0x6f, 0x74, 0x68, 0x61, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4f, 0x0a, + 0x07, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x2e, 0x62, 0x6f, 0x74, 0x68, 0x61, + 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x62, 0x6f, 0x74, 0x68, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x0d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x07, 0x12, 0x05, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x68, + 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x12, 0x20, 0x2e, 0x62, 0x6f, 0x74, 0x68, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x6f, 0x74, 0x68, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x11, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x22, 0x09, 0x2f, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x12, 0x87, 0x01, 0x0a, 0x15, 0x50, 0x75, 0x73, + 0x68, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x73, 0x12, 0x27, 0x2e, 0x62, 0x6f, 0x74, 0x68, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, + 0x75, 0x73, 0x68, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x62, 0x6f, + 0x74, 0x68, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x4d, 0x6f, 0x6e, 0x69, + 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x22, 0x13, 0x2f, + 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x73, 0x12, 0x64, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x73, 0x12, + 0x1b, 0x2e, 0x62, 0x6f, 0x74, 0x68, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, + 0x72, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x62, + 0x6f, 0x74, 0x68, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x69, 0x63, + 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x16, 0x12, 0x14, 0x2f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x73, 0x7d, 0x42, 0x2b, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x6f, 0x74, 0x68, 0x61, 0x6e, 0x2f, 0x62, 0x6f, + 0x74, 0x68, 0x61, 0x6e, 0x2d, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_bothan_v1_bothan_proto_rawDescOnce sync.Once + file_bothan_v1_bothan_proto_rawDescData = file_bothan_v1_bothan_proto_rawDesc +) + +func file_bothan_v1_bothan_proto_rawDescGZIP() []byte { + file_bothan_v1_bothan_proto_rawDescOnce.Do(func() { + file_bothan_v1_bothan_proto_rawDescData = protoimpl.X.CompressGZIP(file_bothan_v1_bothan_proto_rawDescData) + }) + return file_bothan_v1_bothan_proto_rawDescData +} + +var file_bothan_v1_bothan_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_bothan_v1_bothan_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_bothan_v1_bothan_proto_goTypes = []interface{}{ + (Status)(0), // 0: bothan.v1.Status + (*GetInfoRequest)(nil), // 1: bothan.v1.GetInfoRequest + (*GetInfoResponse)(nil), // 2: bothan.v1.GetInfoResponse + (*UpdateRegistryRequest)(nil), // 3: bothan.v1.UpdateRegistryRequest + (*UpdateRegistryResponse)(nil), // 4: bothan.v1.UpdateRegistryResponse + (*PushMonitoringRecordsRequest)(nil), // 5: bothan.v1.PushMonitoringRecordsRequest + (*PushMonitoringRecordsResponse)(nil), // 6: bothan.v1.PushMonitoringRecordsResponse + (*GetPricesRequest)(nil), // 7: bothan.v1.GetPricesRequest + (*GetPricesResponse)(nil), // 8: bothan.v1.GetPricesResponse + (*Price)(nil), // 9: bothan.v1.Price +} +var file_bothan_v1_bothan_proto_depIdxs = []int32{ + 9, // 0: bothan.v1.GetPricesResponse.prices:type_name -> bothan.v1.Price + 0, // 1: bothan.v1.Price.status:type_name -> bothan.v1.Status + 1, // 2: bothan.v1.BothanService.GetInfo:input_type -> bothan.v1.GetInfoRequest + 3, // 3: bothan.v1.BothanService.UpdateRegistry:input_type -> bothan.v1.UpdateRegistryRequest + 5, // 4: bothan.v1.BothanService.PushMonitoringRecords:input_type -> bothan.v1.PushMonitoringRecordsRequest + 7, // 5: bothan.v1.BothanService.GetPrices:input_type -> bothan.v1.GetPricesRequest + 2, // 6: bothan.v1.BothanService.GetInfo:output_type -> bothan.v1.GetInfoResponse + 4, // 7: bothan.v1.BothanService.UpdateRegistry:output_type -> bothan.v1.UpdateRegistryResponse + 6, // 8: bothan.v1.BothanService.PushMonitoringRecords:output_type -> bothan.v1.PushMonitoringRecordsResponse + 8, // 9: bothan.v1.BothanService.GetPrices:output_type -> bothan.v1.GetPricesResponse + 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_bothan_v1_bothan_proto_init() } +func file_bothan_v1_bothan_proto_init() { + if File_bothan_v1_bothan_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_bothan_v1_bothan_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetInfoRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bothan_v1_bothan_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetInfoResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bothan_v1_bothan_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateRegistryRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bothan_v1_bothan_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateRegistryResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bothan_v1_bothan_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PushMonitoringRecordsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bothan_v1_bothan_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PushMonitoringRecordsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bothan_v1_bothan_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPricesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bothan_v1_bothan_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPricesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bothan_v1_bothan_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Price); 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_bothan_v1_bothan_proto_rawDesc, + NumEnums: 1, + NumMessages: 9, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_bothan_v1_bothan_proto_goTypes, + DependencyIndexes: file_bothan_v1_bothan_proto_depIdxs, + EnumInfos: file_bothan_v1_bothan_proto_enumTypes, + MessageInfos: file_bothan_v1_bothan_proto_msgTypes, + }.Build() + File_bothan_v1_bothan_proto = out.File + file_bothan_v1_bothan_proto_rawDesc = nil + file_bothan_v1_bothan_proto_goTypes = nil + file_bothan_v1_bothan_proto_depIdxs = nil +} diff --git a/bothan-api/client/go-client/proto/signal/signal.pb.gw.go b/bothan-api/client/go-client/proto/bothan/v1/bothan.pb.gw.go similarity index 53% rename from bothan-api/client/go-client/proto/signal/signal.pb.gw.go rename to bothan-api/client/go-client/proto/bothan/v1/bothan.pb.gw.go index a2c86ad7..67f2394d 100644 --- a/bothan-api/client/go-client/proto/signal/signal.pb.gw.go +++ b/bothan-api/client/go-client/proto/bothan/v1/bothan.pb.gw.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: proto/signal/signal.proto +// source: bothan/v1/bothan.proto /* -Package signal is a reverse proxy. +Package proto is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package signal +package proto import ( "context" @@ -21,7 +21,6 @@ import ( "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/emptypb" ) // Suppress "imported and not used" errors @@ -32,8 +31,8 @@ var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join -func request_SignalService_GetInfo_0(ctx context.Context, marshaler runtime.Marshaler, client SignalServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq emptypb.Empty +func request_BothanService_GetInfo_0(ctx context.Context, marshaler runtime.Marshaler, client BothanServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetInfoRequest var metadata runtime.ServerMetadata msg, err := client.GetInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -41,8 +40,8 @@ func request_SignalService_GetInfo_0(ctx context.Context, marshaler runtime.Mars } -func local_request_SignalService_GetInfo_0(ctx context.Context, marshaler runtime.Marshaler, server SignalServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq emptypb.Empty +func local_request_BothanService_GetInfo_0(ctx context.Context, marshaler runtime.Marshaler, server BothanServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetInfoRequest var metadata runtime.ServerMetadata msg, err := server.GetInfo(ctx, &protoReq) @@ -51,17 +50,17 @@ func local_request_SignalService_GetInfo_0(ctx context.Context, marshaler runtim } var ( - filter_SignalService_UpdateRegistry_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_BothanService_UpdateRegistry_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_SignalService_UpdateRegistry_0(ctx context.Context, marshaler runtime.Marshaler, client SignalServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_BothanService_UpdateRegistry_0(ctx context.Context, marshaler runtime.Marshaler, client BothanServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UpdateRegistryRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SignalService_UpdateRegistry_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BothanService_UpdateRegistry_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -70,14 +69,14 @@ func request_SignalService_UpdateRegistry_0(ctx context.Context, marshaler runti } -func local_request_SignalService_UpdateRegistry_0(ctx context.Context, marshaler runtime.Marshaler, server SignalServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_BothanService_UpdateRegistry_0(ctx context.Context, marshaler runtime.Marshaler, server BothanServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UpdateRegistryRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SignalService_UpdateRegistry_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BothanService_UpdateRegistry_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -87,17 +86,17 @@ func local_request_SignalService_UpdateRegistry_0(ctx context.Context, marshaler } var ( - filter_SignalService_PushMonitoringRecords_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_BothanService_PushMonitoringRecords_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_SignalService_PushMonitoringRecords_0(ctx context.Context, marshaler runtime.Marshaler, client SignalServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_BothanService_PushMonitoringRecords_0(ctx context.Context, marshaler runtime.Marshaler, client BothanServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq PushMonitoringRecordsRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SignalService_PushMonitoringRecords_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BothanService_PushMonitoringRecords_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -106,14 +105,14 @@ func request_SignalService_PushMonitoringRecords_0(ctx context.Context, marshale } -func local_request_SignalService_PushMonitoringRecords_0(ctx context.Context, marshaler runtime.Marshaler, server SignalServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_BothanService_PushMonitoringRecords_0(ctx context.Context, marshaler runtime.Marshaler, server BothanServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq PushMonitoringRecordsRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SignalService_PushMonitoringRecords_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BothanService_PushMonitoringRecords_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -122,13 +121,65 @@ func local_request_SignalService_PushMonitoringRecords_0(ctx context.Context, ma } -// RegisterSignalServiceHandlerServer registers the http handlers for service SignalService to "mux". -// UnaryRPC :call SignalServiceServer directly. +func request_BothanService_GetPrices_0(ctx context.Context, marshaler runtime.Marshaler, client BothanServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetPricesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["signal_ids"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "signal_ids") + } + + protoReq.SignalIds, err = runtime.StringSlice(val, ",") + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "signal_ids", err) + } + + msg, err := client.GetPrices(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_BothanService_GetPrices_0(ctx context.Context, marshaler runtime.Marshaler, server BothanServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetPricesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["signal_ids"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "signal_ids") + } + + protoReq.SignalIds, err = runtime.StringSlice(val, ",") + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "signal_ids", err) + } + + msg, err := server.GetPrices(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterBothanServiceHandlerServer registers the http handlers for service BothanService to "mux". +// UnaryRPC :call BothanServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSignalServiceHandlerFromEndpoint instead. -func RegisterSignalServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SignalServiceServer) error { +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterBothanServiceHandlerFromEndpoint instead. +func RegisterBothanServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BothanServiceServer) error { - mux.Handle("GET", pattern_SignalService_GetInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_BothanService_GetInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -136,12 +187,12 @@ func RegisterSignalServiceHandlerServer(ctx context.Context, mux *runtime.ServeM inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/signal.SignalService/GetInfo", runtime.WithHTTPPathPattern("/info")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bothan.v1.BothanService/GetInfo", runtime.WithHTTPPathPattern("/info")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_SignalService_GetInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_BothanService_GetInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { @@ -149,11 +200,11 @@ func RegisterSignalServiceHandlerServer(ctx context.Context, mux *runtime.ServeM return } - forward_SignalService_GetInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_BothanService_GetInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_SignalService_UpdateRegistry_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_BothanService_UpdateRegistry_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -161,12 +212,12 @@ func RegisterSignalServiceHandlerServer(ctx context.Context, mux *runtime.ServeM inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/signal.SignalService/UpdateRegistry", runtime.WithHTTPPathPattern("/registry")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bothan.v1.BothanService/UpdateRegistry", runtime.WithHTTPPathPattern("/registry")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_SignalService_UpdateRegistry_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_BothanService_UpdateRegistry_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { @@ -174,11 +225,11 @@ func RegisterSignalServiceHandlerServer(ctx context.Context, mux *runtime.ServeM return } - forward_SignalService_UpdateRegistry_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_BothanService_UpdateRegistry_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_SignalService_PushMonitoringRecords_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_BothanService_PushMonitoringRecords_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -186,12 +237,12 @@ func RegisterSignalServiceHandlerServer(ctx context.Context, mux *runtime.ServeM inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/signal.SignalService/PushMonitoringRecords", runtime.WithHTTPPathPattern("/monitoring_records")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bothan.v1.BothanService/PushMonitoringRecords", runtime.WithHTTPPathPattern("/monitoring_records")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_SignalService_PushMonitoringRecords_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_BothanService_PushMonitoringRecords_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { @@ -199,16 +250,41 @@ func RegisterSignalServiceHandlerServer(ctx context.Context, mux *runtime.ServeM return } - forward_SignalService_PushMonitoringRecords_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_BothanService_PushMonitoringRecords_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_BothanService_GetPrices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bothan.v1.BothanService/GetPrices", runtime.WithHTTPPathPattern("/prices/{signal_ids}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_BothanService_GetPrices_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_BothanService_GetPrices_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } -// RegisterSignalServiceHandlerFromEndpoint is same as RegisterSignalServiceHandler but +// RegisterBothanServiceHandlerFromEndpoint is same as RegisterBothanServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterSignalServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { +func RegisterBothanServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.DialContext(ctx, endpoint, opts...) if err != nil { return err @@ -228,85 +304,107 @@ func RegisterSignalServiceHandlerFromEndpoint(ctx context.Context, mux *runtime. }() }() - return RegisterSignalServiceHandler(ctx, mux, conn) + return RegisterBothanServiceHandler(ctx, mux, conn) } -// RegisterSignalServiceHandler registers the http handlers for service SignalService to "mux". +// RegisterBothanServiceHandler registers the http handlers for service BothanService to "mux". // The handlers forward requests to the grpc endpoint over "conn". -func RegisterSignalServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterSignalServiceHandlerClient(ctx, mux, NewSignalServiceClient(conn)) +func RegisterBothanServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterBothanServiceHandlerClient(ctx, mux, NewBothanServiceClient(conn)) } -// RegisterSignalServiceHandlerClient registers the http handlers for service SignalService -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SignalServiceClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SignalServiceClient" +// RegisterBothanServiceHandlerClient registers the http handlers for service BothanService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "BothanServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "BothanServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "SignalServiceClient" to call the correct interceptors. -func RegisterSignalServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SignalServiceClient) error { +// "BothanServiceClient" to call the correct interceptors. +func RegisterBothanServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BothanServiceClient) error { + + mux.Handle("GET", pattern_BothanService_GetInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bothan.v1.BothanService/GetInfo", runtime.WithHTTPPathPattern("/info")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_BothanService_GetInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_BothanService_GetInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - mux.Handle("GET", pattern_SignalService_GetInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + }) + + mux.Handle("POST", pattern_BothanService_UpdateRegistry_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/signal.SignalService/GetInfo", runtime.WithHTTPPathPattern("/info")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bothan.v1.BothanService/UpdateRegistry", runtime.WithHTTPPathPattern("/registry")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_SignalService_GetInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_BothanService_UpdateRegistry_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_SignalService_GetInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_BothanService_UpdateRegistry_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_SignalService_UpdateRegistry_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_BothanService_PushMonitoringRecords_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/signal.SignalService/UpdateRegistry", runtime.WithHTTPPathPattern("/registry")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bothan.v1.BothanService/PushMonitoringRecords", runtime.WithHTTPPathPattern("/monitoring_records")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_SignalService_UpdateRegistry_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_BothanService_PushMonitoringRecords_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_SignalService_UpdateRegistry_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_BothanService_PushMonitoringRecords_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_SignalService_PushMonitoringRecords_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_BothanService_GetPrices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/signal.SignalService/PushMonitoringRecords", runtime.WithHTTPPathPattern("/monitoring_records")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bothan.v1.BothanService/GetPrices", runtime.WithHTTPPathPattern("/prices/{signal_ids}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_SignalService_PushMonitoringRecords_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_BothanService_GetPrices_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_SignalService_PushMonitoringRecords_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_BothanService_GetPrices_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -314,17 +412,21 @@ func RegisterSignalServiceHandlerClient(ctx context.Context, mux *runtime.ServeM } var ( - pattern_SignalService_GetInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"info"}, "")) + pattern_BothanService_GetInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"info"}, "")) - pattern_SignalService_UpdateRegistry_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"registry"}, "")) + pattern_BothanService_UpdateRegistry_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"registry"}, "")) - pattern_SignalService_PushMonitoringRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"monitoring_records"}, "")) + pattern_BothanService_PushMonitoringRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"monitoring_records"}, "")) + + pattern_BothanService_GetPrices_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"prices", "signal_ids"}, "")) ) var ( - forward_SignalService_GetInfo_0 = runtime.ForwardResponseMessage + forward_BothanService_GetInfo_0 = runtime.ForwardResponseMessage + + forward_BothanService_UpdateRegistry_0 = runtime.ForwardResponseMessage - forward_SignalService_UpdateRegistry_0 = runtime.ForwardResponseMessage + forward_BothanService_PushMonitoringRecords_0 = runtime.ForwardResponseMessage - forward_SignalService_PushMonitoringRecords_0 = runtime.ForwardResponseMessage + forward_BothanService_GetPrices_0 = runtime.ForwardResponseMessage ) diff --git a/bothan-api/client/go-client/proto/bothan/v1/bothan_grpc.pb.go b/bothan-api/client/go-client/proto/bothan/v1/bothan_grpc.pb.go new file mode 100644 index 00000000..2d048ef6 --- /dev/null +++ b/bothan-api/client/go-client/proto/bothan/v1/bothan_grpc.pb.go @@ -0,0 +1,230 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: bothan/v1/bothan.proto + +package proto + +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 + +const ( + BothanService_GetInfo_FullMethodName = "/bothan.v1.BothanService/GetInfo" + BothanService_UpdateRegistry_FullMethodName = "/bothan.v1.BothanService/UpdateRegistry" + BothanService_PushMonitoringRecords_FullMethodName = "/bothan.v1.BothanService/PushMonitoringRecords" + BothanService_GetPrices_FullMethodName = "/bothan.v1.BothanService/GetPrices" +) + +// BothanServiceClient is the client API for BothanService 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 BothanServiceClient interface { + // GetInfo gets information regarding Bothan's services + GetInfo(ctx context.Context, in *GetInfoRequest, opts ...grpc.CallOption) (*GetInfoResponse, error) + // UpdateRegistry updates the registry that Bothan uses with the given IPFS hash and version. + UpdateRegistry(ctx context.Context, in *UpdateRegistryRequest, opts ...grpc.CallOption) (*UpdateRegistryResponse, error) + // PushMonitoringRecords pushes the record associated with the given UUID to the monitoring service. + // If monitoring is disabled in Bothan, this will always return an error. + PushMonitoringRecords(ctx context.Context, in *PushMonitoringRecordsRequest, opts ...grpc.CallOption) (*PushMonitoringRecordsResponse, error) + // GetPrices gets prices for the specified signal IDs. + GetPrices(ctx context.Context, in *GetPricesRequest, opts ...grpc.CallOption) (*GetPricesResponse, error) +} + +type bothanServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewBothanServiceClient(cc grpc.ClientConnInterface) BothanServiceClient { + return &bothanServiceClient{cc} +} + +func (c *bothanServiceClient) GetInfo(ctx context.Context, in *GetInfoRequest, opts ...grpc.CallOption) (*GetInfoResponse, error) { + out := new(GetInfoResponse) + err := c.cc.Invoke(ctx, BothanService_GetInfo_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *bothanServiceClient) UpdateRegistry(ctx context.Context, in *UpdateRegistryRequest, opts ...grpc.CallOption) (*UpdateRegistryResponse, error) { + out := new(UpdateRegistryResponse) + err := c.cc.Invoke(ctx, BothanService_UpdateRegistry_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *bothanServiceClient) PushMonitoringRecords(ctx context.Context, in *PushMonitoringRecordsRequest, opts ...grpc.CallOption) (*PushMonitoringRecordsResponse, error) { + out := new(PushMonitoringRecordsResponse) + err := c.cc.Invoke(ctx, BothanService_PushMonitoringRecords_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *bothanServiceClient) GetPrices(ctx context.Context, in *GetPricesRequest, opts ...grpc.CallOption) (*GetPricesResponse, error) { + out := new(GetPricesResponse) + err := c.cc.Invoke(ctx, BothanService_GetPrices_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// BothanServiceServer is the server API for BothanService service. +// All implementations must embed UnimplementedBothanServiceServer +// for forward compatibility +type BothanServiceServer interface { + // GetInfo gets information regarding Bothan's services + GetInfo(context.Context, *GetInfoRequest) (*GetInfoResponse, error) + // UpdateRegistry updates the registry that Bothan uses with the given IPFS hash and version. + UpdateRegistry(context.Context, *UpdateRegistryRequest) (*UpdateRegistryResponse, error) + // PushMonitoringRecords pushes the record associated with the given UUID to the monitoring service. + // If monitoring is disabled in Bothan, this will always return an error. + PushMonitoringRecords(context.Context, *PushMonitoringRecordsRequest) (*PushMonitoringRecordsResponse, error) + // GetPrices gets prices for the specified signal IDs. + GetPrices(context.Context, *GetPricesRequest) (*GetPricesResponse, error) + mustEmbedUnimplementedBothanServiceServer() +} + +// UnimplementedBothanServiceServer must be embedded to have forward compatible implementations. +type UnimplementedBothanServiceServer struct { +} + +func (UnimplementedBothanServiceServer) GetInfo(context.Context, *GetInfoRequest) (*GetInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetInfo not implemented") +} +func (UnimplementedBothanServiceServer) UpdateRegistry(context.Context, *UpdateRegistryRequest) (*UpdateRegistryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateRegistry not implemented") +} +func (UnimplementedBothanServiceServer) PushMonitoringRecords(context.Context, *PushMonitoringRecordsRequest) (*PushMonitoringRecordsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PushMonitoringRecords not implemented") +} +func (UnimplementedBothanServiceServer) GetPrices(context.Context, *GetPricesRequest) (*GetPricesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetPrices not implemented") +} +func (UnimplementedBothanServiceServer) mustEmbedUnimplementedBothanServiceServer() {} + +// UnsafeBothanServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to BothanServiceServer will +// result in compilation errors. +type UnsafeBothanServiceServer interface { + mustEmbedUnimplementedBothanServiceServer() +} + +func RegisterBothanServiceServer(s grpc.ServiceRegistrar, srv BothanServiceServer) { + s.RegisterService(&BothanService_ServiceDesc, srv) +} + +func _BothanService_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BothanServiceServer).GetInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: BothanService_GetInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BothanServiceServer).GetInfo(ctx, req.(*GetInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _BothanService_UpdateRegistry_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateRegistryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BothanServiceServer).UpdateRegistry(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: BothanService_UpdateRegistry_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BothanServiceServer).UpdateRegistry(ctx, req.(*UpdateRegistryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _BothanService_PushMonitoringRecords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PushMonitoringRecordsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BothanServiceServer).PushMonitoringRecords(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: BothanService_PushMonitoringRecords_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BothanServiceServer).PushMonitoringRecords(ctx, req.(*PushMonitoringRecordsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _BothanService_GetPrices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPricesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BothanServiceServer).GetPrices(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: BothanService_GetPrices_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BothanServiceServer).GetPrices(ctx, req.(*GetPricesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// BothanService_ServiceDesc is the grpc.ServiceDesc for BothanService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var BothanService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bothan.v1.BothanService", + HandlerType: (*BothanServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetInfo", + Handler: _BothanService_GetInfo_Handler, + }, + { + MethodName: "UpdateRegistry", + Handler: _BothanService_UpdateRegistry_Handler, + }, + { + MethodName: "PushMonitoringRecords", + Handler: _BothanService_PushMonitoringRecords_Handler, + }, + { + MethodName: "GetPrices", + Handler: _BothanService_GetPrices_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "bothan/v1/bothan.proto", +} diff --git a/bothan-api/client/go-client/proto/price/price.pb.go b/bothan-api/client/go-client/proto/price/price.pb.go deleted file mode 100644 index f370c70a..00000000 --- a/bothan-api/client/go-client/proto/price/price.pb.go +++ /dev/null @@ -1,390 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.0 -// protoc (unknown) -// source: proto/price/price.proto - -package price - -import ( - _ "google.golang.org/genproto/googleapis/api/annotations" - 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) -) - -// PriceStatus is an enum that defines the status of the price for a signal ID. -type Status int32 - -const ( - // Default status, should not be used. - Status_UNSPECIFIED Status = 0 - // Indicates that the price for the signal ID is not supported. - Status_UNSUPPORTED Status = 1 - // Indicates that the price for the signal ID is currently unavailable. - Status_UNAVAILABLE Status = 2 - // Indicates that the price for the signal ID is available. - Status_AVAILABLE Status = 3 -) - -// Enum value maps for Status. -var ( - Status_name = map[int32]string{ - 0: "UNSPECIFIED", - 1: "UNSUPPORTED", - 2: "UNAVAILABLE", - 3: "AVAILABLE", - } - Status_value = map[string]int32{ - "UNSPECIFIED": 0, - "UNSUPPORTED": 1, - "UNAVAILABLE": 2, - "AVAILABLE": 3, - } -) - -func (x Status) Enum() *Status { - p := new(Status) - *p = x - return p -} - -func (x Status) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Status) Descriptor() protoreflect.EnumDescriptor { - return file_proto_price_price_proto_enumTypes[0].Descriptor() -} - -func (Status) Type() protoreflect.EnumType { - return &file_proto_price_price_proto_enumTypes[0] -} - -func (x Status) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Status.Descriptor instead. -func (Status) EnumDescriptor() ([]byte, []int) { - return file_proto_price_price_proto_rawDescGZIP(), []int{0} -} - -// GetPricesRequest is the request message for the GetPrices RPC method. -// It contains the list of signal IDs for which prices are requested. -type GetPricesRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // A list of signal IDs for which the prices are being requested. - SignalIds []string `protobuf:"bytes,1,rep,name=signal_ids,json=signalIds,proto3" json:"signal_ids,omitempty"` -} - -func (x *GetPricesRequest) Reset() { - *x = GetPricesRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_price_price_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetPricesRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetPricesRequest) ProtoMessage() {} - -func (x *GetPricesRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_price_price_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 GetPricesRequest.ProtoReflect.Descriptor instead. -func (*GetPricesRequest) Descriptor() ([]byte, []int) { - return file_proto_price_price_proto_rawDescGZIP(), []int{0} -} - -func (x *GetPricesRequest) GetSignalIds() []string { - if x != nil { - return x.SignalIds - } - return nil -} - -// GetPricesResponse is the response message for the GetPrices RPC method. -// It contains a list of prices corresponding to the requested signal IDs. -type GetPricesResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // A unique identifier for the response. - Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` - // A list of prices for the requested signal IDs. - Prices []*Price `protobuf:"bytes,2,rep,name=prices,proto3" json:"prices,omitempty"` -} - -func (x *GetPricesResponse) Reset() { - *x = GetPricesResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_price_price_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetPricesResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetPricesResponse) ProtoMessage() {} - -func (x *GetPricesResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_price_price_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 GetPricesResponse.ProtoReflect.Descriptor instead. -func (*GetPricesResponse) Descriptor() ([]byte, []int) { - return file_proto_price_price_proto_rawDescGZIP(), []int{1} -} - -func (x *GetPricesResponse) GetUuid() string { - if x != nil { - return x.Uuid - } - return "" -} - -func (x *GetPricesResponse) GetPrices() []*Price { - if x != nil { - return x.Prices - } - return nil -} - -// Price contains the price information for a signal ID. -type Price struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The signal ID associated with this price. - SignalId string `protobuf:"bytes,1,opt,name=signal_id,json=signalId,proto3" json:"signal_id,omitempty"` - // The price of the asset associated with this signal ID. - Price uint64 `protobuf:"varint,2,opt,name=price,proto3" json:"price,omitempty"` - // The status of the price (e.g., available, unavailable). - Status Status `protobuf:"varint,3,opt,name=status,proto3,enum=price.Status" json:"status,omitempty"` -} - -func (x *Price) Reset() { - *x = Price{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_price_price_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Price) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Price) ProtoMessage() {} - -func (x *Price) ProtoReflect() protoreflect.Message { - mi := &file_proto_price_price_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 Price.ProtoReflect.Descriptor instead. -func (*Price) Descriptor() ([]byte, []int) { - return file_proto_price_price_proto_rawDescGZIP(), []int{2} -} - -func (x *Price) GetSignalId() string { - if x != nil { - return x.SignalId - } - return "" -} - -func (x *Price) GetPrice() uint64 { - if x != nil { - return x.Price - } - return 0 -} - -func (x *Price) GetStatus() Status { - if x != nil { - return x.Status - } - return Status_UNSPECIFIED -} - -var File_proto_price_price_proto protoreflect.FileDescriptor - -var file_proto_price_price_proto_rawDesc = []byte{ - 0x0a, 0x17, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x72, - 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, - 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x31, - 0x0a, 0x10, 0x47, 0x65, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x49, 0x64, - 0x73, 0x22, 0x4d, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x24, 0x0a, 0x06, 0x70, 0x72, - 0x69, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x69, - 0x63, 0x65, 0x2e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x52, 0x06, 0x70, 0x72, 0x69, 0x63, 0x65, 0x73, - 0x22, 0x61, 0x0a, 0x05, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x25, 0x0a, 0x06, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x70, - 0x72, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x2a, 0x4a, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0f, 0x0a, - 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0f, - 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x55, 0x50, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, - 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x41, 0x56, 0x41, 0x49, 0x4c, 0x41, 0x42, 0x4c, 0x45, 0x10, 0x02, - 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x56, 0x41, 0x49, 0x4c, 0x41, 0x42, 0x4c, 0x45, 0x10, 0x03, 0x32, - 0x6c, 0x0a, 0x0c, 0x50, 0x72, 0x69, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x5c, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x73, 0x12, 0x17, 0x2e, 0x70, - 0x72, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, - 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x12, 0x14, 0x2f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x73, - 0x2f, 0x7b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x73, 0x7d, 0x42, 0x31, 0x5a, - 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x6f, 0x74, 0x68, - 0x61, 0x6e, 0x2f, 0x62, 0x6f, 0x74, 0x68, 0x61, 0x6e, 0x2d, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x69, 0x63, 0x65, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_proto_price_price_proto_rawDescOnce sync.Once - file_proto_price_price_proto_rawDescData = file_proto_price_price_proto_rawDesc -) - -func file_proto_price_price_proto_rawDescGZIP() []byte { - file_proto_price_price_proto_rawDescOnce.Do(func() { - file_proto_price_price_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_price_price_proto_rawDescData) - }) - return file_proto_price_price_proto_rawDescData -} - -var file_proto_price_price_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_proto_price_price_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_proto_price_price_proto_goTypes = []interface{}{ - (Status)(0), // 0: price.Status - (*GetPricesRequest)(nil), // 1: price.GetPricesRequest - (*GetPricesResponse)(nil), // 2: price.GetPricesResponse - (*Price)(nil), // 3: price.Price -} -var file_proto_price_price_proto_depIdxs = []int32{ - 3, // 0: price.GetPricesResponse.prices:type_name -> price.Price - 0, // 1: price.Price.status:type_name -> price.Status - 1, // 2: price.PriceService.GetPrices:input_type -> price.GetPricesRequest - 2, // 3: price.PriceService.GetPrices:output_type -> price.GetPricesResponse - 3, // [3:4] is the sub-list for method output_type - 2, // [2:3] 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_proto_price_price_proto_init() } -func file_proto_price_price_proto_init() { - if File_proto_price_price_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_proto_price_price_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetPricesRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_price_price_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetPricesResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_price_price_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Price); 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_proto_price_price_proto_rawDesc, - NumEnums: 1, - NumMessages: 3, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_proto_price_price_proto_goTypes, - DependencyIndexes: file_proto_price_price_proto_depIdxs, - EnumInfos: file_proto_price_price_proto_enumTypes, - MessageInfos: file_proto_price_price_proto_msgTypes, - }.Build() - File_proto_price_price_proto = out.File - file_proto_price_price_proto_rawDesc = nil - file_proto_price_price_proto_goTypes = nil - file_proto_price_price_proto_depIdxs = nil -} diff --git a/bothan-api/client/go-client/proto/price/price.pb.gw.go b/bothan-api/client/go-client/proto/price/price.pb.gw.go deleted file mode 100644 index 9971cd80..00000000 --- a/bothan-api/client/go-client/proto/price/price.pb.gw.go +++ /dev/null @@ -1,189 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: proto/price/price.proto - -/* -Package price is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package price - -import ( - "context" - "io" - "net/http" - - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = metadata.Join - -func request_PriceService_GetPrices_0(ctx context.Context, marshaler runtime.Marshaler, client PriceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetPricesRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["signal_ids"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "signal_ids") - } - - protoReq.SignalIds, err = runtime.StringSlice(val, ",") - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "signal_ids", err) - } - - msg, err := client.GetPrices(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_PriceService_GetPrices_0(ctx context.Context, marshaler runtime.Marshaler, server PriceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetPricesRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["signal_ids"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "signal_ids") - } - - protoReq.SignalIds, err = runtime.StringSlice(val, ",") - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "signal_ids", err) - } - - msg, err := server.GetPrices(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterPriceServiceHandlerServer registers the http handlers for service PriceService to "mux". -// UnaryRPC :call PriceServiceServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterPriceServiceHandlerFromEndpoint instead. -func RegisterPriceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PriceServiceServer) error { - - mux.Handle("GET", pattern_PriceService_GetPrices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/price.PriceService/GetPrices", runtime.WithHTTPPathPattern("/prices/{signal_ids}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_PriceService_GetPrices_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_PriceService_GetPrices_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterPriceServiceHandlerFromEndpoint is same as RegisterPriceServiceHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterPriceServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterPriceServiceHandler(ctx, mux, conn) -} - -// RegisterPriceServiceHandler registers the http handlers for service PriceService to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterPriceServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterPriceServiceHandlerClient(ctx, mux, NewPriceServiceClient(conn)) -} - -// RegisterPriceServiceHandlerClient registers the http handlers for service PriceService -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "PriceServiceClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "PriceServiceClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "PriceServiceClient" to call the correct interceptors. -func RegisterPriceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PriceServiceClient) error { - - mux.Handle("GET", pattern_PriceService_GetPrices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/price.PriceService/GetPrices", runtime.WithHTTPPathPattern("/prices/{signal_ids}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_PriceService_GetPrices_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_PriceService_GetPrices_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_PriceService_GetPrices_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"prices", "signal_ids"}, "")) -) - -var ( - forward_PriceService_GetPrices_0 = runtime.ForwardResponseMessage -) diff --git a/bothan-api/client/go-client/proto/price/price_grpc.pb.go b/bothan-api/client/go-client/proto/price/price_grpc.pb.go deleted file mode 100644 index 2007752e..00000000 --- a/bothan-api/client/go-client/proto/price/price_grpc.pb.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc (unknown) -// source: proto/price/price.proto - -package price - -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 - -const ( - PriceService_GetPrices_FullMethodName = "/price.PriceService/GetPrices" -) - -// PriceServiceClient is the client API for PriceService 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 PriceServiceClient interface { - // Retrieves the prices for the specified signal IDs. - // This method returns the current prices and status for each requested signal - // ID. - GetPrices(ctx context.Context, in *GetPricesRequest, opts ...grpc.CallOption) (*GetPricesResponse, error) -} - -type priceServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewPriceServiceClient(cc grpc.ClientConnInterface) PriceServiceClient { - return &priceServiceClient{cc} -} - -func (c *priceServiceClient) GetPrices(ctx context.Context, in *GetPricesRequest, opts ...grpc.CallOption) (*GetPricesResponse, error) { - out := new(GetPricesResponse) - err := c.cc.Invoke(ctx, PriceService_GetPrices_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// PriceServiceServer is the server API for PriceService service. -// All implementations must embed UnimplementedPriceServiceServer -// for forward compatibility -type PriceServiceServer interface { - // Retrieves the prices for the specified signal IDs. - // This method returns the current prices and status for each requested signal - // ID. - GetPrices(context.Context, *GetPricesRequest) (*GetPricesResponse, error) - mustEmbedUnimplementedPriceServiceServer() -} - -// UnimplementedPriceServiceServer must be embedded to have forward compatible implementations. -type UnimplementedPriceServiceServer struct { -} - -func (UnimplementedPriceServiceServer) GetPrices(context.Context, *GetPricesRequest) (*GetPricesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetPrices not implemented") -} -func (UnimplementedPriceServiceServer) mustEmbedUnimplementedPriceServiceServer() {} - -// UnsafePriceServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to PriceServiceServer will -// result in compilation errors. -type UnsafePriceServiceServer interface { - mustEmbedUnimplementedPriceServiceServer() -} - -func RegisterPriceServiceServer(s grpc.ServiceRegistrar, srv PriceServiceServer) { - s.RegisterService(&PriceService_ServiceDesc, srv) -} - -func _PriceService_GetPrices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetPricesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PriceServiceServer).GetPrices(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: PriceService_GetPrices_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PriceServiceServer).GetPrices(ctx, req.(*GetPricesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// PriceService_ServiceDesc is the grpc.ServiceDesc for PriceService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var PriceService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "price.PriceService", - HandlerType: (*PriceServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetPrices", - Handler: _PriceService_GetPrices_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "proto/price/price.proto", -} diff --git a/bothan-api/client/go-client/proto/signal/signal.pb.go b/bothan-api/client/go-client/proto/signal/signal.pb.go deleted file mode 100644 index c4f3db9e..00000000 --- a/bothan-api/client/go-client/proto/signal/signal.pb.go +++ /dev/null @@ -1,359 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.0 -// protoc (unknown) -// source: proto/signal/signal.proto - -package signal - -import ( - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - emptypb "google.golang.org/protobuf/types/known/emptypb" - 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) -) - -// GetInfoResponse is the response message for the GetInfo RPC method. -// It contains the bothan version and the IPFS hash pointing to the registry data. -type GetInfoResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The bothan version - BothanVersion string `protobuf:"bytes,1,opt,name=bothan_version,json=bothanVersion,proto3" json:"bothan_version,omitempty"` - // The IPFS hash pointing to the registry data. - RegistryIpfsHash string `protobuf:"bytes,2,opt,name=registry_ipfs_hash,json=registryIpfsHash,proto3" json:"registry_ipfs_hash,omitempty"` - // The version requirements for the registry. - RegistryVersionRequirement string `protobuf:"bytes,3,opt,name=registry_version_requirement,json=registryVersionRequirement,proto3" json:"registry_version_requirement,omitempty"` -} - -func (x *GetInfoResponse) Reset() { - *x = GetInfoResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_signal_signal_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetInfoResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetInfoResponse) ProtoMessage() {} - -func (x *GetInfoResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_signal_signal_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 GetInfoResponse.ProtoReflect.Descriptor instead. -func (*GetInfoResponse) Descriptor() ([]byte, []int) { - return file_proto_signal_signal_proto_rawDescGZIP(), []int{0} -} - -func (x *GetInfoResponse) GetBothanVersion() string { - if x != nil { - return x.BothanVersion - } - return "" -} - -func (x *GetInfoResponse) GetRegistryIpfsHash() string { - if x != nil { - return x.RegistryIpfsHash - } - return "" -} - -func (x *GetInfoResponse) GetRegistryVersionRequirement() string { - if x != nil { - return x.RegistryVersionRequirement - } - return "" -} - -// UpdateRegistryRequest is the request message for the UpdateRegistry RPC method. -// It contains the IPFS hash and version information needed to update the registry. -type UpdateRegistryRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The IPFS hash pointing to the registry data. - IpfsHash string `protobuf:"bytes,1,opt,name=ipfs_hash,json=ipfsHash,proto3" json:"ipfs_hash,omitempty"` - // The version of the registry. - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` -} - -func (x *UpdateRegistryRequest) Reset() { - *x = UpdateRegistryRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_signal_signal_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateRegistryRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateRegistryRequest) ProtoMessage() {} - -func (x *UpdateRegistryRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_signal_signal_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 UpdateRegistryRequest.ProtoReflect.Descriptor instead. -func (*UpdateRegistryRequest) Descriptor() ([]byte, []int) { - return file_proto_signal_signal_proto_rawDescGZIP(), []int{1} -} - -func (x *UpdateRegistryRequest) GetIpfsHash() string { - if x != nil { - return x.IpfsHash - } - return "" -} - -func (x *UpdateRegistryRequest) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -// PushMonitoringRecordsRequest is the request message for the PushMonitoringRecords RPC method. -// It contains the uuid of the records that should be pushed to the monitoring service. -type PushMonitoringRecordsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The uuid of a list of monitoring records to be pushed to the monitoring service. - Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` - // The tx hash of the transaction associated with the monitoring records. - TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` -} - -func (x *PushMonitoringRecordsRequest) Reset() { - *x = PushMonitoringRecordsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_signal_signal_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PushMonitoringRecordsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PushMonitoringRecordsRequest) ProtoMessage() {} - -func (x *PushMonitoringRecordsRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_signal_signal_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 PushMonitoringRecordsRequest.ProtoReflect.Descriptor instead. -func (*PushMonitoringRecordsRequest) Descriptor() ([]byte, []int) { - return file_proto_signal_signal_proto_rawDescGZIP(), []int{2} -} - -func (x *PushMonitoringRecordsRequest) GetUuid() string { - if x != nil { - return x.Uuid - } - return "" -} - -func (x *PushMonitoringRecordsRequest) GetTxHash() string { - if x != nil { - return x.TxHash - } - return "" -} - -var File_proto_signal_signal_proto protoreflect.FileDescriptor - -var file_proto_signal_signal_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x2f, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x6c, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa8, - 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x62, 0x6f, 0x74, 0x68, 0x61, 0x6e, 0x5f, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x62, 0x6f, 0x74, 0x68, - 0x61, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2c, 0x0a, 0x12, 0x72, 0x65, 0x67, - 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x69, 0x70, 0x66, 0x73, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x49, - 0x70, 0x66, 0x73, 0x48, 0x61, 0x73, 0x68, 0x12, 0x40, 0x0a, 0x1c, 0x72, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x72, 0x79, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x71, 0x75, - 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1a, 0x72, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x4e, 0x0a, 0x15, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x70, 0x66, 0x73, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x70, 0x66, 0x73, 0x48, 0x61, 0x73, 0x68, 0x12, - 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x4b, 0x0a, 0x1c, 0x50, 0x75, 0x73, - 0x68, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, - 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x17, 0x0a, - 0x07, 0x74, 0x78, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x74, 0x78, 0x48, 0x61, 0x73, 0x68, 0x32, 0xaa, 0x02, 0x0a, 0x0d, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x49, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x49, - 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x6c, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x0d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x07, 0x12, 0x05, 0x2f, 0x69, - 0x6e, 0x66, 0x6f, 0x12, 0x5a, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x67, - 0x69, 0x73, 0x74, 0x72, 0x79, 0x12, 0x1d, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x2e, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x11, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x0b, 0x22, 0x09, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x12, - 0x72, 0x0a, 0x15, 0x50, 0x75, 0x73, 0x68, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, - 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x24, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x61, - 0x6c, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, - 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x22, 0x13, - 0x2f, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x65, 0x63, 0x6f, - 0x72, 0x64, 0x73, 0x42, 0x32, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x62, 0x6f, 0x74, 0x68, 0x61, 0x6e, 0x2f, 0x62, 0x6f, 0x74, 0x68, 0x61, 0x6e, 0x2d, - 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_proto_signal_signal_proto_rawDescOnce sync.Once - file_proto_signal_signal_proto_rawDescData = file_proto_signal_signal_proto_rawDesc -) - -func file_proto_signal_signal_proto_rawDescGZIP() []byte { - file_proto_signal_signal_proto_rawDescOnce.Do(func() { - file_proto_signal_signal_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_signal_signal_proto_rawDescData) - }) - return file_proto_signal_signal_proto_rawDescData -} - -var file_proto_signal_signal_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_proto_signal_signal_proto_goTypes = []interface{}{ - (*GetInfoResponse)(nil), // 0: signal.GetInfoResponse - (*UpdateRegistryRequest)(nil), // 1: signal.UpdateRegistryRequest - (*PushMonitoringRecordsRequest)(nil), // 2: signal.PushMonitoringRecordsRequest - (*emptypb.Empty)(nil), // 3: google.protobuf.Empty -} -var file_proto_signal_signal_proto_depIdxs = []int32{ - 3, // 0: signal.SignalService.GetInfo:input_type -> google.protobuf.Empty - 1, // 1: signal.SignalService.UpdateRegistry:input_type -> signal.UpdateRegistryRequest - 2, // 2: signal.SignalService.PushMonitoringRecords:input_type -> signal.PushMonitoringRecordsRequest - 0, // 3: signal.SignalService.GetInfo:output_type -> signal.GetInfoResponse - 3, // 4: signal.SignalService.UpdateRegistry:output_type -> google.protobuf.Empty - 3, // 5: signal.SignalService.PushMonitoringRecords:output_type -> google.protobuf.Empty - 3, // [3:6] is the sub-list for method output_type - 0, // [0:3] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_proto_signal_signal_proto_init() } -func file_proto_signal_signal_proto_init() { - if File_proto_signal_signal_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_proto_signal_signal_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetInfoResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_signal_signal_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateRegistryRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_signal_signal_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PushMonitoringRecordsRequest); 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_proto_signal_signal_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_proto_signal_signal_proto_goTypes, - DependencyIndexes: file_proto_signal_signal_proto_depIdxs, - MessageInfos: file_proto_signal_signal_proto_msgTypes, - }.Build() - File_proto_signal_signal_proto = out.File - file_proto_signal_signal_proto_rawDesc = nil - file_proto_signal_signal_proto_goTypes = nil - file_proto_signal_signal_proto_depIdxs = nil -} diff --git a/bothan-api/client/go-client/proto/signal/signal_grpc.pb.go b/bothan-api/client/go-client/proto/signal/signal_grpc.pb.go deleted file mode 100644 index 88453c30..00000000 --- a/bothan-api/client/go-client/proto/signal/signal_grpc.pb.go +++ /dev/null @@ -1,196 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc (unknown) -// source: proto/signal/signal.proto - -package signal - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - emptypb "google.golang.org/protobuf/types/known/emptypb" -) - -// 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 - -const ( - SignalService_GetInfo_FullMethodName = "/signal.SignalService/GetInfo" - SignalService_UpdateRegistry_FullMethodName = "/signal.SignalService/UpdateRegistry" - SignalService_PushMonitoringRecords_FullMethodName = "/signal.SignalService/PushMonitoringRecords" -) - -// SignalServiceClient is the client API for SignalService 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 SignalServiceClient interface { - // Gets the information regarding the signal service - GetInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetInfoResponse, error) - // Updates the registry with the given IPFS hash and version. - // The registry stores metadata and configuration data that can be referenced - // by other parts of the system. - UpdateRegistry(ctx context.Context, in *UpdateRegistryRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // Pushes records to the monitoring service. - // Monitoring records are used to track the computation of signals. - PushMonitoringRecords(ctx context.Context, in *PushMonitoringRecordsRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) -} - -type signalServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewSignalServiceClient(cc grpc.ClientConnInterface) SignalServiceClient { - return &signalServiceClient{cc} -} - -func (c *signalServiceClient) GetInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetInfoResponse, error) { - out := new(GetInfoResponse) - err := c.cc.Invoke(ctx, SignalService_GetInfo_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *signalServiceClient) UpdateRegistry(ctx context.Context, in *UpdateRegistryRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, SignalService_UpdateRegistry_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *signalServiceClient) PushMonitoringRecords(ctx context.Context, in *PushMonitoringRecordsRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, SignalService_PushMonitoringRecords_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// SignalServiceServer is the server API for SignalService service. -// All implementations must embed UnimplementedSignalServiceServer -// for forward compatibility -type SignalServiceServer interface { - // Gets the information regarding the signal service - GetInfo(context.Context, *emptypb.Empty) (*GetInfoResponse, error) - // Updates the registry with the given IPFS hash and version. - // The registry stores metadata and configuration data that can be referenced - // by other parts of the system. - UpdateRegistry(context.Context, *UpdateRegistryRequest) (*emptypb.Empty, error) - // Pushes records to the monitoring service. - // Monitoring records are used to track the computation of signals. - PushMonitoringRecords(context.Context, *PushMonitoringRecordsRequest) (*emptypb.Empty, error) - mustEmbedUnimplementedSignalServiceServer() -} - -// UnimplementedSignalServiceServer must be embedded to have forward compatible implementations. -type UnimplementedSignalServiceServer struct { -} - -func (UnimplementedSignalServiceServer) GetInfo(context.Context, *emptypb.Empty) (*GetInfoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetInfo not implemented") -} -func (UnimplementedSignalServiceServer) UpdateRegistry(context.Context, *UpdateRegistryRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateRegistry not implemented") -} -func (UnimplementedSignalServiceServer) PushMonitoringRecords(context.Context, *PushMonitoringRecordsRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method PushMonitoringRecords not implemented") -} -func (UnimplementedSignalServiceServer) mustEmbedUnimplementedSignalServiceServer() {} - -// UnsafeSignalServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to SignalServiceServer will -// result in compilation errors. -type UnsafeSignalServiceServer interface { - mustEmbedUnimplementedSignalServiceServer() -} - -func RegisterSignalServiceServer(s grpc.ServiceRegistrar, srv SignalServiceServer) { - s.RegisterService(&SignalService_ServiceDesc, srv) -} - -func _SignalService_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(emptypb.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SignalServiceServer).GetInfo(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: SignalService_GetInfo_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SignalServiceServer).GetInfo(ctx, req.(*emptypb.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _SignalService_UpdateRegistry_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateRegistryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SignalServiceServer).UpdateRegistry(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: SignalService_UpdateRegistry_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SignalServiceServer).UpdateRegistry(ctx, req.(*UpdateRegistryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SignalService_PushMonitoringRecords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PushMonitoringRecordsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SignalServiceServer).PushMonitoringRecords(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: SignalService_PushMonitoringRecords_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SignalServiceServer).PushMonitoringRecords(ctx, req.(*PushMonitoringRecordsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// SignalService_ServiceDesc is the grpc.ServiceDesc for SignalService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var SignalService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "signal.SignalService", - HandlerType: (*SignalServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetInfo", - Handler: _SignalService_GetInfo_Handler, - }, - { - MethodName: "UpdateRegistry", - Handler: _SignalService_UpdateRegistry_Handler, - }, - { - MethodName: "PushMonitoringRecords", - Handler: _SignalService_PushMonitoringRecords_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "proto/signal/signal.proto", -} diff --git a/bothan-api/client/go-client/rest.go b/bothan-api/client/go-client/rest.go index 5674913a..a960ad2b 100644 --- a/bothan-api/client/go-client/rest.go +++ b/bothan-api/client/go-client/rest.go @@ -9,8 +9,7 @@ import ( "github.com/levigross/grequests" - "github.com/bandprotocol/bothan/bothan-api/client/go-client/proto/price" - "github.com/bandprotocol/bothan/bothan-api/client/go-client/proto/signal" + "github.com/bandprotocol/bothan/bothan-api/client/go-client/proto/bothan/v1" ) var _ Client = &RestClient{} @@ -24,7 +23,7 @@ func NewRestClient(url string, timeout time.Duration) *RestClient { return &RestClient{url, timeout} } -func (c *RestClient) GetInfo() (*signal.GetInfoResponse, error) { +func (c *RestClient) GetInfo() (*proto.GetInfoResponse, error) { parsedUrl, err := url.Parse(c.url + "/info") if err != nil { return nil, err @@ -44,7 +43,7 @@ func (c *RestClient) GetInfo() (*signal.GetInfoResponse, error) { return nil, resp.Error } - var infoResp signal.GetInfoResponse + var infoResp proto.GetInfoResponse err = json.Unmarshal(resp.Bytes(), &infoResp) if err != nil { return nil, err @@ -106,7 +105,7 @@ func (c *RestClient) PushMonitoringRecords(uuid, txHash string) error { return nil } -func (c *RestClient) GetPrices(signalIDs []string) (*price.GetPricesResponse, error) { +func (c *RestClient) GetPrices(signalIDs []string) (*proto.GetPricesResponse, error) { parsedUrl, err := url.Parse(c.url + "/prices") if err != nil { return nil, err @@ -127,7 +126,7 @@ func (c *RestClient) GetPrices(signalIDs []string) (*price.GetPricesResponse, er return nil, resp.Error } - var priceResp price.GetPricesResponse + var priceResp proto.GetPricesResponse err = json.Unmarshal(resp.Bytes(), &priceResp) if err != nil { return nil, err diff --git a/bothan-api/server-cli/src/commands/start.rs b/bothan-api/server-cli/src/commands/start.rs index 604c0690..c46ddfe5 100644 --- a/bothan-api/server-cli/src/commands/start.rs +++ b/bothan-api/server-cli/src/commands/start.rs @@ -13,12 +13,11 @@ use semver::{Version, VersionReq}; use tonic::transport::Server; use tracing::{debug, error, info}; -use bothan_api::api::CryptoQueryServer; +use bothan_api::api::BothanServer; use bothan_api::config::ipfs::IpfsAuthentication; use bothan_api::config::manager::crypto_info::sources::CryptoSourceConfigs; use bothan_api::config::AppConfig; -use bothan_api::proto::price::price_service_server::PriceServiceServer; -use bothan_api::proto::signal::signal_service_server::SignalServiceServer; +use bothan_api::proto::bothan::v1::BothanServiceServer; use bothan_api::{REGISTRY_REQUIREMENT, VERSION}; use bothan_binance::BinanceWorkerBuilder; use bothan_bybit::BybitWorkerBuilder; @@ -89,13 +88,12 @@ async fn start_server( let ipfs_client = init_ipfs_client(&app_config).await?; let monitoring_client = init_monitoring_client(&app_config).await?; - let crypto_server = - init_crypto_server(&app_config, store, ipfs_client, monitoring_client).await?; + let bothan_server = + init_bothan_server(&app_config, store, ipfs_client, monitoring_client).await?; info!("server started"); Server::builder() - .add_service(PriceServiceServer::from_arc(crypto_server.clone())) - .add_service(SignalServiceServer::from_arc(crypto_server.clone())) + .add_service(BothanServiceServer::from_arc(bothan_server)) .serve(app_config.grpc.addr) .await?; @@ -184,12 +182,12 @@ async fn init_ipfs_client(config: &AppConfig) -> anyhow::Result { Ok(ipfs_client) } -async fn init_crypto_server( +async fn init_bothan_server( config: &AppConfig, store: SharedStore, ipfs_client: IpfsClient, monitoring_client: Option>, -) -> anyhow::Result> { +) -> anyhow::Result> { let manager_store = SharedStore::create_manager_store(&store); let stale_threshold = config.manager.crypto.stale_threshold; @@ -226,7 +224,7 @@ async fn init_crypto_server( }); } - Ok(Arc::new(CryptoQueryServer::new(manager))) + Ok(Arc::new(BothanServer::new(manager))) } async fn init_crypto_workers( diff --git a/bothan-api/server/src/api.rs b/bothan-api/server/src/api.rs index 383f0d4d..5b99a4e2 100644 --- a/bothan-api/server/src/api.rs +++ b/bothan-api/server/src/api.rs @@ -1,4 +1,4 @@ -pub use crypto::CryptoQueryServer; +pub use server::BothanServer; -mod crypto; +mod server; mod utils; diff --git a/bothan-api/server/src/api/crypto.rs b/bothan-api/server/src/api/server.rs similarity index 85% rename from bothan-api/server/src/api/crypto.rs rename to bothan-api/server/src/api/server.rs index d706d4d5..76319751 100644 --- a/bothan-api/server/src/api/crypto.rs +++ b/bothan-api/server/src/api/server.rs @@ -8,28 +8,32 @@ use bothan_core::manager::crypto_asset_info::error::{PushMonitoringRecordError, use bothan_core::manager::CryptoAssetInfoManager; use crate::api::utils::parse_price_state; -use crate::proto::price::price_service_server::PriceService; -use crate::proto::price::{GetPricesRequest, GetPricesResponse, Price}; -use crate::proto::signal::signal_service_server::SignalService; -use crate::proto::signal::{GetInfoResponse, PushMonitoringRecordsRequest, UpdateRegistryRequest}; +use crate::proto::bothan::v1::{ + BothanService, GetInfoRequest, GetInfoResponse, GetPricesRequest, GetPricesResponse, Price, + PushMonitoringRecordsRequest, PushMonitoringRecordsResponse, UpdateRegistryRequest, + UpdateRegistryResponse, +}; pub const PRECISION: u32 = 9; -/// The `CryptoQueryServer` struct represents a server for querying cryptocurrency prices. -pub struct CryptoQueryServer { +/// The `BothanServer` struct represents a server that implements the `BothanService` trait. +pub struct BothanServer { manager: Arc>, } -impl CryptoQueryServer { +impl BothanServer { /// Creates a new `CryptoQueryServer` instance. pub fn new(manager: Arc>) -> Self { - CryptoQueryServer { manager } + BothanServer { manager } } } #[tonic::async_trait] -impl SignalService for CryptoQueryServer { - async fn get_info(&self, _: Request<()>) -> Result, Status> { +impl BothanService for BothanServer { + async fn get_info( + &self, + _: Request, + ) -> Result, Status> { let info = self .manager .get_info() @@ -48,7 +52,7 @@ impl SignalService for CryptoQueryServer { async fn update_registry( &self, request: Request, - ) -> Result, Status> { + ) -> Result, Status> { info!("received update registry request"); let update_registry_request = request.into_inner(); @@ -63,7 +67,7 @@ impl SignalService for CryptoQueryServer { match set_registry_result { Ok(_) => { info!("successfully set registry"); - Ok(Response::new(())) + Ok(Response::new(UpdateRegistryResponse {})) } Err(SetRegistryError::FailedToRetrieve(e)) => { error!("failed to retrieve registry: {}", e); @@ -95,7 +99,7 @@ impl SignalService for CryptoQueryServer { async fn push_monitoring_records( &self, request: Request, - ) -> Result, Status> { + ) -> Result, Status> { info!("received push monitoring records request"); let request = request.into_inner(); let push_result = self @@ -106,7 +110,7 @@ impl SignalService for CryptoQueryServer { match push_result { Ok(_) => { info!("successfully pushed monitoring records"); - Ok(Response::new(())) + Ok(Response::new(PushMonitoringRecordsResponse {})) } Err(PushMonitoringRecordError::MonitoringNotEnabled) => { info!("monitoring not enabled"); @@ -130,10 +134,7 @@ impl SignalService for CryptoQueryServer { } } } -} -#[tonic::async_trait] -impl PriceService for CryptoQueryServer { async fn get_prices( &self, request: Request, diff --git a/bothan-api/server/src/api/utils.rs b/bothan-api/server/src/api/utils.rs index ddde1d99..a98efc83 100644 --- a/bothan-api/server/src/api/utils.rs +++ b/bothan-api/server/src/api/utils.rs @@ -3,8 +3,8 @@ use tracing::warn; use bothan_core::manager::crypto_asset_info::types::PriceState; -use crate::api::crypto::PRECISION; -use crate::proto::price::{Price, Status}; +use crate::api::server::PRECISION; +use crate::proto::bothan::v1::{Price, Status}; pub fn parse_price_state(id: String, price_state: PriceState) -> Price { match price_state { diff --git a/bothan-api/server/src/proto.rs b/bothan-api/server/src/proto.rs index 6b222e46..38b59d76 100644 --- a/bothan-api/server/src/proto.rs +++ b/bothan-api/server/src/proto.rs @@ -1,36 +1,36 @@ -use serde::ser::SerializeStruct; -use serde::Serialize; +pub mod bothan { + pub mod v1 { + use serde::ser::SerializeStruct; + use serde::Serialize; -#[allow(clippy::all)] -#[rustfmt::skip] -pub mod price; -#[allow(clippy::all)] -#[rustfmt::skip] -pub mod signal; + pub use bothan_service_server::{BothanService, BothanServiceServer}; -impl price::Price { - pub fn new, U: Into>( - signal_id: T, - price: U, - status: price::Status, - ) -> price::Price { - price::Price { - signal_id: signal_id.into(), - price: price.into(), - status: status.into(), + include!("proto/bothan.v1.rs"); + impl Price { + pub fn new, U: Into>( + signal_id: T, + price: U, + status: Status, + ) -> Price { + Price { + signal_id: signal_id.into(), + price: price.into(), + status: status.into(), + } + } } - } -} -impl Serialize for price::Price { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - let mut s = serializer.serialize_struct("Price", 3)?; - s.serialize_field("signal_id", &self.signal_id)?; - s.serialize_field("price", &self.price)?; - s.serialize_field("status", &self.status)?; - s.end() + impl Serialize for Price { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + let mut s = serializer.serialize_struct("Price", 3)?; + s.serialize_field("signal_id", &self.signal_id)?; + s.serialize_field("price", &self.price)?; + s.serialize_field("status", &self.status)?; + s.end() + } + } } } diff --git a/bothan-api/server/src/proto/bothan.v1.rs b/bothan-api/server/src/proto/bothan.v1.rs new file mode 100644 index 00000000..829d0b5b --- /dev/null +++ b/bothan-api/server/src/proto/bothan.v1.rs @@ -0,0 +1,125 @@ +// @generated +// This file is @generated by prost-build. +/// GetInfoRequest defines the request message for the GetInfo RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct GetInfoRequest { +} +/// GetInfoResponse defines the response message for the GetInfo RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetInfoResponse { + /// The bothan version + #[prost(string, tag="1")] + pub bothan_version: ::prost::alloc::string::String, + /// The IPFS hash pointing to the registry data. + #[prost(string, tag="2")] + pub registry_ipfs_hash: ::prost::alloc::string::String, + /// The version requirements for the registry. + #[prost(string, tag="3")] + pub registry_version_requirement: ::prost::alloc::string::String, +} +/// UpdateRegistryRequest defines the request message for the UpdateRegistry RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateRegistryRequest { + /// The IPFS hash pointing to the registry data. + #[prost(string, tag="1")] + pub ipfs_hash: ::prost::alloc::string::String, + /// The version of the registry. + #[prost(string, tag="2")] + pub version: ::prost::alloc::string::String, +} +/// UpdateRegistryResponse defines the response message for the UpdateRegistry RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct UpdateRegistryResponse { +} +/// PushMonitoringRecordsRequest defines the request message for the PushMonitoringRecords RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PushMonitoringRecordsRequest { + /// The uuid of a list of monitoring records to be pushed to the monitoring service. + #[prost(string, tag="1")] + pub uuid: ::prost::alloc::string::String, + /// The tx hash of the transaction associated with the monitoring records. + #[prost(string, tag="2")] + pub tx_hash: ::prost::alloc::string::String, +} +/// PushMonitoringRecordsResponse defines the response message for the PushMonitoringRecords RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct PushMonitoringRecordsResponse { +} +/// GetPricesRequest defines the request message for the GetPrices RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetPricesRequest { + /// A list of signal IDs for which the prices are being requested. + #[prost(string, repeated, tag="1")] + pub signal_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +/// GetPricesResponse defines the response message for the GetPrices RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetPricesResponse { + /// A unique identifier for the response. + #[prost(string, tag="1")] + pub uuid: ::prost::alloc::string::String, + /// A list of prices for the requested signal IDs. + #[prost(message, repeated, tag="2")] + pub prices: ::prost::alloc::vec::Vec, +} +/// Price defines the price information for a signal ID. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Price { + /// The signal ID. + #[prost(string, tag="1")] + pub signal_id: ::prost::alloc::string::String, + /// The price value associated with this signal ID. + #[prost(uint64, tag="2")] + pub price: u64, + /// The status of the signal ID. + #[prost(enumeration="Status", tag="3")] + pub status: i32, +} +/// Status defines the status for a signal ID. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum Status { + /// Default status, should not be used. + Unspecified = 0, + /// Indicates that the signal ID is not supported. + Unsupported = 1, + /// Indicates that the signal ID is currently unavailable. + Unavailable = 2, + /// Indicates that the signal ID is available. + Available = 3, +} +impl Status { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Status::Unspecified => "STATUS_UNSPECIFIED", + Status::Unsupported => "STATUS_UNSUPPORTED", + Status::Unavailable => "STATUS_UNAVAILABLE", + Status::Available => "STATUS_AVAILABLE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "STATUS_UNSPECIFIED" => Some(Self::Unspecified), + "STATUS_UNSUPPORTED" => Some(Self::Unsupported), + "STATUS_UNAVAILABLE" => Some(Self::Unavailable), + "STATUS_AVAILABLE" => Some(Self::Available), + _ => None, + } + } +} +include!("bothan.v1.tonic.rs"); +// @@protoc_insertion_point(module) \ No newline at end of file diff --git a/bothan-api/server/src/proto/signal.tonic.rs b/bothan-api/server/src/proto/bothan.v1.tonic.rs similarity index 54% rename from bothan-api/server/src/proto/signal.tonic.rs rename to bothan-api/server/src/proto/bothan.v1.tonic.rs index 1e55f758..e695dfbc 100644 --- a/bothan-api/server/src/proto/signal.tonic.rs +++ b/bothan-api/server/src/proto/bothan.v1.tonic.rs @@ -1,197 +1,50 @@ // @generated -/// Generated client implementations. -pub mod signal_service_client { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::*; - use tonic::codegen::http::Uri; - #[derive(Debug, Clone)] - pub struct SignalServiceClient { - inner: tonic::client::Grpc, - } - impl SignalServiceClient { - /// Attempt to create a new client by connecting to a given endpoint. - pub async fn connect(dst: D) -> Result - where - D: TryInto, - D::Error: Into, - { - let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; - Ok(Self::new(conn)) - } - } - impl SignalServiceClient - where - T: tonic::client::GrpcService, - T::Error: Into, - T::ResponseBody: Body + Send + 'static, - ::Error: Into + Send, - { - pub fn new(inner: T) -> Self { - let inner = tonic::client::Grpc::new(inner); - Self { inner } - } - pub fn with_origin(inner: T, origin: Uri) -> Self { - let inner = tonic::client::Grpc::with_origin(inner, origin); - Self { inner } - } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> SignalServiceClient> - where - F: tonic::service::Interceptor, - T::ResponseBody: Default, - T: tonic::codegen::Service< - http::Request, - Response = http::Response< - >::ResponseBody, - >, - >, - , - >>::Error: Into + Send + Sync, - { - SignalServiceClient::new(InterceptedService::new(inner, interceptor)) - } - /// Compress requests with the given encoding. - /// - /// This requires the server to support it otherwise it might respond with an - /// error. - #[must_use] - pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.send_compressed(encoding); - self - } - /// Enable decompressing responses. - #[must_use] - pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.accept_compressed(encoding); - self - } - /// Limits the maximum size of a decoded message. - /// - /// Default: `4MB` - #[must_use] - pub fn max_decoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_decoding_message_size(limit); - self - } - /// Limits the maximum size of an encoded message. - /// - /// Default: `usize::MAX` - #[must_use] - pub fn max_encoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_encoding_message_size(limit); - self - } - pub async fn get_info( - &mut self, - request: impl tonic::IntoRequest<()>, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/signal.SignalService/GetInfo", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert(GrpcMethod::new("signal.SignalService", "GetInfo")); - self.inner.unary(req, path, codec).await - } - pub async fn update_registry( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/signal.SignalService/UpdateRegistry", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert(GrpcMethod::new("signal.SignalService", "UpdateRegistry")); - self.inner.unary(req, path, codec).await - } - pub async fn push_monitoring_records( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/signal.SignalService/PushMonitoringRecords", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new("signal.SignalService", "PushMonitoringRecords"), - ); - self.inner.unary(req, path, codec).await - } - } -} /// Generated server implementations. -pub mod signal_service_server { +pub mod bothan_service_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; - /// Generated trait containing gRPC methods that should be implemented for use with SignalServiceServer. + /// Generated trait containing gRPC methods that should be implemented for use with BothanServiceServer. #[async_trait] - pub trait SignalService: Send + Sync + 'static { + pub trait BothanService: Send + Sync + 'static { async fn get_info( &self, - request: tonic::Request<()>, + request: tonic::Request, ) -> std::result::Result, tonic::Status>; async fn update_registry( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn push_monitoring_records( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + async fn get_prices( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; } #[derive(Debug)] - pub struct SignalServiceServer { - inner: _Inner, + pub struct BothanServiceServer { + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); - impl SignalServiceServer { + impl BothanServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { - let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), @@ -238,9 +91,9 @@ pub mod signal_service_server { self } } - impl tonic::codegen::Service> for SignalServiceServer + impl tonic::codegen::Service> for BothanServiceServer where - T: SignalService, + T: BothanService, B: Body + Send + 'static, B::Error: Into + Send + 'static, { @@ -254,22 +107,26 @@ pub mod signal_service_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { - "/signal.SignalService/GetInfo" => { + "/bothan.v1.BothanService/GetInfo" => { #[allow(non_camel_case_types)] - struct GetInfoSvc(pub Arc); - impl tonic::server::UnaryService<()> + struct GetInfoSvc(pub Arc); + impl< + T: BothanService, + > tonic::server::UnaryService for GetInfoSvc { type Response = super::GetInfoResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; - fn call(&mut self, request: tonic::Request<()>) -> Self::Future { + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_info(&inner, request).await + ::get_info(&inner, request).await }; Box::pin(fut) } @@ -280,7 +137,6 @@ pub mod signal_service_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = GetInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -297,14 +153,14 @@ pub mod signal_service_server { }; Box::pin(fut) } - "/signal.SignalService/UpdateRegistry" => { + "/bothan.v1.BothanService/UpdateRegistry" => { #[allow(non_camel_case_types)] - struct UpdateRegistrySvc(pub Arc); + struct UpdateRegistrySvc(pub Arc); impl< - T: SignalService, + T: BothanService, > tonic::server::UnaryService for UpdateRegistrySvc { - type Response = (); + type Response = super::UpdateRegistryResponse; type Future = BoxFuture< tonic::Response, tonic::Status, @@ -315,7 +171,7 @@ pub mod signal_service_server { ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::update_registry(&inner, request).await + ::update_registry(&inner, request).await }; Box::pin(fut) } @@ -326,7 +182,6 @@ pub mod signal_service_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = UpdateRegistrySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -343,14 +198,14 @@ pub mod signal_service_server { }; Box::pin(fut) } - "/signal.SignalService/PushMonitoringRecords" => { + "/bothan.v1.BothanService/PushMonitoringRecords" => { #[allow(non_camel_case_types)] - struct PushMonitoringRecordsSvc(pub Arc); + struct PushMonitoringRecordsSvc(pub Arc); impl< - T: SignalService, + T: BothanService, > tonic::server::UnaryService for PushMonitoringRecordsSvc { - type Response = (); + type Response = super::PushMonitoringRecordsResponse; type Future = BoxFuture< tonic::Response, tonic::Status, @@ -361,7 +216,7 @@ pub mod signal_service_server { ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::push_monitoring_records( + ::push_monitoring_records( &inner, request, ) @@ -376,7 +231,6 @@ pub mod signal_service_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = PushMonitoringRecordsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -393,13 +247,61 @@ pub mod signal_service_server { }; Box::pin(fut) } + "/bothan.v1.BothanService/GetPrices" => { + #[allow(non_camel_case_types)] + struct GetPricesSvc(pub Arc); + impl< + T: BothanService, + > tonic::server::UnaryService + for GetPricesSvc { + type Response = super::GetPricesResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_prices(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = GetPricesSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } _ => { Box::pin(async move { Ok( http::Response::builder() .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") + .header("grpc-status", tonic::Code::Unimplemented as i32) + .header( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ) .body(empty_body()) .unwrap(), ) @@ -408,7 +310,7 @@ pub mod signal_service_server { } } } - impl Clone for SignalServiceServer { + impl Clone for BothanServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { @@ -420,17 +322,7 @@ pub mod signal_service_server { } } } - impl Clone for _Inner { - fn clone(&self) -> Self { - Self(Arc::clone(&self.0)) - } - } - impl std::fmt::Debug for _Inner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } - } - impl tonic::server::NamedService for SignalServiceServer { - const NAME: &'static str = "signal.SignalService"; + impl tonic::server::NamedService for BothanServiceServer { + const NAME: &'static str = "bothan.v1.BothanService"; } } diff --git a/bothan-api/server/src/proto/price.rs b/bothan-api/server/src/proto/price.rs deleted file mode 100644 index 4084489c..00000000 --- a/bothan-api/server/src/proto/price.rs +++ /dev/null @@ -1,75 +0,0 @@ -// @generated -/// GetPricesRequest is the request message for the GetPrices RPC method. -/// It contains the list of signal IDs for which prices are requested. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetPricesRequest { - /// A list of signal IDs for which the prices are being requested. - #[prost(string, repeated, tag="1")] - pub signal_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// GetPricesResponse is the response message for the GetPrices RPC method. -/// It contains a list of prices corresponding to the requested signal IDs. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetPricesResponse { - /// A unique identifier for the response. - #[prost(string, tag="1")] - pub uuid: ::prost::alloc::string::String, - /// A list of prices for the requested signal IDs. - #[prost(message, repeated, tag="2")] - pub prices: ::prost::alloc::vec::Vec, -} -/// Price contains the price information for a signal ID. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Price { - /// The signal ID associated with this price. - #[prost(string, tag="1")] - pub signal_id: ::prost::alloc::string::String, - /// The price of the asset associated with this signal ID. - #[prost(uint64, tag="2")] - pub price: u64, - /// The status of the price (e.g., available, unavailable). - #[prost(enumeration="Status", tag="3")] - pub status: i32, -} -/// PriceStatus is an enum that defines the status of the price for a signal ID. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum Status { - /// Default status, should not be used. - Unspecified = 0, - /// Indicates that the price for the signal ID is not supported. - Unsupported = 1, - /// Indicates that the price for the signal ID is currently unavailable. - Unavailable = 2, - /// Indicates that the price for the signal ID is available. - Available = 3, -} -impl Status { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Status::Unspecified => "UNSPECIFIED", - Status::Unsupported => "UNSUPPORTED", - Status::Unavailable => "UNAVAILABLE", - Status::Available => "AVAILABLE", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UNSPECIFIED" => Some(Self::Unspecified), - "UNSUPPORTED" => Some(Self::Unsupported), - "UNAVAILABLE" => Some(Self::Unavailable), - "AVAILABLE" => Some(Self::Available), - _ => None, - } - } -} -include!("price.tonic.rs"); -// @@protoc_insertion_point(module) \ No newline at end of file diff --git a/bothan-api/server/src/proto/price.tonic.rs b/bothan-api/server/src/proto/price.tonic.rs deleted file mode 100644 index 845866ce..00000000 --- a/bothan-api/server/src/proto/price.tonic.rs +++ /dev/null @@ -1,294 +0,0 @@ -// @generated -/// Generated client implementations. -pub mod price_service_client { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::*; - use tonic::codegen::http::Uri; - #[derive(Debug, Clone)] - pub struct PriceServiceClient { - inner: tonic::client::Grpc, - } - impl PriceServiceClient { - /// Attempt to create a new client by connecting to a given endpoint. - pub async fn connect(dst: D) -> Result - where - D: TryInto, - D::Error: Into, - { - let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; - Ok(Self::new(conn)) - } - } - impl PriceServiceClient - where - T: tonic::client::GrpcService, - T::Error: Into, - T::ResponseBody: Body + Send + 'static, - ::Error: Into + Send, - { - pub fn new(inner: T) -> Self { - let inner = tonic::client::Grpc::new(inner); - Self { inner } - } - pub fn with_origin(inner: T, origin: Uri) -> Self { - let inner = tonic::client::Grpc::with_origin(inner, origin); - Self { inner } - } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> PriceServiceClient> - where - F: tonic::service::Interceptor, - T::ResponseBody: Default, - T: tonic::codegen::Service< - http::Request, - Response = http::Response< - >::ResponseBody, - >, - >, - , - >>::Error: Into + Send + Sync, - { - PriceServiceClient::new(InterceptedService::new(inner, interceptor)) - } - /// Compress requests with the given encoding. - /// - /// This requires the server to support it otherwise it might respond with an - /// error. - #[must_use] - pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.send_compressed(encoding); - self - } - /// Enable decompressing responses. - #[must_use] - pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.accept_compressed(encoding); - self - } - /// Limits the maximum size of a decoded message. - /// - /// Default: `4MB` - #[must_use] - pub fn max_decoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_decoding_message_size(limit); - self - } - /// Limits the maximum size of an encoded message. - /// - /// Default: `usize::MAX` - #[must_use] - pub fn max_encoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_encoding_message_size(limit); - self - } - pub async fn get_prices( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/price.PriceService/GetPrices", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert(GrpcMethod::new("price.PriceService", "GetPrices")); - self.inner.unary(req, path, codec).await - } - } -} -/// Generated server implementations. -pub mod price_service_server { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::*; - /// Generated trait containing gRPC methods that should be implemented for use with PriceServiceServer. - #[async_trait] - pub trait PriceService: Send + Sync + 'static { - async fn get_prices( - &self, - request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; - } - #[derive(Debug)] - pub struct PriceServiceServer { - inner: _Inner, - accept_compression_encodings: EnabledCompressionEncodings, - send_compression_encodings: EnabledCompressionEncodings, - max_decoding_message_size: Option, - max_encoding_message_size: Option, - } - struct _Inner(Arc); - impl PriceServiceServer { - pub fn new(inner: T) -> Self { - Self::from_arc(Arc::new(inner)) - } - pub fn from_arc(inner: Arc) -> Self { - let inner = _Inner(inner); - Self { - inner, - accept_compression_encodings: Default::default(), - send_compression_encodings: Default::default(), - max_decoding_message_size: None, - max_encoding_message_size: None, - } - } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> InterceptedService - where - F: tonic::service::Interceptor, - { - InterceptedService::new(Self::new(inner), interceptor) - } - /// Enable decompressing requests with the given encoding. - #[must_use] - pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.accept_compression_encodings.enable(encoding); - self - } - /// Compress responses with the given encoding, if the client supports it. - #[must_use] - pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.send_compression_encodings.enable(encoding); - self - } - /// Limits the maximum size of a decoded message. - /// - /// Default: `4MB` - #[must_use] - pub fn max_decoding_message_size(mut self, limit: usize) -> Self { - self.max_decoding_message_size = Some(limit); - self - } - /// Limits the maximum size of an encoded message. - /// - /// Default: `usize::MAX` - #[must_use] - pub fn max_encoding_message_size(mut self, limit: usize) -> Self { - self.max_encoding_message_size = Some(limit); - self - } - } - impl tonic::codegen::Service> for PriceServiceServer - where - T: PriceService, - B: Body + Send + 'static, - B::Error: Into + Send + 'static, - { - type Response = http::Response; - type Error = std::convert::Infallible; - type Future = BoxFuture; - fn poll_ready( - &mut self, - _cx: &mut Context<'_>, - ) -> Poll> { - Poll::Ready(Ok(())) - } - fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); - match req.uri().path() { - "/price.PriceService/GetPrices" => { - #[allow(non_camel_case_types)] - struct GetPricesSvc(pub Arc); - impl< - T: PriceService, - > tonic::server::UnaryService - for GetPricesSvc { - type Response = super::GetPricesResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { - let inner = Arc::clone(&self.0); - let fut = async move { - ::get_prices(&inner, request).await - }; - Box::pin(fut) - } - } - let accept_compression_encodings = self.accept_compression_encodings; - let send_compression_encodings = self.send_compression_encodings; - let max_decoding_message_size = self.max_decoding_message_size; - let max_encoding_message_size = self.max_encoding_message_size; - let inner = self.inner.clone(); - let fut = async move { - let inner = inner.0; - let method = GetPricesSvc(inner); - let codec = tonic::codec::ProstCodec::default(); - let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); - let res = grpc.unary(method, req).await; - Ok(res) - }; - Box::pin(fut) - } - _ => { - Box::pin(async move { - Ok( - http::Response::builder() - .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") - .body(empty_body()) - .unwrap(), - ) - }) - } - } - } - } - impl Clone for PriceServiceServer { - fn clone(&self) -> Self { - let inner = self.inner.clone(); - Self { - inner, - accept_compression_encodings: self.accept_compression_encodings, - send_compression_encodings: self.send_compression_encodings, - max_decoding_message_size: self.max_decoding_message_size, - max_encoding_message_size: self.max_encoding_message_size, - } - } - } - impl Clone for _Inner { - fn clone(&self) -> Self { - Self(Arc::clone(&self.0)) - } - } - impl std::fmt::Debug for _Inner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } - } - impl tonic::server::NamedService for PriceServiceServer { - const NAME: &'static str = "price.PriceService"; - } -} diff --git a/bothan-api/server/src/proto/signal.rs b/bothan-api/server/src/proto/signal.rs deleted file mode 100644 index 37a1590e..00000000 --- a/bothan-api/server/src/proto/signal.rs +++ /dev/null @@ -1,42 +0,0 @@ -// @generated -/// GetInfoResponse is the response message for the GetInfo RPC method. -/// It contains the bothan version and the IPFS hash pointing to the registry data. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetInfoResponse { - /// The bothan version - #[prost(string, tag="1")] - pub bothan_version: ::prost::alloc::string::String, - /// The IPFS hash pointing to the registry data. - #[prost(string, tag="2")] - pub registry_ipfs_hash: ::prost::alloc::string::String, - /// The version requirements for the registry. - #[prost(string, tag="3")] - pub registry_version_requirement: ::prost::alloc::string::String, -} -/// UpdateRegistryRequest is the request message for the UpdateRegistry RPC method. -/// It contains the IPFS hash and version information needed to update the registry. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct UpdateRegistryRequest { - /// The IPFS hash pointing to the registry data. - #[prost(string, tag="1")] - pub ipfs_hash: ::prost::alloc::string::String, - /// The version of the registry. - #[prost(string, tag="2")] - pub version: ::prost::alloc::string::String, -} -/// PushMonitoringRecordsRequest is the request message for the PushMonitoringRecords RPC method. -/// It contains the uuid of the records that should be pushed to the monitoring service. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct PushMonitoringRecordsRequest { - /// The uuid of a list of monitoring records to be pushed to the monitoring service. - #[prost(string, tag="1")] - pub uuid: ::prost::alloc::string::String, - /// The tx hash of the transaction associated with the monitoring records. - #[prost(string, tag="2")] - pub tx_hash: ::prost::alloc::string::String, -} -include!("signal.tonic.rs"); -// @@protoc_insertion_point(module) \ No newline at end of file diff --git a/buf.gen.yaml b/buf.gen.yaml new file mode 100644 index 00000000..d382bfa2 --- /dev/null +++ b/buf.gen.yaml @@ -0,0 +1,21 @@ +version: v2 +plugins: +- remote: buf.build/community/neoeinstein-prost:v0.4.0 + out: bothan-api/server/src/proto +- remote: buf.build/community/neoeinstein-tonic:v0.4.1 + out: bothan-api/server/src/proto + opt: + - no_client=true +- remote: buf.build/protocolbuffers/go:v1.34.0 + out: ./bothan-api/client/go-client/proto + opt: + - paths=source_relative +- remote: buf.build/grpc/go:v1.3.0 + out: ./bothan-api/client/go-client/proto + opt: + - paths=source_relative +- remote: buf.build/grpc-ecosystem/gateway:v2.19.1 + out: ./bothan-api/client/go-client/proto + opt: + - paths=source_relative + - generate_unbound_methods=true diff --git a/buf.lock b/buf.lock new file mode 100644 index 00000000..077deea8 --- /dev/null +++ b/buf.lock @@ -0,0 +1,6 @@ +# Generated by buf. DO NOT EDIT. +version: v2 +deps: + - name: buf.build/googleapis/googleapis + commit: f52d4f76a8434cc5966798b1d3b4f110 + digest: b5:5e634ff0ee118aea188b3e9c13ad7d285a192ef6c591bc20ff5a3360438d6ca310cfe9d663b20d60e1daa21789add35b919eac84e8e94a4d576e83a50dd2d62c diff --git a/buf.yaml b/buf.yaml new file mode 100644 index 00000000..cdd94928 --- /dev/null +++ b/buf.yaml @@ -0,0 +1,9 @@ +version: v2 +modules: +- path: proto + name: buf.build/bandprotocol/bothan +deps: +- buf.build/googleapis/googleapis +lint: + use: + - STANDARD diff --git a/proto/bothan/v1/bothan.proto b/proto/bothan/v1/bothan.proto new file mode 100644 index 00000000..3dd99940 --- /dev/null +++ b/proto/bothan/v1/bothan.proto @@ -0,0 +1,102 @@ +syntax = "proto3"; + +package bothan.v1; + +import "google/api/annotations.proto"; + +option go_package = "github.com/bothan/bothan-api/client/proto"; + +// BothanService defines the gRPC services for Bothan's API +service BothanService { + // GetInfo gets information regarding Bothan's services + rpc GetInfo(GetInfoRequest) returns (GetInfoResponse) { + option (google.api.http).get = "/info"; + } + + // UpdateRegistry updates the registry that Bothan uses with the given IPFS hash and version. + rpc UpdateRegistry(UpdateRegistryRequest) returns (UpdateRegistryResponse) { + option (google.api.http).post = "/registry"; + } + + // PushMonitoringRecords pushes the record associated with the given UUID to the monitoring service. + // If monitoring is disabled in Bothan, this will always return an error. + rpc PushMonitoringRecords(PushMonitoringRecordsRequest) returns (PushMonitoringRecordsResponse) { + option (google.api.http).post = "/monitoring_records"; + } + + // GetPrices gets prices for the specified signal IDs. + rpc GetPrices(GetPricesRequest) returns (GetPricesResponse) { + option (google.api.http).get = "/prices/{signal_ids}"; + } +} + +// GetInfoRequest defines the request message for the GetInfo RPC method. +message GetInfoRequest {} + +// GetInfoResponse defines the response message for the GetInfo RPC method. +message GetInfoResponse { + // The bothan version + string bothan_version = 1; + // The IPFS hash pointing to the registry data. + string registry_ipfs_hash = 2; + // The version requirements for the registry. + string registry_version_requirement = 3; +} + +// UpdateRegistryRequest defines the request message for the UpdateRegistry RPC method. +message UpdateRegistryRequest { + // The IPFS hash pointing to the registry data. + string ipfs_hash = 1; + // The version of the registry. + string version = 2; +} + +// UpdateRegistryResponse defines the response message for the UpdateRegistry RPC method. +message UpdateRegistryResponse {} + +// PushMonitoringRecordsRequest defines the request message for the PushMonitoringRecords RPC method. +message PushMonitoringRecordsRequest { + // The uuid of a list of monitoring records to be pushed to the monitoring service. + string uuid = 1; + // The tx hash of the transaction associated with the monitoring records. + string tx_hash = 2; +} + +// PushMonitoringRecordsResponse defines the response message for the PushMonitoringRecords RPC method. +message PushMonitoringRecordsResponse {} + +// GetPricesRequest defines the request message for the GetPrices RPC method. +message GetPricesRequest { + // A list of signal IDs for which the prices are being requested. + repeated string signal_ids = 1; +} + +// GetPricesResponse defines the response message for the GetPrices RPC method. +message GetPricesResponse { + // A unique identifier for the response. + string uuid = 1; + // A list of prices for the requested signal IDs. + repeated Price prices = 2; +} + +// Price defines the price information for a signal ID. +message Price { + // The signal ID. + string signal_id = 1; + // The price value associated with this signal ID. + uint64 price = 2; + // The status of the signal ID. + Status status = 3; +} + +// Status defines the status for a signal ID. +enum Status { + // Default status, should not be used. + STATUS_UNSPECIFIED = 0; + // Indicates that the signal ID is not supported. + STATUS_UNSUPPORTED = 1; + // Indicates that the signal ID is currently unavailable. + STATUS_UNAVAILABLE = 2; + // Indicates that the signal ID is available. + STATUS_AVAILABLE = 3; +} diff --git a/protobuf/README.md b/protobuf/README.md deleted file mode 100644 index dd916fc6..00000000 --- a/protobuf/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Pre-requisites - -To generate the protobuf files, you need to have the following installed: - -- [Buf](https://buf.build/docs/installation) - -# Generate - -To generate the protobuf files, run the following command: - -```bash -buf generate -``` diff --git a/protobuf/buf.gen.yaml b/protobuf/buf.gen.yaml deleted file mode 100644 index 9a0d9189..00000000 --- a/protobuf/buf.gen.yaml +++ /dev/null @@ -1,19 +0,0 @@ -version: v1 -plugins: -- plugin: buf.build/community/neoeinstein-prost:v0.3.1 - out: ../bothan-api/server/src/proto -- plugin: buf.build/community/neoeinstein-tonic:v0.4.0 - out: ../bothan-api/server/src/proto -- plugin: buf.build/protocolbuffers/go:v1.34.0 - out: ../bothan-api/client/go-client - opt: - - paths=source_relative -- plugin: buf.build/grpc/go:v1.3.0 - out: ../bothan-api/client/go-client - opt: - - paths=source_relative -- plugin: buf.build/grpc-ecosystem/gateway:v2.19.1 - out: ../bothan-api/client/go-client - opt: - - paths=source_relative - - generate_unbound_methods=true diff --git a/protobuf/buf.lock b/protobuf/buf.lock deleted file mode 100644 index 603482e2..00000000 --- a/protobuf/buf.lock +++ /dev/null @@ -1,8 +0,0 @@ -# Generated by buf. DO NOT EDIT. -version: v1 -deps: - - remote: buf.build - owner: googleapis - repository: googleapis - commit: e7f8d366f5264595bcc4cd4139af9973 - digest: shake256:e5e5f1c12f82e028ea696faa43b4f9dc6258a6d1226282962a8c8b282e10946281d815884f574bd279ebd9cd7588629beb3db17b892af6c33b56f92f8f67f509 diff --git a/protobuf/buf.yaml b/protobuf/buf.yaml deleted file mode 100644 index 72a633f7..00000000 --- a/protobuf/buf.yaml +++ /dev/null @@ -1,4 +0,0 @@ -version: v1 -name: buf.build/bandprotocol/bothan-api -deps: -- buf.build/googleapis/googleapis diff --git a/protobuf/proto/price/price.proto b/protobuf/proto/price/price.proto deleted file mode 100644 index bf614f34..00000000 --- a/protobuf/proto/price/price.proto +++ /dev/null @@ -1,57 +0,0 @@ -syntax = "proto3"; - -package price; - -import "google/api/annotations.proto"; - -option go_package = "github.com/bothan/bothan-api/client/proto/price"; - -// PriceService defines the gRPC service responsible for handling price queries. -// This service provides methods to retrieve the prices of assets based on their -// signal IDs. -service PriceService { - // Retrieves the prices for the specified signal IDs. - // This method returns the current prices and status for each requested signal - // ID. - rpc GetPrices(GetPricesRequest) returns (GetPricesResponse) { - option (google.api.http).get = "/prices/{signal_ids}"; - } -} - -// GetPricesRequest is the request message for the GetPrices RPC method. -// It contains the list of signal IDs for which prices are requested. -message GetPricesRequest { - // A list of signal IDs for which the prices are being requested. - repeated string signal_ids = 1; -} - -// GetPricesResponse is the response message for the GetPrices RPC method. -// It contains a list of prices corresponding to the requested signal IDs. -message GetPricesResponse { - // A unique identifier for the response. - string uuid = 1; - // A list of prices for the requested signal IDs. - repeated Price prices = 2; -} - -// Price contains the price information for a signal ID. -message Price { - // The signal ID associated with this price. - string signal_id = 1; - // The price of the asset associated with this signal ID. - uint64 price = 2; - // The status of the price (e.g., available, unavailable). - Status status = 3; -} - -// PriceStatus is an enum that defines the status of the price for a signal ID. -enum Status { - // Default status, should not be used. - UNSPECIFIED = 0; - // Indicates that the price for the signal ID is not supported. - UNSUPPORTED = 1; - // Indicates that the price for the signal ID is currently unavailable. - UNAVAILABLE = 2; - // Indicates that the price for the signal ID is available. - AVAILABLE = 3; -} diff --git a/protobuf/proto/signal/signal.proto b/protobuf/proto/signal/signal.proto deleted file mode 100644 index f3295157..00000000 --- a/protobuf/proto/signal/signal.proto +++ /dev/null @@ -1,60 +0,0 @@ -syntax = "proto3"; - -package signal; - -import "google/api/annotations.proto"; -import "google/protobuf/empty.proto"; - -option go_package = "github.com/bothan/bothan-api/client/proto/signal"; - -// SignalService defines the gRPC service responsible for updating the registry -// and managing active signal IDs. -service SignalService { - // Gets the information regarding the signal service - rpc GetInfo(google.protobuf.Empty) returns (GetInfoResponse) { - option (google.api.http).get = "/info"; - } - - // Updates the registry with the given IPFS hash and version. - // The registry stores metadata and configuration data that can be referenced - // by other parts of the system. - rpc UpdateRegistry(UpdateRegistryRequest) returns (google.protobuf.Empty) { - option (google.api.http).post = "/registry"; - } - - // Pushes records to the monitoring service. - // Monitoring records are used to track the computation of signals. - rpc PushMonitoringRecords(PushMonitoringRecordsRequest) returns (google.protobuf.Empty) { - option (google.api.http).post = "/monitoring_records"; - } -} - -// GetInfoResponse is the response message for the GetInfo RPC method. -// It contains the bothan version and the IPFS hash pointing to the registry data. -message GetInfoResponse { - // The bothan version - string bothan_version = 1; - // The IPFS hash pointing to the registry data. - string registry_ipfs_hash = 2; - // The version requirements for the registry. - string registry_version_requirement = 3; -} - -// UpdateRegistryRequest is the request message for the UpdateRegistry RPC method. -// It contains the IPFS hash and version information needed to update the registry. -message UpdateRegistryRequest { - // The IPFS hash pointing to the registry data. - string ipfs_hash = 1; - // The version of the registry. - string version = 2; -} - -// PushMonitoringRecordsRequest is the request message for the PushMonitoringRecords RPC method. -// It contains the uuid of the records that should be pushed to the monitoring service. -message PushMonitoringRecordsRequest { - // The uuid of a list of monitoring records to be pushed to the monitoring service. - string uuid = 1; - - // The tx hash of the transaction associated with the monitoring records. - string tx_hash = 2; -}