Debian Codegraph @

runner/v1/runnerv1connect/services.connect.go

raw symbols SCIP
1 // Code generated by protoc-gen-connect-go. DO NOT EDIT.
2 //
3 // Source: runner/v1/services.proto
4
5 package runnerv1connect
6
7 import (
8 v1 "code.forgejo.org/forgejo/actions-proto/runner/v1"
9 connect "connectrpc.com/connect"
10 context "context"
11 errors "errors"
12 http "net/http"
13 strings "strings"
14 )
15
16 // This is a compile-time assertion to ensure that this generated file and the connect package are
17 // compatible. If you get a compiler error that this constant is not defined, this code was
18 // generated with a version of connect newer than the one compiled into your binary. You can fix the
19 // problem by either regenerating this code with an older version of connect or updating the connect
20 // version compiled into your binary.
21 const _ = connect.IsAtLeastVersion1_13_0
22
23 const (
24 // RunnerServiceName is the fully-qualified name of the RunnerService service.
25 RunnerServiceName = "runner.v1.RunnerService"
26 )
27
28 // These constants are the fully-qualified names of the RPCs defined in this package. They're
29 // exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
30 //
31 // Note that these are different from the fully-qualified method names used by
32 // google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
33 // reflection-formatted method names, remove the leading slash and convert the remaining slash to a
34 // period.
35 const (
36 // RunnerServiceRegisterProcedure is the fully-qualified name of the RunnerService's Register RPC.
37 RunnerServiceRegisterProcedure = "/runner.v1.RunnerService/Register"
38 // RunnerServiceDeclareProcedure is the fully-qualified name of the RunnerService's Declare RPC.
39 RunnerServiceDeclareProcedure = "/runner.v1.RunnerService/Declare"
40 // RunnerServiceFetchTaskProcedure is the fully-qualified name of the RunnerService's FetchTask RPC.
41 RunnerServiceFetchTaskProcedure = "/runner.v1.RunnerService/FetchTask"
42 // RunnerServiceFetchSingleTaskProcedure is the fully-qualified name of the RunnerService's
43 // FetchSingleTask RPC.
44 RunnerServiceFetchSingleTaskProcedure = "/runner.v1.RunnerService/FetchSingleTask"
45 // RunnerServiceUpdateTaskProcedure is the fully-qualified name of the RunnerService's UpdateTask
46 // RPC.
47 RunnerServiceUpdateTaskProcedure = "/runner.v1.RunnerService/UpdateTask"
48 // RunnerServiceUpdateLogProcedure is the fully-qualified name of the RunnerService's UpdateLog RPC.
49 RunnerServiceUpdateLogProcedure = "/runner.v1.RunnerService/UpdateLog"
50 // RunnerServiceUpdateStepSummaryProcedure is the fully-qualified name of the RunnerService's
51 // UpdateStepSummary RPC.
52 RunnerServiceUpdateStepSummaryProcedure = "/runner.v1.RunnerService/UpdateStepSummary"
53 )
54
55 // These variables are the protoreflect.Descriptor objects for the RPCs defined in this package.
56 var (
57 runnerServiceServiceDescriptor = v1.File_runner_v1_services_proto.Services().ByName("RunnerService")
58 runnerServiceRegisterMethodDescriptor = runnerServiceServiceDescriptor.Methods().ByName("Register")
59 runnerServiceDeclareMethodDescriptor = runnerServiceServiceDescriptor.Methods().ByName("Declare")
60 runnerServiceFetchTaskMethodDescriptor = runnerServiceServiceDescriptor.Methods().ByName("FetchTask")
61 runnerServiceFetchSingleTaskMethodDescriptor = runnerServiceServiceDescriptor.Methods().ByName("FetchSingleTask")
62 runnerServiceUpdateTaskMethodDescriptor = runnerServiceServiceDescriptor.Methods().ByName("UpdateTask")
63 runnerServiceUpdateLogMethodDescriptor = runnerServiceServiceDescriptor.Methods().ByName("UpdateLog")
64 runnerServiceUpdateStepSummaryMethodDescriptor = runnerServiceServiceDescriptor.Methods().ByName("UpdateStepSummary")
65 )
66
67 // RunnerServiceClient is a client for the runner.v1.RunnerService service.
68 type RunnerServiceClient interface {
69 // Register register a new runner in server.
70 Register(context.Context, *connect.Request[v1.RegisterRequest]) (*connect.Response[v1.RegisterResponse], error)
71 // Declare declare runner's version and labels to Gitea before starting fetching task.
72 Declare(context.Context, *connect.Request[v1.DeclareRequest]) (*connect.Response[v1.DeclareResponse], error)
73 // FetchTask requests the next available task for execution.
74 FetchTask(context.Context, *connect.Request[v1.FetchTaskRequest]) (*connect.Response[v1.FetchTaskResponse], error)
75 // FetchSingleTask asks for a single task for execution.
76 FetchSingleTask(context.Context, *connect.Request[v1.FetchSingleTaskRequest]) (*connect.Response[v1.FetchSingleTaskResponse], error)
77 // UpdateTask updates the task status.
78 UpdateTask(context.Context, *connect.Request[v1.UpdateTaskRequest]) (*connect.Response[v1.UpdateTaskResponse], error)
79 // UpdateLog uploads log of the task.
80 UpdateLog(context.Context, *connect.Request[v1.UpdateLogRequest]) (*connect.Response[v1.UpdateLogResponse], error)
81 // UpdateStepSummary uploads step summaries of the task.
82 UpdateStepSummary(context.Context, *connect.Request[v1.UpdateStepSummaryRequest]) (*connect.Response[v1.UpdateStepSummaryResponse], error)
83 }
84
85 // NewRunnerServiceClient constructs a client for the runner.v1.RunnerService service. By default,
86 // it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and
87 // sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC()
88 // or connect.WithGRPCWeb() options.
89 //
90 // The URL supplied here should be the base URL for the Connect or gRPC server (for example,
91 // http://api.acme.com or https://acme.com/grpc).
92 func NewRunnerServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) RunnerServiceClient {
93 baseURL = strings.TrimRight(baseURL, "/")
94 return &runnerServiceClient{
95 register: connect.NewClient[v1.RegisterRequest, v1.RegisterResponse](
96 httpClient,
97 baseURL+RunnerServiceRegisterProcedure,
98 connect.WithSchema(runnerServiceRegisterMethodDescriptor),
99 connect.WithClientOptions(opts...),
100 ),
101 declare: connect.NewClient[v1.DeclareRequest, v1.DeclareResponse](
102 httpClient,
103 baseURL+RunnerServiceDeclareProcedure,
104 connect.WithSchema(runnerServiceDeclareMethodDescriptor),
105 connect.WithClientOptions(opts...),
106 ),
107 fetchTask: connect.NewClient[v1.FetchTaskRequest, v1.FetchTaskResponse](
108 httpClient,
109 baseURL+RunnerServiceFetchTaskProcedure,
110 connect.WithSchema(runnerServiceFetchTaskMethodDescriptor),
111 connect.WithClientOptions(opts...),
112 ),
113 fetchSingleTask: connect.NewClient[v1.FetchSingleTaskRequest, v1.FetchSingleTaskResponse](
114 httpClient,
115 baseURL+RunnerServiceFetchSingleTaskProcedure,
116 connect.WithSchema(runnerServiceFetchSingleTaskMethodDescriptor),
117 connect.WithClientOptions(opts...),
118 ),
119 updateTask: connect.NewClient[v1.UpdateTaskRequest, v1.UpdateTaskResponse](
120 httpClient,
121 baseURL+RunnerServiceUpdateTaskProcedure,
122 connect.WithSchema(runnerServiceUpdateTaskMethodDescriptor),
123 connect.WithClientOptions(opts...),
124 ),
125 updateLog: connect.NewClient[v1.UpdateLogRequest, v1.UpdateLogResponse](
126 httpClient,
127 baseURL+RunnerServiceUpdateLogProcedure,
128 connect.WithSchema(runnerServiceUpdateLogMethodDescriptor),
129 connect.WithClientOptions(opts...),
130 ),
131 updateStepSummary: connect.NewClient[v1.UpdateStepSummaryRequest, v1.UpdateStepSummaryResponse](
132 httpClient,
133 baseURL+RunnerServiceUpdateStepSummaryProcedure,
134 connect.WithSchema(runnerServiceUpdateStepSummaryMethodDescriptor),
135 connect.WithClientOptions(opts...),
136 ),
137 }
138 }
139
140 // runnerServiceClient implements RunnerServiceClient.
141 type runnerServiceClient struct {
142 register *connect.Client[v1.RegisterRequest, v1.RegisterResponse]
143 declare *connect.Client[v1.DeclareRequest, v1.DeclareResponse]
144 fetchTask *connect.Client[v1.FetchTaskRequest, v1.FetchTaskResponse]
145 fetchSingleTask *connect.Client[v1.FetchSingleTaskRequest, v1.FetchSingleTaskResponse]
146 updateTask *connect.Client[v1.UpdateTaskRequest, v1.UpdateTaskResponse]
147 updateLog *connect.Client[v1.UpdateLogRequest, v1.UpdateLogResponse]
148 updateStepSummary *connect.Client[v1.UpdateStepSummaryRequest, v1.UpdateStepSummaryResponse]
149 }
150
151 // Register calls runner.v1.RunnerService.Register.
152 func (c *runnerServiceClient) Register(ctx context.Context, req *connect.Request[v1.RegisterRequest]) (*connect.Response[v1.RegisterResponse], error) {
153 return c.register.CallUnary(ctx, req)
154 }
155
156 // Declare calls runner.v1.RunnerService.Declare.
157 func (c *runnerServiceClient) Declare(ctx context.Context, req *connect.Request[v1.DeclareRequest]) (*connect.Response[v1.DeclareResponse], error) {
158 return c.declare.CallUnary(ctx, req)
159 }
160
161 // FetchTask calls runner.v1.RunnerService.FetchTask.
162 func (c *runnerServiceClient) FetchTask(ctx context.Context, req *connect.Request[v1.FetchTaskRequest]) (*connect.Response[v1.FetchTaskResponse], error) {
163 return c.fetchTask.CallUnary(ctx, req)
164 }
165
166 // FetchSingleTask calls runner.v1.RunnerService.FetchSingleTask.
167 func (c *runnerServiceClient) FetchSingleTask(ctx context.Context, req *connect.Request[v1.FetchSingleTaskRequest]) (*connect.Response[v1.FetchSingleTaskResponse], error) {
168 return c.fetchSingleTask.CallUnary(ctx, req)
169 }
170
171 // UpdateTask calls runner.v1.RunnerService.UpdateTask.
172 func (c *runnerServiceClient) UpdateTask(ctx context.Context, req *connect.Request[v1.UpdateTaskRequest]) (*connect.Response[v1.UpdateTaskResponse], error) {
173 return c.updateTask.CallUnary(ctx, req)
174 }
175
176 // UpdateLog calls runner.v1.RunnerService.UpdateLog.
177 func (c *runnerServiceClient) UpdateLog(ctx context.Context, req *connect.Request[v1.UpdateLogRequest]) (*connect.Response[v1.UpdateLogResponse], error) {
178 return c.updateLog.CallUnary(ctx, req)
179 }
180
181 // UpdateStepSummary calls runner.v1.RunnerService.UpdateStepSummary.
182 func (c *runnerServiceClient) UpdateStepSummary(ctx context.Context, req *connect.Request[v1.UpdateStepSummaryRequest]) (*connect.Response[v1.UpdateStepSummaryResponse], error) {
183 return c.updateStepSummary.CallUnary(ctx, req)
184 }
185
186 // RunnerServiceHandler is an implementation of the runner.v1.RunnerService service.
187 type RunnerServiceHandler interface {
188 // Register register a new runner in server.
189 Register(context.Context, *connect.Request[v1.RegisterRequest]) (*connect.Response[v1.RegisterResponse], error)
190 // Declare declare runner's version and labels to Gitea before starting fetching task.
191 Declare(context.Context, *connect.Request[v1.DeclareRequest]) (*connect.Response[v1.DeclareResponse], error)
192 // FetchTask requests the next available task for execution.
193 FetchTask(context.Context, *connect.Request[v1.FetchTaskRequest]) (*connect.Response[v1.FetchTaskResponse], error)
194 // FetchSingleTask asks for a single task for execution.
195 FetchSingleTask(context.Context, *connect.Request[v1.FetchSingleTaskRequest]) (*connect.Response[v1.FetchSingleTaskResponse], error)
196 // UpdateTask updates the task status.
197 UpdateTask(context.Context, *connect.Request[v1.UpdateTaskRequest]) (*connect.Response[v1.UpdateTaskResponse], error)
198 // UpdateLog uploads log of the task.
199 UpdateLog(context.Context, *connect.Request[v1.UpdateLogRequest]) (*connect.Response[v1.UpdateLogResponse], error)
200 // UpdateStepSummary uploads step summaries of the task.
201 UpdateStepSummary(context.Context, *connect.Request[v1.UpdateStepSummaryRequest]) (*connect.Response[v1.UpdateStepSummaryResponse], error)
202 }
203
204 // NewRunnerServiceHandler builds an HTTP handler from the service implementation. It returns the
205 // path on which to mount the handler and the handler itself.
206 //
207 // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
208 // and JSON codecs. They also support gzip compression.
209 func NewRunnerServiceHandler(svc RunnerServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
210 runnerServiceRegisterHandler := connect.NewUnaryHandler(
211 RunnerServiceRegisterProcedure,
212 svc.Register,
213 connect.WithSchema(runnerServiceRegisterMethodDescriptor),
214 connect.WithHandlerOptions(opts...),
215 )
216 runnerServiceDeclareHandler := connect.NewUnaryHandler(
217 RunnerServiceDeclareProcedure,
218 svc.Declare,
219 connect.WithSchema(runnerServiceDeclareMethodDescriptor),
220 connect.WithHandlerOptions(opts...),
221 )
222 runnerServiceFetchTaskHandler := connect.NewUnaryHandler(
223 RunnerServiceFetchTaskProcedure,
224 svc.FetchTask,
225 connect.WithSchema(runnerServiceFetchTaskMethodDescriptor),
226 connect.WithHandlerOptions(opts...),
227 )
228 runnerServiceFetchSingleTaskHandler := connect.NewUnaryHandler(
229 RunnerServiceFetchSingleTaskProcedure,
230 svc.FetchSingleTask,
231 connect.WithSchema(runnerServiceFetchSingleTaskMethodDescriptor),
232 connect.WithHandlerOptions(opts...),
233 )
234 runnerServiceUpdateTaskHandler := connect.NewUnaryHandler(
235 RunnerServiceUpdateTaskProcedure,
236 svc.UpdateTask,
237 connect.WithSchema(runnerServiceUpdateTaskMethodDescriptor),
238 connect.WithHandlerOptions(opts...),
239 )
240 runnerServiceUpdateLogHandler := connect.NewUnaryHandler(
241 RunnerServiceUpdateLogProcedure,
242 svc.UpdateLog,
243 connect.WithSchema(runnerServiceUpdateLogMethodDescriptor),
244 connect.WithHandlerOptions(opts...),
245 )
246 runnerServiceUpdateStepSummaryHandler := connect.NewUnaryHandler(
247 RunnerServiceUpdateStepSummaryProcedure,
248 svc.UpdateStepSummary,
249 connect.WithSchema(runnerServiceUpdateStepSummaryMethodDescriptor),
250 connect.WithHandlerOptions(opts...),
251 )
252 return "/runner.v1.RunnerService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
253 switch r.URL.Path {
254 case RunnerServiceRegisterProcedure:
255 runnerServiceRegisterHandler.ServeHTTP(w, r)
256 case RunnerServiceDeclareProcedure:
257 runnerServiceDeclareHandler.ServeHTTP(w, r)
258 case RunnerServiceFetchTaskProcedure:
259 runnerServiceFetchTaskHandler.ServeHTTP(w, r)
260 case RunnerServiceFetchSingleTaskProcedure:
261 runnerServiceFetchSingleTaskHandler.ServeHTTP(w, r)
262 case RunnerServiceUpdateTaskProcedure:
263 runnerServiceUpdateTaskHandler.ServeHTTP(w, r)
264 case RunnerServiceUpdateLogProcedure:
265 runnerServiceUpdateLogHandler.ServeHTTP(w, r)
266 case RunnerServiceUpdateStepSummaryProcedure:
267 runnerServiceUpdateStepSummaryHandler.ServeHTTP(w, r)
268 default:
269 http.NotFound(w, r)
270 }
271 })
272 }
273
274 // UnimplementedRunnerServiceHandler returns CodeUnimplemented from all methods.
275 type UnimplementedRunnerServiceHandler struct{}
276
277 func (UnimplementedRunnerServiceHandler) Register(context.Context, *connect.Request[v1.RegisterRequest]) (*connect.Response[v1.RegisterResponse], error) {
278 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("runner.v1.RunnerService.Register is not implemented"))
279 }
280
281 func (UnimplementedRunnerServiceHandler) Declare(context.Context, *connect.Request[v1.DeclareRequest]) (*connect.Response[v1.DeclareResponse], error) {
282 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("runner.v1.RunnerService.Declare is not implemented"))
283 }
284
285 func (UnimplementedRunnerServiceHandler) FetchTask(context.Context, *connect.Request[v1.FetchTaskRequest]) (*connect.Response[v1.FetchTaskResponse], error) {
286 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("runner.v1.RunnerService.FetchTask is not implemented"))
287 }
288
289 func (UnimplementedRunnerServiceHandler) FetchSingleTask(context.Context, *connect.Request[v1.FetchSingleTaskRequest]) (*connect.Response[v1.FetchSingleTaskResponse], error) {
290 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("runner.v1.RunnerService.FetchSingleTask is not implemented"))
291 }
292
293 func (UnimplementedRunnerServiceHandler) UpdateTask(context.Context, *connect.Request[v1.UpdateTaskRequest]) (*connect.Response[v1.UpdateTaskResponse], error) {
294 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("runner.v1.RunnerService.UpdateTask is not implemented"))
295 }
296
297 func (UnimplementedRunnerServiceHandler) UpdateLog(context.Context, *connect.Request[v1.UpdateLogRequest]) (*connect.Response[v1.UpdateLogResponse], error) {
298 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("runner.v1.RunnerService.UpdateLog is not implemented"))
299 }
300
301 func (UnimplementedRunnerServiceHandler) UpdateStepSummary(context.Context, *connect.Request[v1.UpdateStepSummaryRequest]) (*connect.Response[v1.UpdateStepSummaryResponse], error) {
302 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("runner.v1.RunnerService.UpdateStepSummary is not implemented"))
303 }