Documentation
¶
Overview ¶
Package adapter bridges the production backend (TrackerService, ResourcePatchStore) to the new TUI's Store interface. It provides LiveStore (thread-safe, in-memory) and TUIRevisionHandler (collector -> TUI message bridge).
Index ¶
- type LiveRevisionMsg
- type LiveStore
- func (s *LiveStore) AddRevision(resourceUID string, rev resource.Revision)
- func (s *LiveStore) AddWatchKind(rk resource.Kind) []*resource.Data
- func (s *LiveStore) AllResources() []*resource.Data
- func (s *LiveStore) FilterResources(expr string) []*resource.Data
- func (s *LiveStore) FilterTimeline(expr string, starredOnly bool) []resource.TimelineEntry
- func (s *LiveStore) ForEachResource(fn func(uid string, rd *resource.Data))
- func (s *LiveStore) GetResource(uid string) *resource.Data
- func (s *LiveStore) IngestRevision(uid, kind, name, namespace string, rev resource.Revision)
- func (s *LiveStore) KindGroups() []*resource.KindGroup
- func (s *LiveStore) RebuildKindGroups()
- func (s *LiveStore) RemoveWatchKind(kind string)
- func (s *LiveStore) ResourceCountByKind(kind string) int
- func (s *LiveStore) RevisionCountByKind(kind string) int
- func (s *LiveStore) SetUnwatchedKinds(kinds []resource.Kind)
- func (s *LiveStore) SortTimeline()
- func (s *LiveStore) StarredResources() []*resource.Data
- func (s *LiveStore) Timeline() []resource.TimelineEntry
- func (s *LiveStore) ToggleStar(uid string) bool
- func (s *LiveStore) TotalResourceCount() int
- func (s *LiveStore) TotalRevisionCount() int
- func (s *LiveStore) UnwatchedKinds() []resource.Kind
- func (s *LiveStore) WatchedKinds() []string
- type TUIRevisionHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LiveRevisionMsg ¶
type LiveRevisionMsg struct {
ResourceUID string
}
LiveRevisionMsg tells the TUI that a new revision has been ingested into the LiveStore. The TUI should refresh its views: data is already in the store.
type LiveStore ¶
type LiveStore struct {
// contains filtered or unexported fields
}
LiveStore implements tui.Store backed by in-memory maps. Thread-safe: the collector goroutine writes (IngestRevision), the TUI goroutine reads.
func (*LiveStore) AddRevision ¶
func (*LiveStore) AddWatchKind ¶
func (*LiveStore) AllResources ¶
func (*LiveStore) FilterResources ¶
func (*LiveStore) FilterTimeline ¶
func (s *LiveStore) FilterTimeline(expr string, starredOnly bool) []resource.TimelineEntry
func (*LiveStore) ForEachResource ¶
func (*LiveStore) IngestRevision ¶
IngestRevision adds a revision for a resource. If the resource doesn't exist yet, it is created. This is thread-safe and designed for high-throughput ingestion.
func (*LiveStore) KindGroups ¶
func (*LiveStore) RebuildKindGroups ¶
func (s *LiveStore) RebuildKindGroups()
func (*LiveStore) RemoveWatchKind ¶
func (*LiveStore) ResourceCountByKind ¶
func (*LiveStore) RevisionCountByKind ¶
func (*LiveStore) SetUnwatchedKinds ¶
SetUnwatchedKinds sets the list of unwatched resource kinds available on the cluster.
func (*LiveStore) SortTimeline ¶
func (s *LiveStore) SortTimeline()
SortTimeline orders the timeline newest-first by revision time. IngestRevision keeps the timeline in arrival order, which is correct for live events but not for a bulk history load that walks one resource's revisions at a time. Call this once after loading history so the timeline is globally chronological.
func (*LiveStore) StarredResources ¶
func (*LiveStore) Timeline ¶
func (s *LiveStore) Timeline() []resource.TimelineEntry
func (*LiveStore) ToggleStar ¶
func (*LiveStore) TotalResourceCount ¶
func (*LiveStore) TotalRevisionCount ¶
func (*LiveStore) UnwatchedKinds ¶
func (*LiveStore) WatchedKinds ¶
type TUIRevisionHandler ¶
TUIRevisionHandler implements the revisionHandler interface from cmd/root.go. It ingests each revision into the LiveStore and sends a LiveRevisionMsg to the bubbletea program so the UI refreshes.
func (*TUIRevisionHandler) HandleRevision ¶
func (h *TUIRevisionHandler) HandleRevision( obj *unstructured.Unstructured, revisionID store.RevisionID, snapshot *store.Snapshot, patch *store.Patch, ) error
HandleRevision is called by the collector goroutine (and loadHistoryFromDB) for each new or historic revision. It extracts resource metadata from the unstructured object, builds a resource.Revision, ingests it into the LiveStore, and notifies the TUI.
The obj parameter always contains the full object state at this revision:
- In the collector path: obj is the live watch event object
- In the history path: obj is reconstructed from snapshot + patches