Documentation
¶
Index ¶
- Variables
- type Config
- type Coord
- type DenseID
- type GridStats
- type LOD
- type Layout
- func (layout *Layout) Bounds() Rect
- func (layout *Layout) Config() Config
- func (layout *Layout) GridStats() GridStats
- func (layout *Layout) MarshalBinary() ([]byte, error)
- func (layout *Layout) Nodes() []Node
- func (layout *Layout) QueryViewport(query ViewportQuery) (ViewportResult, error)
- func (layout *Layout) SnapshotID() uint64
- type Node
- type NodeKind
- type NodeRef
- type Rect
- type ViewportQuery
- type ViewportResult
Constants ¶
This section is empty.
Variables ¶
var ( ErrNilSnapshot = errors.New("layout snapshot is nil") ErrNilLayout = errors.New("layout is nil") ErrInvalidConfig = errors.New("layout configuration is invalid") ErrInvalidContainment = errors.New("snapshot containment is invalid") ErrLayoutOverflow = errors.New("layout coordinate overflow") ErrLayoutTooLarge = errors.New("layout is too large") ErrInvalidViewport = errors.New("layout viewport is invalid") ErrInvalidLOD = errors.New("layout level of detail is invalid") ErrViewportNodeLimit = errors.New("layout viewport node limit is invalid") ErrViewportTooLarge = errors.New("layout viewport exceeds cell limit") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
SymbolWidth Coord
SymbolHeight Coord
SymbolGap Coord
FilePadding Coord
FileGap Coord
PackagePadding Coord
PackageGap Coord
RepositoryPadding Coord
RepositoryGap Coord
// Columns fixes the width of every child grid. Zero balances each
// container instead: ceil(sqrt(children)), so a workspace does not become
// a column dozens of screens tall that no viewport can read.
Columns int
CellSize Coord
// MaxIndexedCellsPerNode prevents large containers from being copied into
// thousands of grid buckets. Such nodes are kept in an ordered overflow
// list and checked directly during a query.
MaxIndexedCellsPerNode int
MaxQueryCells int
MaxQueryNodes int
}
Config controls the deterministic hierarchy packer and spatial index.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the reproducible layout configuration used by the viewer unless a caller supplies an explicit configuration.
type Coord ¶
type Coord int64
Coord is a signed fixed-point layout coordinate. Layout calculations never use floating-point arithmetic, so identical snapshot/configuration pairs produce byte-identical positions on every supported architecture.
type DenseID ¶
type DenseID uint32
DenseID is scoped by NodeRef.Kind and therefore cannot be mistaken for a repository, package, file, or symbol ID outside that discriminant.
type LOD ¶
type LOD uint8
LOD is the deepest hierarchy level returned by a viewport query. A query at LODPackages may return repositories and packages, but never files or symbols.
type Layout ¶
type Layout struct {
// contains filtered or unexported fields
}
Layout is an immutable hierarchy layout and its read-only spatial index.
func Build ¶
func Build(ctx context.Context, snapshot *hotsnapshot.GraphSnapshot, config Config) (*Layout, error)
Build lays out repository -> package -> file -> symbol with deterministic row-major packing. It never performs force simulation or graph traversal.
func (*Layout) MarshalBinary ¶
MarshalBinary returns a deterministic internal layout encoding used to compare two builds. It is not the HTTP viewer wire protocol.
func (*Layout) Nodes ¶
Nodes returns a copy of all nodes in deterministic repository/package/file/ symbol order.
func (*Layout) QueryViewport ¶
func (layout *Layout) QueryViewport(query ViewportQuery) (ViewportResult, error)
QueryViewport returns all nodes whose bounds intersect query.Bounds and whose detail level is at most query.MaxLevel. It uses the deterministic grid order, then restores immutable node order before applying MaxNodes.
func (*Layout) SnapshotID ¶
SnapshotID returns the source HotSnapshot identifier.
type Node ¶
Node is an immutable positioned hierarchy node. ID is interpreted according to Kind and is the dense ID in the source HotSnapshot table.
type Rect ¶
Rect is a half-open axis-aligned rectangle: [MinX, MaxX) x [MinY, MaxY).
func (Rect) Intersects ¶
Intersects reports whether two half-open rectangles share area.
type ViewportQuery ¶
ViewportQuery limits a spatial query by bounds, detail level, and result count. Bounds use the same half-open convention as Rect.
type ViewportResult ¶
ViewportResult is ordered by the immutable layout node order. Truncated is true only when at least one additional matching node was omitted by MaxNodes.