github.com/annwntech/go-micro/v2@v2.9.5/runtime/service/proto/runtime.pb.micro.go (about) 1 // Code generated by protoc-gen-micro. DO NOT EDIT. 2 // source: runtime/service/proto/runtime.proto 3 4 package go_micro_runtime 5 6 import ( 7 fmt "fmt" 8 proto "github.com/golang/protobuf/proto" 9 math "math" 10 ) 11 12 import ( 13 context "context" 14 api "github.com/annwntech/go-micro/v2/api" 15 client "github.com/annwntech/go-micro/v2/client" 16 server "github.com/annwntech/go-micro/v2/server" 17 ) 18 19 // Reference imports to suppress errors if they are not otherwise used. 20 var _ = proto.Marshal 21 var _ = fmt.Errorf 22 var _ = math.Inf 23 24 // This is a compile-time assertion to ensure that this generated file 25 // is compatible with the proto package it is being compiled against. 26 // A compilation error at this line likely means your copy of the 27 // proto package needs to be updated. 28 const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package 29 30 // Reference imports to suppress errors if they are not otherwise used. 31 var _ api.Endpoint 32 var _ context.Context 33 var _ client.Option 34 var _ server.Option 35 36 // Api Endpoints for Runtime service 37 38 func NewRuntimeEndpoints() []*api.Endpoint { 39 return []*api.Endpoint{} 40 } 41 42 // Client API for Runtime service 43 44 type RuntimeService interface { 45 Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) 46 Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) 47 Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) 48 Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) 49 Logs(ctx context.Context, in *LogsRequest, opts ...client.CallOption) (Runtime_LogsService, error) 50 } 51 52 type runtimeService struct { 53 c client.Client 54 name string 55 } 56 57 func NewRuntimeService(name string, c client.Client) RuntimeService { 58 return &runtimeService{ 59 c: c, 60 name: name, 61 } 62 } 63 64 func (c *runtimeService) Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) { 65 req := c.c.NewRequest(c.name, "Runtime.Create", in) 66 out := new(CreateResponse) 67 err := c.c.Call(ctx, req, out, opts...) 68 if err != nil { 69 return nil, err 70 } 71 return out, nil 72 } 73 74 func (c *runtimeService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) { 75 req := c.c.NewRequest(c.name, "Runtime.Read", in) 76 out := new(ReadResponse) 77 err := c.c.Call(ctx, req, out, opts...) 78 if err != nil { 79 return nil, err 80 } 81 return out, nil 82 } 83 84 func (c *runtimeService) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) { 85 req := c.c.NewRequest(c.name, "Runtime.Delete", in) 86 out := new(DeleteResponse) 87 err := c.c.Call(ctx, req, out, opts...) 88 if err != nil { 89 return nil, err 90 } 91 return out, nil 92 } 93 94 func (c *runtimeService) Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) { 95 req := c.c.NewRequest(c.name, "Runtime.Update", in) 96 out := new(UpdateResponse) 97 err := c.c.Call(ctx, req, out, opts...) 98 if err != nil { 99 return nil, err 100 } 101 return out, nil 102 } 103 104 func (c *runtimeService) Logs(ctx context.Context, in *LogsRequest, opts ...client.CallOption) (Runtime_LogsService, error) { 105 req := c.c.NewRequest(c.name, "Runtime.Logs", &LogsRequest{}) 106 stream, err := c.c.Stream(ctx, req, opts...) 107 if err != nil { 108 return nil, err 109 } 110 if err := stream.Send(in); err != nil { 111 return nil, err 112 } 113 return &runtimeServiceLogs{stream}, nil 114 } 115 116 type Runtime_LogsService interface { 117 Context() context.Context 118 SendMsg(interface{}) error 119 RecvMsg(interface{}) error 120 Close() error 121 Recv() (*LogRecord, error) 122 } 123 124 type runtimeServiceLogs struct { 125 stream client.Stream 126 } 127 128 func (x *runtimeServiceLogs) Close() error { 129 return x.stream.Close() 130 } 131 132 func (x *runtimeServiceLogs) Context() context.Context { 133 return x.stream.Context() 134 } 135 136 func (x *runtimeServiceLogs) SendMsg(m interface{}) error { 137 return x.stream.Send(m) 138 } 139 140 func (x *runtimeServiceLogs) RecvMsg(m interface{}) error { 141 return x.stream.Recv(m) 142 } 143 144 func (x *runtimeServiceLogs) Recv() (*LogRecord, error) { 145 m := new(LogRecord) 146 err := x.stream.Recv(m) 147 if err != nil { 148 return nil, err 149 } 150 return m, nil 151 } 152 153 // Server API for Runtime service 154 155 type RuntimeHandler interface { 156 Create(context.Context, *CreateRequest, *CreateResponse) error 157 Read(context.Context, *ReadRequest, *ReadResponse) error 158 Delete(context.Context, *DeleteRequest, *DeleteResponse) error 159 Update(context.Context, *UpdateRequest, *UpdateResponse) error 160 Logs(context.Context, *LogsRequest, Runtime_LogsStream) error 161 } 162 163 func RegisterRuntimeHandler(s server.Server, hdlr RuntimeHandler, opts ...server.HandlerOption) error { 164 type runtime interface { 165 Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error 166 Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error 167 Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error 168 Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error 169 Logs(ctx context.Context, stream server.Stream) error 170 } 171 type Runtime struct { 172 runtime 173 } 174 h := &runtimeHandler{hdlr} 175 return s.Handle(s.NewHandler(&Runtime{h}, opts...)) 176 } 177 178 type runtimeHandler struct { 179 RuntimeHandler 180 } 181 182 func (h *runtimeHandler) Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error { 183 return h.RuntimeHandler.Create(ctx, in, out) 184 } 185 186 func (h *runtimeHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error { 187 return h.RuntimeHandler.Read(ctx, in, out) 188 } 189 190 func (h *runtimeHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error { 191 return h.RuntimeHandler.Delete(ctx, in, out) 192 } 193 194 func (h *runtimeHandler) Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error { 195 return h.RuntimeHandler.Update(ctx, in, out) 196 } 197 198 func (h *runtimeHandler) Logs(ctx context.Context, stream server.Stream) error { 199 m := new(LogsRequest) 200 if err := stream.Recv(m); err != nil { 201 return err 202 } 203 return h.RuntimeHandler.Logs(ctx, m, &runtimeLogsStream{stream}) 204 } 205 206 type Runtime_LogsStream interface { 207 Context() context.Context 208 SendMsg(interface{}) error 209 RecvMsg(interface{}) error 210 Close() error 211 Send(*LogRecord) error 212 } 213 214 type runtimeLogsStream struct { 215 stream server.Stream 216 } 217 218 func (x *runtimeLogsStream) Close() error { 219 return x.stream.Close() 220 } 221 222 func (x *runtimeLogsStream) Context() context.Context { 223 return x.stream.Context() 224 } 225 226 func (x *runtimeLogsStream) SendMsg(m interface{}) error { 227 return x.stream.Send(m) 228 } 229 230 func (x *runtimeLogsStream) RecvMsg(m interface{}) error { 231 return x.stream.Recv(m) 232 } 233 234 func (x *runtimeLogsStream) Send(m *LogRecord) error { 235 return x.stream.Send(m) 236 }