gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/debug/service/proto/debug.pb.micro.go (about) 1 // Code generated by protoc-gen-micro. DO NOT EDIT. 2 // source: micro/go-micro/debug/service/proto/debug.proto 3 4 package debug 5 6 import ( 7 fmt "fmt" 8 proto "github.com/golang/protobuf/proto" 9 math "math" 10 ) 11 12 import ( 13 context "context" 14 client "gitee.com/liuxuezhan/go-micro-v1.18.0/client" 15 server "gitee.com/liuxuezhan/go-micro-v1.18.0/server" 16 ) 17 18 // Reference imports to suppress errors if they are not otherwise used. 19 var _ = proto.Marshal 20 var _ = fmt.Errorf 21 var _ = math.Inf 22 23 // This is a compile-time assertion to ensure that this generated file 24 // is compatible with the proto package it is being compiled against. 25 // A compilation error at this line likely means your copy of the 26 // proto package needs to be updated. 27 const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package 28 29 // Reference imports to suppress errors if they are not otherwise used. 30 var _ context.Context 31 var _ client.Option 32 var _ server.Option 33 34 // Client API for Debug service 35 36 type DebugService interface { 37 Health(ctx context.Context, in *HealthRequest, opts ...client.CallOption) (*HealthResponse, error) 38 Stats(ctx context.Context, in *StatsRequest, opts ...client.CallOption) (*StatsResponse, error) 39 Log(ctx context.Context, in *LogRequest, opts ...client.CallOption) (Debug_LogService, error) 40 } 41 42 type debugService struct { 43 c client.Client 44 name string 45 } 46 47 func NewDebugService(name string, c client.Client) DebugService { 48 if c == nil { 49 c = client.NewClient() 50 } 51 if len(name) == 0 { 52 name = "debug" 53 } 54 return &debugService{ 55 c: c, 56 name: name, 57 } 58 } 59 60 func (c *debugService) Health(ctx context.Context, in *HealthRequest, opts ...client.CallOption) (*HealthResponse, error) { 61 req := c.c.NewRequest(c.name, "Debug.Health", in) 62 out := new(HealthResponse) 63 err := c.c.Call(ctx, req, out, opts...) 64 if err != nil { 65 return nil, err 66 } 67 return out, nil 68 } 69 70 func (c *debugService) Stats(ctx context.Context, in *StatsRequest, opts ...client.CallOption) (*StatsResponse, error) { 71 req := c.c.NewRequest(c.name, "Debug.Stats", in) 72 out := new(StatsResponse) 73 err := c.c.Call(ctx, req, out, opts...) 74 if err != nil { 75 return nil, err 76 } 77 return out, nil 78 } 79 80 func (c *debugService) Log(ctx context.Context, in *LogRequest, opts ...client.CallOption) (Debug_LogService, error) { 81 req := c.c.NewRequest(c.name, "Debug.Log", &LogRequest{}) 82 stream, err := c.c.Stream(ctx, req, opts...) 83 if err != nil { 84 return nil, err 85 } 86 if err := stream.Send(in); err != nil { 87 return nil, err 88 } 89 return &debugServiceLog{stream}, nil 90 } 91 92 type Debug_LogService interface { 93 SendMsg(interface{}) error 94 RecvMsg(interface{}) error 95 Close() error 96 Recv() (*Record, error) 97 } 98 99 type debugServiceLog struct { 100 stream client.Stream 101 } 102 103 func (x *debugServiceLog) Close() error { 104 return x.stream.Close() 105 } 106 107 func (x *debugServiceLog) SendMsg(m interface{}) error { 108 return x.stream.Send(m) 109 } 110 111 func (x *debugServiceLog) RecvMsg(m interface{}) error { 112 return x.stream.Recv(m) 113 } 114 115 func (x *debugServiceLog) Recv() (*Record, error) { 116 m := new(Record) 117 err := x.stream.Recv(m) 118 if err != nil { 119 return nil, err 120 } 121 return m, nil 122 } 123 124 // Server API for Debug service 125 126 type DebugHandler interface { 127 Health(context.Context, *HealthRequest, *HealthResponse) error 128 Stats(context.Context, *StatsRequest, *StatsResponse) error 129 Log(context.Context, *LogRequest, Debug_LogStream) error 130 } 131 132 func RegisterDebugHandler(s server.Server, hdlr DebugHandler, opts ...server.HandlerOption) error { 133 type debug interface { 134 Health(ctx context.Context, in *HealthRequest, out *HealthResponse) error 135 Stats(ctx context.Context, in *StatsRequest, out *StatsResponse) error 136 Log(ctx context.Context, stream server.Stream) error 137 } 138 type Debug struct { 139 debug 140 } 141 h := &debugHandler{hdlr} 142 return s.Handle(s.NewHandler(&Debug{h}, opts...)) 143 } 144 145 type debugHandler struct { 146 DebugHandler 147 } 148 149 func (h *debugHandler) Health(ctx context.Context, in *HealthRequest, out *HealthResponse) error { 150 return h.DebugHandler.Health(ctx, in, out) 151 } 152 153 func (h *debugHandler) Stats(ctx context.Context, in *StatsRequest, out *StatsResponse) error { 154 return h.DebugHandler.Stats(ctx, in, out) 155 } 156 157 func (h *debugHandler) Log(ctx context.Context, stream server.Stream) error { 158 m := new(LogRequest) 159 if err := stream.Recv(m); err != nil { 160 return err 161 } 162 return h.DebugHandler.Log(ctx, m, &debugLogStream{stream}) 163 } 164 165 type Debug_LogStream interface { 166 SendMsg(interface{}) error 167 RecvMsg(interface{}) error 168 Close() error 169 Send(*Record) error 170 } 171 172 type debugLogStream struct { 173 stream server.Stream 174 } 175 176 func (x *debugLogStream) Close() error { 177 return x.stream.Close() 178 } 179 180 func (x *debugLogStream) SendMsg(m interface{}) error { 181 return x.stream.Send(m) 182 } 183 184 func (x *debugLogStream) RecvMsg(m interface{}) error { 185 return x.stream.Recv(m) 186 } 187 188 func (x *debugLogStream) Send(m *Record) error { 189 return x.stream.Send(m) 190 }