|
1 | 1 | # runtime |
2 | 2 |
|
3 | | -Pilot Protocol runtime glue. Wires the major subsystems together for |
4 | | -the daemon process: handshake, policy, identity, events, streams. This |
5 | | -is the package the daemon's `main.go` constructs and hands to the plugin |
6 | | -register. |
| 3 | +Runtime glue for the Pilot Protocol daemon. Wires the major subsystems |
| 4 | +together — handshake, policy, identity, events, streams — into a single |
| 5 | +`Runtime` value the daemon's `main.go` constructs and hands to the |
| 6 | +plugin register. |
7 | 7 |
|
8 | | -## Layout |
9 | | - |
10 | | -| File | What it does | |
11 | | -|---|---| |
12 | | -| `runtime.go` | `Runtime` struct + plugin registration / lifecycle. | |
13 | | -| `identity.go` | Load/save Ed25519 identity from disk. | |
14 | | -| `events.go` | In-process event bus implementation. | |
15 | | -| `streams.go` | `coreapi.Streams` listener registry on top of the driver. | |
16 | | -| `handshake.go` | Adapter that exposes the handshake plugin to the runtime. | |
17 | | -| `policy.go` | Adapter that exposes the policy plugin to the runtime. | |
18 | | -| `policy_manager.go` | Per-network policy-file load + reload helpers. | |
19 | | - |
20 | | -## Import paths |
| 8 | +## Install |
21 | 9 |
|
22 | 10 | ```go |
23 | 11 | import "github.com/pilot-protocol/runtime" |
| 12 | +``` |
24 | 13 |
|
| 14 | +## Usage |
| 15 | + |
| 16 | +```go |
25 | 17 | rt, err := runtime.New(runtime.Config{ |
26 | 18 | IdentityPath: "~/.pilot/identity.json", |
27 | 19 | PolicyDir: "~/.pilot/policy", |
28 | 20 | // ... |
29 | 21 | }) |
| 22 | +if err != nil { |
| 23 | + return err |
| 24 | +} |
30 | 25 | rt.Register(handshakeService) |
31 | 26 | rt.Register(policyService) |
32 | 27 | rt.Run(ctx) |
33 | 28 | ``` |
34 | 29 |
|
35 | | -This package is intentionally the last to extract — it depends on |
36 | | -both `pilot-protocol/handshake` and `pilot-protocol/policy`. |
37 | | - |
38 | | -## Releasing |
| 30 | +## Layout |
39 | 31 |
|
40 | | -Tag a SemVer version (e.g. `v0.1.0`); web4 pulls it in via |
41 | | -`require github.com/pilot-protocol/runtime v0.1.0`. During |
42 | | -co-development the protocol repo uses `replace ../runtime`. |
| 32 | +| File | What it does | |
| 33 | +|---|---| |
| 34 | +| `runtime.go` | `Runtime` struct, plugin registration, lifecycle. | |
| 35 | +| `identity.go` | Load/save Ed25519 identity from disk. | |
| 36 | +| `events.go` | In-process event bus implementation. | |
| 37 | +| `streams.go` | `coreapi.Streams` listener registry on top of the driver. | |
| 38 | +| `handshake.go` | Adapter that exposes the handshake plugin to the runtime. | |
| 39 | +| `policy.go` | Adapter that exposes the policy plugin to the runtime. | |
| 40 | +| `policy_manager.go` | Per-network policy-file load and reload helpers. | |
0 commit comments