v0.4.0 72f8f2e

event.connect.go RawHistoryFolder

1// SPDX-License-Identifier: MIT
2
3// Code generated by protoc-gen-connect-go. DO NOT EDIT.
4//
5// Source: ermite/event.proto
6
7package ermiteconnect
8
9import (
10	ermite "bnema.dev/ermite-api/gen/ermite"
11	connect "connectrpc.com/connect"
12	context "context"
13	errors "errors"
14	http "net/http"
15	strings "strings"
16)
17
18// This is a compile-time assertion to ensure that this generated file and the connect package are
19// compatible. If you get a compiler error that this constant is not defined, this code was
20// generated with a version of connect newer than the one compiled into your binary. You can fix the
21// problem by either regenerating this code with an older version of connect or updating the connect
22// version compiled into your binary.
23const _ = connect.IsAtLeastVersion1_13_0
24
25const (
26	// EventServiceName is the fully-qualified name of the EventService service.
27	EventServiceName = "ermite.EventService"
28)
29
30// These constants are the fully-qualified names of the RPCs defined in this package. They're
31// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
32//
33// Note that these are different from the fully-qualified method names used by
34// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
35// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
36// period.
37const (
38	// EventServiceWatchProcedure is the fully-qualified name of the EventService's Watch RPC.
39	EventServiceWatchProcedure = "/ermite.EventService/Watch"
40)
41
42// EventServiceClient is a client for the ermite.EventService service.
43type EventServiceClient interface {
44	// Watch streams events until the client cancels the call or the server shuts
45	// down. Events are filtered by the caller's access: events of a private
46	// repository are only sent to callers that may read it.
47	//
48	// The events are repo_created, repo_updated, repo_deleted, pushed, gap and,
49	// for merge requests, merge_request_opened, merge_request_merged,
50	// merge_request_closed and comment_added. Each one is delivered on the
51	// "repo:<name>" topic of its repository and on "home", subject to the
52	// visibility of the repository.
53	//
54	// Servers with the feature "ci.runs" also publish run_updated and
55	// job_updated, only on the "repo:<name>" topic of their repository (never on
56	// "home"), subject to the same visibility. They carry the state after the
57	// change and are published when a run or a job is created, changes status
58	// or conclusion, or when one of its steps starts or ends (never per log
59	// line: follow a log with RunService.GetJobLog). The order of these events
60	// is not guaranteed, between jobs and runs or between two updates of the same
61	// one: a client keeps the copy with the higher Run.version or
62	// RunJob.version and drops the other. There is no event for a change of title or
63	// description, nor for a resolved comment: after a gap, or to see such
64	// changes, clients read the merge request again. A merge publishes
65	// merge_request_merged, then pushed for the target branch.
66	//
67	// The server keeps a bounded buffer of recent events. With resume_after set,
68	// buffered events after that id are replayed first, then live events follow.
69	// When resume_after is no longer buffered (or unknown), the stream begins
70	// with a Gap event, then continues with the oldest buffered event: the client
71	// must reload its state. Without resume_after, only new events are sent.
72	//
73	// The access of the caller is checked again for every event: the stream ends
74	// with unauthenticated when the token was revoked or has expired (the server
75	// may take a few seconds to notice). A repository that becomes private
76	// sends one last repo_updated to the callers who could read it before, with
77	// the new visibility and nothing else about it; no later event of it
78	// reaches them. The server limits the watchers: more than 64 topics is
79	// invalid_argument, and too many concurrent streams, in total or from one
80	// client, is resource_exhausted.
81	Watch(context.Context, *connect.Request[ermite.WatchRequest]) (*connect.ServerStreamForClient[ermite.WatchResponse], error)
82}
83
84// NewEventServiceClient constructs a client for the ermite.EventService service. By default, it
85// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
86// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
87// connect.WithGRPCWeb() options.
88//
89// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
90// http://api.acme.com or https://acme.com/grpc).
91func NewEventServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) EventServiceClient {
92	baseURL = strings.TrimRight(baseURL, "/")
93	eventServiceMethods := ermite.File_ermite_event_proto.Services().ByName("EventService").Methods()
94	return &eventServiceClient{
95		watch: connect.NewClient[ermite.WatchRequest, ermite.WatchResponse](
96			httpClient,
97			baseURL+EventServiceWatchProcedure,
98			connect.WithSchema(eventServiceMethods.ByName("Watch")),
99			connect.WithClientOptions(opts...),
100		),
101	}
102}
103
104// eventServiceClient implements EventServiceClient.
105type eventServiceClient struct {
106	watch *connect.Client[ermite.WatchRequest, ermite.WatchResponse]
107}
108
109// Watch calls ermite.EventService.Watch.
110func (c *eventServiceClient) Watch(ctx context.Context, req *connect.Request[ermite.WatchRequest]) (*connect.ServerStreamForClient[ermite.WatchResponse], error) {
111	return c.watch.CallServerStream(ctx, req)
112}
113
114// EventServiceHandler is an implementation of the ermite.EventService service.
115type EventServiceHandler interface {
116	// Watch streams events until the client cancels the call or the server shuts
117	// down. Events are filtered by the caller's access: events of a private
118	// repository are only sent to callers that may read it.
119	//
120	// The events are repo_created, repo_updated, repo_deleted, pushed, gap and,
121	// for merge requests, merge_request_opened, merge_request_merged,
122	// merge_request_closed and comment_added. Each one is delivered on the
123	// "repo:<name>" topic of its repository and on "home", subject to the
124	// visibility of the repository.
125	//
126	// Servers with the feature "ci.runs" also publish run_updated and
127	// job_updated, only on the "repo:<name>" topic of their repository (never on
128	// "home"), subject to the same visibility. They carry the state after the
129	// change and are published when a run or a job is created, changes status
130	// or conclusion, or when one of its steps starts or ends (never per log
131	// line: follow a log with RunService.GetJobLog). The order of these events
132	// is not guaranteed, between jobs and runs or between two updates of the same
133	// one: a client keeps the copy with the higher Run.version or
134	// RunJob.version and drops the other. There is no event for a change of title or
135	// description, nor for a resolved comment: after a gap, or to see such
136	// changes, clients read the merge request again. A merge publishes
137	// merge_request_merged, then pushed for the target branch.
138	//
139	// The server keeps a bounded buffer of recent events. With resume_after set,
140	// buffered events after that id are replayed first, then live events follow.
141	// When resume_after is no longer buffered (or unknown), the stream begins
142	// with a Gap event, then continues with the oldest buffered event: the client
143	// must reload its state. Without resume_after, only new events are sent.
144	//
145	// The access of the caller is checked again for every event: the stream ends
146	// with unauthenticated when the token was revoked or has expired (the server
147	// may take a few seconds to notice). A repository that becomes private
148	// sends one last repo_updated to the callers who could read it before, with
149	// the new visibility and nothing else about it; no later event of it
150	// reaches them. The server limits the watchers: more than 64 topics is
151	// invalid_argument, and too many concurrent streams, in total or from one
152	// client, is resource_exhausted.
153	Watch(context.Context, *connect.Request[ermite.WatchRequest], *connect.ServerStream[ermite.WatchResponse]) error
154}
155
156// NewEventServiceHandler builds an HTTP handler from the service implementation. It returns the
157// path on which to mount the handler and the handler itself.
158//
159// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
160// and JSON codecs. They also support gzip compression.
161func NewEventServiceHandler(svc EventServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
162	eventServiceMethods := ermite.File_ermite_event_proto.Services().ByName("EventService").Methods()
163	eventServiceWatchHandler := connect.NewServerStreamHandler(
164		EventServiceWatchProcedure,
165		svc.Watch,
166		connect.WithSchema(eventServiceMethods.ByName("Watch")),
167		connect.WithHandlerOptions(opts...),
168	)
169	return "/ermite.EventService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
170		switch r.URL.Path {
171		case EventServiceWatchProcedure:
172			eventServiceWatchHandler.ServeHTTP(w, r)
173		default:
174			http.NotFound(w, r)
175		}
176	})
177}
178
179// UnimplementedEventServiceHandler returns CodeUnimplemented from all methods.
180type UnimplementedEventServiceHandler struct{}
181
182func (UnimplementedEventServiceHandler) Watch(context.Context, *connect.Request[ermite.WatchRequest], *connect.ServerStream[ermite.WatchResponse]) error {
183	return connect.NewError(connect.CodeUnimplemented, errors.New("ermite.EventService.Watch is not implemented"))
184}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 2

Tags 18

↑↓ moveenter openesc close