feat: added metrics service v2

This commit is contained in:
Marvin Zhang
2024-06-26 23:23:14 +08:00
parent 265b09862f
commit 7bdce1af58
36 changed files with 302 additions and 437 deletions

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.4.0
// - protoc v3.12.4
// - protoc-gen-go-grpc v1.2.0
// - protoc v5.27.2
// source: services/node_service.proto
package grpc
@@ -15,16 +15,8 @@ import (
// 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.62.0 or later.
const _ = grpc.SupportPackageIsVersion8
const (
NodeService_Register_FullMethodName = "/grpc.NodeService/Register"
NodeService_SendHeartbeat_FullMethodName = "/grpc.NodeService/SendHeartbeat"
NodeService_Ping_FullMethodName = "/grpc.NodeService/Ping"
NodeService_Subscribe_FullMethodName = "/grpc.NodeService/Subscribe"
NodeService_Unsubscribe_FullMethodName = "/grpc.NodeService/Unsubscribe"
)
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// NodeServiceClient is the client API for NodeService service.
//
@@ -46,9 +38,8 @@ func NewNodeServiceClient(cc grpc.ClientConnInterface) NodeServiceClient {
}
func (c *nodeServiceClient) Register(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Response)
err := c.cc.Invoke(ctx, NodeService_Register_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, "/grpc.NodeService/Register", in, out, opts...)
if err != nil {
return nil, err
}
@@ -56,9 +47,8 @@ func (c *nodeServiceClient) Register(ctx context.Context, in *Request, opts ...g
}
func (c *nodeServiceClient) SendHeartbeat(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Response)
err := c.cc.Invoke(ctx, NodeService_SendHeartbeat_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, "/grpc.NodeService/SendHeartbeat", in, out, opts...)
if err != nil {
return nil, err
}
@@ -66,9 +56,8 @@ func (c *nodeServiceClient) SendHeartbeat(ctx context.Context, in *Request, opts
}
func (c *nodeServiceClient) Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Response)
err := c.cc.Invoke(ctx, NodeService_Ping_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, "/grpc.NodeService/Ping", in, out, opts...)
if err != nil {
return nil, err
}
@@ -76,12 +65,11 @@ func (c *nodeServiceClient) Ping(ctx context.Context, in *Request, opts ...grpc.
}
func (c *nodeServiceClient) Subscribe(ctx context.Context, in *Request, opts ...grpc.CallOption) (NodeService_SubscribeClient, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &NodeService_ServiceDesc.Streams[0], NodeService_Subscribe_FullMethodName, cOpts...)
stream, err := c.cc.NewStream(ctx, &NodeService_ServiceDesc.Streams[0], "/grpc.NodeService/Subscribe", opts...)
if err != nil {
return nil, err
}
x := &nodeServiceSubscribeClient{ClientStream: stream}
x := &nodeServiceSubscribeClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
@@ -109,9 +97,8 @@ func (x *nodeServiceSubscribeClient) Recv() (*StreamMessage, error) {
}
func (c *nodeServiceClient) Unsubscribe(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Response)
err := c.cc.Invoke(ctx, NodeService_Unsubscribe_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, "/grpc.NodeService/Unsubscribe", in, out, opts...)
if err != nil {
return nil, err
}
@@ -172,7 +159,7 @@ func _NodeService_Register_Handler(srv interface{}, ctx context.Context, dec fun
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: NodeService_Register_FullMethodName,
FullMethod: "/grpc.NodeService/Register",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NodeServiceServer).Register(ctx, req.(*Request))
@@ -190,7 +177,7 @@ func _NodeService_SendHeartbeat_Handler(srv interface{}, ctx context.Context, de
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: NodeService_SendHeartbeat_FullMethodName,
FullMethod: "/grpc.NodeService/SendHeartbeat",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NodeServiceServer).SendHeartbeat(ctx, req.(*Request))
@@ -208,7 +195,7 @@ func _NodeService_Ping_Handler(srv interface{}, ctx context.Context, dec func(in
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: NodeService_Ping_FullMethodName,
FullMethod: "/grpc.NodeService/Ping",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NodeServiceServer).Ping(ctx, req.(*Request))
@@ -221,7 +208,7 @@ func _NodeService_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) e
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(NodeServiceServer).Subscribe(m, &nodeServiceSubscribeServer{ServerStream: stream})
return srv.(NodeServiceServer).Subscribe(m, &nodeServiceSubscribeServer{stream})
}
type NodeService_SubscribeServer interface {
@@ -247,7 +234,7 @@ func _NodeService_Unsubscribe_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: NodeService_Unsubscribe_FullMethodName,
FullMethod: "/grpc.NodeService/Unsubscribe",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NodeServiceServer).Unsubscribe(ctx, req.(*Request))