Documentation
¶
Index ¶
- func DetectValueType(value any) string
- func Migrations(opts ...migration.SuiteOption) *migration.Suite
- func TypeEdgeFromEdge(e Edge) types.Edge
- func TypeGraphFromGraph(g Graph) *types.Graph
- func TypeNodeFromNode(n Node) types.Node
- type Edge
- type Graph
- type GraphLogs
- type GraphRecomputeHeap
- type Manager
- func (m Manager) DeleteEdge(ctx context.Context, parentID, childID uuid.UUID, childInputName string) (err error)
- func (m Manager) DeleteGraph(ctx context.Context, graphID uuid.UUID) (found bool, err error)
- func (m Manager) DeleteNode(ctx context.Context, nodeID uuid.UUID) (found bool, err error)
- func (m Manager) Deserialize(ctx context.Context, graphID uuid.UUID, skipValues, skipRecomputeHeap bool) (output *types.GraphFull, err error)
- func (m Manager) Edges(ctx context.Context, graphID uuid.UUID) (output []Edge, err error)
- func (m Manager) Graph(ctx context.Context, id uuid.UUID) (output Graph, found bool, err error)
- func (m Manager) GraphActiveForUser(ctx context.Context, userID uuid.UUID) (output Graph, found bool, err error)
- func (m Manager) GraphLogsLatest(ctx context.Context, graphID uuid.UUID) (output GraphLogs, found bool, err error)
- func (m Manager) GraphsForUser(ctx context.Context, userID uuid.UUID) (output []Graph, err error)
- func (m Manager) MarkNodeStale(ctx context.Context, graphID, userID, nodeID uuid.UUID) (found bool, err error)
- func (m Manager) Node(ctx context.Context, id uuid.UUID) (output Node, found bool, err error)
- func (m Manager) NodeValue(ctx context.Context, graphID, nodeID uuid.UUID) (output NodeValue, found bool, err error)
- func (m Manager) NodeValues(ctx context.Context, graphID uuid.UUID, nodeIDs ...uuid.UUID) (output []NodeValue, err error)
- func (m Manager) Nodes(ctx context.Context, graphID uuid.UUID) (output []Node, err error)
- func (m Manager) PatchGraph(ctx context.Context, graphID uuid.UUID, ps types.PatchSet) (found bool, err error)
- func (m Manager) PatchNode(ctx context.Context, nodeID uuid.UUID, ps types.PatchSet) (bool, error)
- func (m Manager) PatchNodes(ctx context.Context, graphID uuid.UUID, ps types.PatchSet) error
- func (m Manager) RecomputeHeap(ctx context.Context, graphID uuid.UUID) (output []GraphRecomputeHeap, err error)
- func (m Manager) SetNodeHeights(ctx context.Context, graphID uuid.UUID, nodeHeights map[uuid.UUID]int) (err error)
- func (m Manager) SetNodeMetadata(ctx context.Context, graphID uuid.UUID, nodeMetadata map[uuid.UUID]Node) (err error)
- func (m Manager) SetNodeValues(ctx context.Context, graphID, userID uuid.UUID, values map[uuid.UUID]any) error
- func (m Manager) SetRecomputeHeap(ctx context.Context, graphID, userID uuid.UUID, nodeIDs ...uuid.UUID) (err error)
- func (m Manager) SetViewport(ctx context.Context, graphID uuid.UUID, viewport types.Viewport) (err error)
- func (m Manager) TouchGraph(ctx context.Context, graphID uuid.UUID) (err error)
- func (m Manager) UpdateGraphPostStabilization(ctx context.Context, graphID uuid.UUID, stabilizationNum uint64) error
- type Node
- type NodeValue
- type Store
- func (s Store) AddNode(ctx context.Context, n *types.Node) (id incr.Identifier, err error)
- func (s Store) Edges(ctx context.Context) ([]types.Edge, error)
- func (s Store) Graph(ctx context.Context) (*types.Graph, error)
- func (s Store) LinkInput(ctx context.Context, te types.Edge) error
- func (s Store) Load(ctx context.Context, graph *types.GraphFull) (id incr.Identifier, err error)
- func (s Store) Logs(ctx context.Context) (string, error)
- func (s Store) MarkNodeStale(ctx context.Context, nodeID incr.Identifier) (found bool, err error)
- func (s Store) Node(ctx context.Context, id incr.Identifier) (output types.Node, found bool, err error)
- func (s Store) NodeValue(ctx context.Context, id incr.Identifier) (any, bool, error)
- func (s Store) NodeValues(ctx context.Context, nodeIDs ...incr.Identifier) ([]types.NodeValue, error)
- func (s Store) Nodes(ctx context.Context) ([]types.Node, error)
- func (s Store) PatchNode(ctx context.Context, id incr.Identifier, ps types.PatchSet) (found bool, err error)
- func (s Store) PatchNodeTable(ctx context.Context, nodeID incr.Identifier, ops ...types.TableOp) (bool, error)
- func (s Store) PatchNodes(ctx context.Context, ps types.PatchSet) (err error)
- func (s Store) RemoveNode(ctx context.Context, id incr.Identifier) (found bool, err error)
- func (s Store) Save(ctx context.Context) (*types.GraphFull, error)
- func (s Store) SetNodeValue(ctx context.Context, nodeID incr.Identifier, value any) (bool, error)
- func (s Store) SetViewport(ctx context.Context, viewport types.Viewport) error
- func (s Store) Stabilize(ctx context.Context, parallel bool) (stabilizationNum uint64, err error)
- func (s Store) UnlinkInput(ctx context.Context, te types.Edge) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectValueType ¶
func Migrations ¶
func Migrations(opts ...migration.SuiteOption) *migration.Suite
Migrations returns the migration suite to bootstrap the database.
func TypeEdgeFromEdge ¶
TypeEdgeFromEdge returns an api edge from a given db edge.
func TypeGraphFromGraph ¶
TypeGraphFromGraph returns an api graph from an api graph.
func TypeNodeFromNode ¶
TypeNodeFromNode returns an api type node from a db model type node.
Types ¶
type Edge ¶
type Edge struct { CreatedUTC time.Time `db:"created_utc"` GraphID uuid.UUID `db:"graph_id,pk"` UserID uuid.UUID `db:"user_id,pk"` ParentID uuid.UUID `db:"parent_id,pk"` ChildID uuid.UUID `db:"child_id,pk"` ChildInputName string `db:"child_input_name,pk"` }
Edge represents a link between two nodes.
func EdgeFromType ¶
EdgeFromType returns a db edge from a given api edge.
type Graph ¶
type Graph struct { ID uuid.UUID `db:"id,pk"` CreatedUTC time.Time `db:"created_utc"` UpdatedUTC time.Time `db:"updated_utc"` UserID uuid.UUID `db:"user_id"` Label string `db:"label"` StabilizationNum uint64 `db:"stabilization_num"` ViewportX float64 `db:"viewport_x"` ViewportY float64 `db:"viewport_y"` ViewportZoom float64 `db:"viewport_zoom"` }
Graph is the root object for computations.
func GraphFromIncr ¶
GraphFromIncr returns a db graph from an incremental graph.
func GraphFromType ¶
GraphFromType returns a db graph from an api graph.
type GraphLogs ¶
type GraphLogs struct { GraphID uuid.UUID `db:"graph_id,pk"` UserID uuid.UUID `db:"user_id,pk"` StabilizationNum uint64 `db:"stabilization_num,pk"` CreatedUTC time.Time `db:"created_utc"` Logs string `db:"logs"` }
GraphLogs are log outputs for each stabilization run.
type GraphRecomputeHeap ¶
type GraphRecomputeHeap struct { GraphID uuid.UUID `db:"graph_id,pk"` UserID uuid.UUID `db:"user_id,pk"` NodeID uuid.UUID `db:"node_id,pk"` }
func (GraphRecomputeHeap) TableName ¶
func (grh GraphRecomputeHeap) TableName() string
type Manager ¶
type Manager struct {
dbutil.BaseManager
}
func (Manager) DeleteEdge ¶
func (Manager) DeleteGraph ¶
func (Manager) DeleteNode ¶
func (Manager) Deserialize ¶
func (Manager) GraphActiveForUser ¶
func (Manager) GraphLogsLatest ¶
func (Manager) GraphsForUser ¶
func (Manager) MarkNodeStale ¶
func (Manager) NodeValues ¶
func (Manager) PatchGraph ¶
func (Manager) PatchNodes ¶
func (Manager) RecomputeHeap ¶
func (Manager) SetNodeHeights ¶
func (Manager) SetNodeMetadata ¶
func (Manager) SetNodeValues ¶
func (Manager) SetRecomputeHeap ¶
func (Manager) SetViewport ¶
func (Manager) TouchGraph ¶
TouchGraph sets the updated time for the graph in the database.
The updated time is used to order the graph in lists, so this will push the graph to be the most recently updated graph in those lists.
type Node ¶
type Node struct { ID uuid.UUID `db:"id,pk"` CreatedUTC time.Time `db:"created_utc"` UpdatedUTC *time.Time `db:"updated_utc"` GraphID uuid.UUID `db:"graph_id"` UserID uuid.UUID `db:"user_id"` Label string `db:"label"` SetAt uint64 `db:"set_at"` ChangedAt uint64 `db:"changed_at"` RecomputedAt uint64 `db:"recomputed_at"` Valid bool `db:"valid"` Always bool `db:"always"` Observer bool `db:"observer"` Height int `db:"height"` HeightInRecomputeHeap int `db:"height_in_recompute_heap"` HeightInAdjustHeightsHeap int `db:"height_in_adjust_heights_heap"` PositionX float64 `db:"position_x"` PositionY float64 `db:"position_y"` DisplayHeight *float64 `db:"display_height"` DisplayWidth *float64 `db:"display_width"` Collapsed bool `db:"collapsed"` NodeType string `db:"node_type"` InputType string `db:"input_type"` OutputType string `db:"output_type"` Watched bool `db:"watched"` WatchedCollapsed bool `db:"watched_collapsed"` Expression string `db:"expression"` }
Node is the main entity in a computation.
func NodeFromTypeNode ¶
NodeFromTypeNode returns a db model node from a given api type node.
type NodeValue ¶
type NodeValue struct { GraphID uuid.UUID `db:"graph_id,pk"` NodeID uuid.UUID `db:"node_id,pk"` UserID uuid.UUID `db:"user_id"` ValueType string `db:"value_type"` Value any `db:"value,json"` }
NodeValue is the current value for a given node in a graph.
func (NodeValue) ParsedValue ¶
ParsedValue returns the value according to the underlying type.
type Store ¶
Store is a wrapper for a model manager that implements the graph store api against the database for a given graph by identifier.