attachment.go RawHistoryFolder

1package protocol
2
3import (
4	"errors"
5
6	"github.com/bnema/vev/internal/domain"
7)
8
9var ErrInvalidAttachment = errors.New("invalid attachment transition")
10
11// SuspendAttachment requests a publication barrier on the current attachment.
12// RequestID is nonzero and unique among this connection's transitions. Until
13// its matching ACK arrives the client must not transfer foreground ownership.
14type SuspendAttachment struct{ RequestID uint64 }
15
16// AttachmentSuspended acknowledges that input, UI, rendering and geometry
17// authority have been revoked and pending publications drained. After this ACK
18// no pre-suspension output may become visible. Target is the retained lifecycle,
19// not authority to select any other session. The authenticated transport stays open.
20type AttachmentSuspended struct {
21	RequestID uint64
22	Target    ExactSessionTarget
23}
24
25// ActivateAttachment reclaims only the exact target retained by this suspended
26// attachment, with the client's current geometry. It does not grant same-peer
27// navigation authority. Input remains gated until the matching full publication
28// and AttachmentActivated have both been received.
29type ActivateAttachment struct {
30	RequestID   uint64
31	Target      ExactSessionTarget
32	Size        domain.Size
33	PixelWidth  int
34	PixelHeight int
35}
36
37func (m ActivateAttachment) Geometry() domain.Geometry {
38	return domain.Geometry{Size: m.Size, PixelWidth: m.PixelWidth, PixelHeight: m.PixelHeight}.NormalizePixels()
39}
40
41// AttachmentActivated commits a successful activation after a full Output and
42// changed RoutePosition on a fresh epoch. Identity and the
43// epoch/state/view-publication fence must match that Output's context. The
44// receiver checks freshness against its previous
45// chain and correlation against the pending request; Validate checks only the
46// self-contained message. Failure must not emit this success ACK (the existing
47// error/close path permits eviction and reconnect).
48type AttachmentActivated struct {
49	RequestID       uint64
50	Identity        CommittedRouteIdentity
51	Epoch           uint64
52	State           uint64
53	ViewPublication uint64
54}
55
56func (m SuspendAttachment) Validate() error {
57	if m.RequestID == 0 {
58		return ErrInvalidAttachment
59	}
60	return nil
61}
62func (m AttachmentSuspended) Validate() error {
63	if m.RequestID == 0 || m.Target.Validate() != nil {
64		return ErrInvalidAttachment
65	}
66	return nil
67}
68func (m ActivateAttachment) Validate() error {
69	if m.RequestID == 0 || m.Target.Validate() != nil {
70		return ErrInvalidAttachment
71	}
72	if ValidateGeometry(domain.Geometry{Size: m.Size, PixelWidth: m.PixelWidth, PixelHeight: m.PixelHeight}) != nil {
73		return ErrInvalidAttachment
74	}
75	return nil
76}
77func (m AttachmentActivated) Validate() error {
78	if m.RequestID == 0 || m.Identity.Validate() != nil || m.Epoch == 0 || m.State == 0 || m.ViewPublication == 0 {
79		return ErrInvalidAttachment
80	}
81	return nil
82}
83
84func (SuspendAttachment) clientMessage()   {}
85func (ActivateAttachment) clientMessage()  {}
86func (AttachmentSuspended) serverMessage() {}
87func (AttachmentActivated) serverMessage() {}

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 12

Tags 11

↑↓ moveenter openesc close