Help us shape the future of Go! Take the 2026 Go Developer Survey

flowmap

package module
v0.0.0-...-595066c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package flowmap is the relay's live flow-map page: a view model fed by FlowLogService.WatchFlowMap updates, drawn with go-widgets' GraphView. The view model and the scene are plain Go, tested natively; package main in ./wasm wires them to the browser.

Index

Constants

View Source
const MaxEvents = 200

MaxEvents bounds the event log the page keeps.

View Source
const PanelW = 360

PanelW is the width of the details panel on the right.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Time    string
	Denied  bool
	Message string
}

Event is one line of the page's event log.

type Scene

type Scene struct {
	VM    *VM
	Theme *toolkit.Theme
	// OnChange is called after the view model changed (the page publishes
	// its state for tests and updates the status line).
	OnChange func()
	// contains filtered or unexported fields
}

Scene is the page: the graph on the left, the selection's details and the event log on the right. It implements webcanvas.App, Animator and Resizer.

func NewScene

func NewScene(w, h int) *Scene

NewScene builds the page at w x h.

func (*Scene) AnimationStep

func (s *Scene) AnimationStep(float64) bool

AnimationStep applies what arrived since the last frame. Only the newest map is drawn, but every update's events are kept.

func (*Scene) Char

func (s *Scene) Char(string) bool

func (*Scene) Click

func (s *Scene) Click(x, y int) bool

Click selects in the graph.

func (*Scene) Context

func (s *Scene) Context(int, int) bool

func (*Scene) Draw

func (s *Scene) Draw(buf []byte)

Draw paints the whole scene.

func (*Scene) Graph

func (s *Scene) Graph() *toolkit.GraphView

Graph is the scene's graph widget (tests).

func (*Scene) KeyDown

func (s *Scene) KeyDown(k string) bool

KeyDown moves the selection.

func (*Scene) Move

func (s *Scene) Move(int, int) bool

Move, Release, Context and Char do nothing on this page (the filter is an HTML input outside the canvas, so dead keys and IMEs work in it).

func (*Scene) Post

func (s *Scene) Post(u *v1.FlowMapUpdate)

Post queues an update from any goroutine; AnimationStep applies it on the UI goroutine.

func (*Scene) Release

func (s *Scene) Release(int, int) bool

func (*Scene) Resize

func (s *Scene) Resize(w, h int) (int, int)

Resize lays the scene out at w x h (at least 640 x 360).

func (*Scene) SetFilter

func (s *Scene) SetFilter(f string)

SetFilter sets the graph's filter (from the page's search box).

func (*Scene) Size

func (s *Scene) Size() (int, int)

Size is the current surface size.

type State

type State struct {
	Seq      uint64   `json:"seq"`
	Status   string   `json:"status"`
	Clusters []string `json:"clusters"`
	Nodes    []string `json:"nodes"`
	Edges    []string `json:"edges"`
	Denied   []string `json:"denied"`
	Selected string   `json:"selected"`
	Filter   string   `json:"filter"`
	Events   []string `json:"events"`
}

State is what the page exposes to its tests: the view model, not pixels.

type VM

type VM struct {
	Graph  *toolkit.GraphViewModel
	Events []Event
	// Status is the line under the title: connection and counts.
	Status string
	Seq    uint64
	// contains filtered or unexported fields
}

VM is the page's view model. Graph is what the GraphView draws; the other fields feed the details panel. Apply is called on the UI goroutine.

func NewVM

func NewVM() *VM

NewVM returns an empty view model.

func (*VM) Apply

func (vm *VM) Apply(u *v1.FlowMapUpdate)

Apply takes one update. Clusters and nodes are rebuilt only when their set changed (so the GraphView keeps its layout); edges are replaced every time.

func (*VM) Details

func (vm *VM) Details() []string

Details describes the selection for the details panel.

func (*VM) Snapshot

func (vm *VM) Snapshot() State

Snapshot is the view model as plain data.

Directories

Path Synopsis
Command wasm is the flow-map page's WebAssembly: it reads the page's configuration (class, ticket or session token, from the URL fragment, set by flowmap.js), streams FlowLogService.WatchFlowMap from the relay that served the page, and runs the scene on the canvas.
Command wasm is the flow-map page's WebAssembly: it reads the page's configuration (class, ticket or session token, from the URL fragment, set by flowmap.js), streams FlowLogService.WatchFlowMap from the relay that served the page, and runs the scene on the canvas.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL