diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-18 09:24:22 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-18 09:24:22 +0200 |
| commit | dbb98cd8dbd70dd92b8a541653e64c45b18348fa (patch) | |
| tree | f2faa385564a4700c608bcf8f2ffc638c1c0bd27 /internal/ior.go | |
| parent | 630ea0ff27b8e9ff9287eaaf67660845406a19a6 (diff) | |
refactor: split TraceRuntimeBindings into RuntimePublisher and RuntimeState (task 427/ISP)
TraceRuntimeBindings mixed 4 setter methods (injecting data into TUI) with
4 getter methods (reading persistent TUI-owned state), violating ISP.
Split into two focused interfaces:
- RuntimePublisher: SetDashboardSnapshotSource, SetEventStreamSource,
SetLiveTrie, SetProbeManager — the write/inject side
- RuntimeState: StreamBuffer, Recorder, StreamSequencer, FilterEpoch
— the read/persistent-state side
TraceRuntimeBindings now embeds both, preserving all existing call sites.
RuntimePublisherFromContext() added so callers that only inject data do not
see the getter surface. Three such callers are narrowed: setupBPFModule,
tuiTestFlamesStarter, tuiTestLiveFlamesStarter.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'internal/ior.go')
| -rw-r--r-- | internal/ior.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/ior.go b/internal/ior.go index 4bd5c8a..ab52299 100644 --- a/internal/ior.go +++ b/internal/ior.go @@ -108,7 +108,8 @@ func validateRunConfig(cfg flags.Config) error { func tuiTestFlamesStarter(cfg flags.Config) tui.TraceStarter { return func(ctx context.Context) error { engine, streamBuf, liveTrie := buildTestFlamesRuntime(cfg) - if bindings, ok := tui.RuntimeBindingsFromContext(ctx); ok { + // Only setter methods are needed here; use the narrower publisher interface. + if bindings, ok := tui.RuntimePublisherFromContext(ctx); ok { bindings.SetDashboardSnapshotSource(engine) bindings.SetEventStreamSource(streamBuf) bindings.SetLiveTrie(liveTrie) @@ -120,7 +121,8 @@ func tuiTestFlamesStarter(cfg flags.Config) tui.TraceStarter { func tuiTestLiveFlamesStarter(cfg flags.Config) tui.TraceStarter { return func(ctx context.Context) error { engine, streamBuf, liveTrie := buildTestLiveFlamesRuntime(ctx, cfg) - if bindings, ok := tui.RuntimeBindingsFromContext(ctx); ok { + // Only setter methods are needed here; use the narrower publisher interface. + if bindings, ok := tui.RuntimePublisherFromContext(ctx); ok { bindings.SetDashboardSnapshotSource(engine) bindings.SetEventStreamSource(streamBuf) bindings.SetLiveTrie(liveTrie) |
