Commit f352561
committed
refactor(daemon): satisfy daemonapi.Daemon via adapter; alias contract types
Wraps *Daemon with a daemonAPIAdapter that satisfies daemonapi.Daemon
without changing the daemon engine's internal *Connection-typed
signatures. cmd/daemon passes d.DaemonAPI() to daemonapi.LoadAll;
plugins receive the adapter and never see the concrete daemon types.
Why an adapter rather than touching every internal signature: the
daemon's own code does dozens of calls like 'conn, err := d.DialConnection(...)'
where the returned *Connection is then passed back through other
typed methods. Coercing those onto daemonapi.Connection (which is
interface{}) would have meant type-assertions at every call site
inside pkg/daemon. The adapter contains the type-assertions in one
file, keeps the daemon engine's internal typing intact, and presents
the daemonapi shape externally.
Also done in this commit:
- pkg/daemon/contract.go: rewritten as type aliases to daemonapi
(TrustChecker, HandshakeService, PolicyManager, PolicyRunner,
WebhookManager, plus the *Record / WebhookStats structs). The
aliases preserve daemon-local short names so existing pkg/daemon
code keeps compiling unchanged.
- pkg/daemon/eventbus_impl.go: Event is now a type alias to
daemonapi.Event so Bus().Subscribe() returns the channel type
daemonapi.EventBus requires.
- pkg/daemon/zz_daemonapi_conformance.go: defines the adapter +
Compile-time 'var _ daemonapi.Daemon = daemonAPIAdapter{}'
assertion. When the interface grows or a method signature
changes, this assertion fails with a precise error.
- pkg/daemon/daemon.go: Bus() return type changed to
daemonapi.EventBus.
Includes the import sweep + duplicate-package deletion that was
on the parallel web4-cleanup-after-common-extraction branch (PR #152):
- All TeoSlayer/pilotprotocol/pkg/X imports → pilot-protocol/common/X
- pkg/{coreapi,protocol,driver,config,logging,urlvalidate,secure,
registry/client,registry/wire} and internal/ipcutil DELETED.
- go.mod gains replace directives for every sibling so dev builds
resolve against local checkouts.
Builds: go build ./... passes for the entire web4 module.
Plugins (handshake/runtime/libpilot) still build against the old
pkg/daemon API in their current branches — Phase 3 of this refactor
migrates them off.1 parent ad6ed06 commit f352561
274 files changed
Lines changed: 472 additions & 17374 deletions
File tree
- cmd
- daemon
- pilotctl
- internal/ipcutil
- pkg
- config
- coreapi
- daemon
- envelope
- keyexchange
- routing
- driver
- logging
- protocol
- registry
- client
- wire
- secure
- urlvalidate
- tests
- compat
- daemon
- internal/policy
- pkg
- config
- coreapi
- logging
- registry/wire
- secure
- urlvalidate
- plugins/policy
- regtestutil
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | | - | |
21 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
| 16 | + | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
25 | | - | |
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 5 | | |
38 | 6 | | |
39 | 7 | | |
| |||
This file was deleted.
This file was deleted.
This file was deleted.
0 commit comments