v0.3.0 8f98fd3

cache.go RawHistoryFolder

1// SPDX-License-Identifier: MIT
2
3package sandbox
4
5import (
6	"net"
7
8	"bnema.dev/ermite-runner/internal/cachesvc"
9)
10
11// ServeCache serves the runner's cache service (Config.Cache, when set) on a
12// Unix socket at path, the host end of the cache channel of sandbox id. The
13// guest relay opens one connection to it per TCP connection it accepts on its
14// loopback: through the sandbox's own bind mount (container) or through
15// Firecracker's vsock proxy (VM, which connects to <uds>_<port> when the guest
16// connects to the host on that port). Nothing but that sandbox can reach the
17// path, and the service accepts on it only tokens made for job (see
18// cachesvc.Service.Serve). own, when not nil, sets the owner and mode of the
19// socket before it is served. mbit caps the channel's traffic, all its
20// connections and both directions together (0: unlimited); a VM passes its
21// NetMbit, as the cache stream does not cross eth0, which carries that limit.
22// With no cache service this does nothing.
23func (c Config) ServeCache(id, path, job string, mbit int, own func(path string) error) error {
24	if c.Cache == nil {
25		return nil
26	}
27	ln, err := net.Listen("unix", path)
28	if err != nil {
29		return err
30	}
31	if own != nil {
32		if err := own(path); err != nil {
33			_ = ln.Close()
34			return err
35		}
36	}
37	return c.Cache.Serve(id, ln, job, cachesvc.WithBandwidth(mbit))
38}
39
40// StopCache ends the cache channel of sandbox id: it closes the listener (which
41// removes the socket) and the open connections. It is idempotent.
42func (c Config) StopCache(id string) {
43	if c.Cache != nil {
44		c.Cache.Stop(id)
45	}
46}

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 4

Tags 11

↑↓ moveenter openesc close