main ece7682

export_test.go RawHistoryFolder

1package daemonmux
2
3import (
4	"google.golang.org/protobuf/proto"
5
6	"github.com/bnema/vev/internal/adapters/clock"
7	"github.com/bnema/vev/internal/ports"
8	"github.com/bnema/vev/internal/protocol"
9	"github.com/bnema/vev/internal/protocol/wire"
10)
11
12// Test-only convenience constructors and accessors (export_test.go pattern):
13// production always supplies its own explicit ceilings, clock, or budget
14// (see pump.go, supervisor.go), so these package-default shorthands only
15// exist for tests that don't care about a non-default value.
16
17// Accepts reports whether policy matches an admitted entry, for tests over the
18// legacy single-policy binding shape.
19func (b ServerBinding) Accepts(policy ports.BrokerPolicy) bool {
20	_, ok := b.Accepted(policy)
21	return ok
22}
23
24// Policy returns the sole entry's policy for legacy single-policy test
25// fixtures. It returns the zero value for a multi-entry authority.
26func (b ServerBinding) Policy() ports.BrokerPolicy {
27	if len(b.entries) == 1 {
28		return b.entries[0].Policy
29	}
30	return ports.BrokerPolicy{}
31}
32
33// Origin returns the sole entry's locality for legacy single-policy test
34// fixtures. It returns the unknown origin for a multi-entry authority.
35func (b ServerBinding) Origin() ports.SessionConnectionOrigin {
36	if len(b.entries) == 1 {
37		return b.entries[0].Origin
38	}
39	return ports.SessionOriginUnknown
40}
41
42// NewStreamEngine returns an open engine bound to one physical connection
43// under the package default MuxCeilings.
44func NewStreamEngine() *StreamEngine {
45	return newStreamEngine(DefaultMuxCeilings())
46}
47
48// NewListener returns a listener under the package default handshake budget,
49// accept-queue bound, and wall clock.
50func NewListener(pump *Pump, accepted ServerPolicyAdmission) (*Listener, error) {
51	return newListener(pump, protocol.HandshakeTimeout, MaxAcceptQueue, clock.New(), accepted)
52}
53
54// NewScheduler returns an empty outbound scheduler under the package default
55// MuxCeilings.
56func NewScheduler(engine *StreamEngine) *Scheduler {
57	return newScheduler(engine, DefaultMuxCeilings())
58}
59
60// Children reports the count of currently owned physical children.
61func (s *ServerSupervisor) Children() int {
62	if s == nil {
63		return 0
64	}
65	s.mu.Lock()
66	defer s.mu.Unlock()
67	return len(s.children)
68}
69
70// DecodePreambleRequestBytes strictly decodes one serialized daemonmux client
71// preamble under the 4 KiB bound, the strict scan, the generated unmarshal,
72// and DecodePreambleRequest's semantic checks. Production decodes a preamble
73// inline through the same steps (see handshake.go); this composed helper
74// exists for tests and the package fuzz target.
75func DecodePreambleRequestBytes(payload []byte) (MuxPreambleRequest, error) {
76	if err := CheckPreambleSize(payload); err != nil {
77		return MuxPreambleRequest{}, err
78	}
79	message := &wire.MuxPreambleRequest{}
80	if err := wire.ScanEnvelope(message, payload); err != nil {
81		return MuxPreambleRequest{}, err
82	}
83	if err := (proto.UnmarshalOptions{DiscardUnknown: false}.Unmarshal(payload, message)); err != nil {
84		return MuxPreambleRequest{}, err
85	}
86	return DecodePreambleRequest(message)
87}

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