Documentation
¶
Overview ¶
Package graph holds the graph surfaces the daemon serves and the magus.graph.v1alpha1 wire mapping behind them: the GET /api/v1/graph route (a bulk subgraph document) and the GraphService RPCs (ranked retrieval - query, resolve, explain, path, stats). Both consume DOMAIN values and map them onto the versioned protobuf; the route encodes as snake_case protojson, wire-compatible with what the browser Graph Explorer already parses. The targets flavor has no proto twin, so it is written as its domain JSON directly (see the handler).
Index ¶
- type GraphHandler
- type Service
- func (s *Service) ExplainNode(ctx context.Context, req *connect.Request[graphv1.ExplainNodeRequest]) (*connect.Response[graphv1.NodeContext], error)
- func (s *Service) FindAffected(ctx context.Context, req *connect.Request[graphv1.FindAffectedRequest]) (*connect.Response[graphv1.Affected], error)
- func (s *Service) FindDependents(ctx context.Context, req *connect.Request[graphv1.FindDependentsRequest]) (*connect.Response[graphv1.Dependents], error)
- func (s *Service) FindPath(ctx context.Context, req *connect.Request[graphv1.FindPathRequest]) (*connect.Response[graphv1.Path], error)
- func (s *Service) GetGraphStats(ctx context.Context, req *connect.Request[graphv1.GetGraphStatsRequest]) (*connect.Response[graphv1.GraphStats], error)
- func (s *Service) QueryNodes(ctx context.Context, req *connect.Request[graphv1.QueryNodesRequest]) (*connect.Response[graphv1.QueryNodesResponse], error)
- func (s *Service) ResolveNodes(ctx context.Context, req *connect.Request[graphv1.ResolveNodesRequest]) (*connect.Response[graphv1.ResolveNodesResponse], error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GraphHandler ¶
GraphHandler serves GET /api/v1/graph.
Query params (the frozen v1 contract the browser Graph Explorer already speaks):
- (none) -> the whole knowledge graph
- ?level=projects -> skeleton: project nodes + project->project edges only
- ?select=<terms> -> scoped neighborhood (graph export --select semantics)
- ?flavor=targets -> the describe/target graph (types.TargetGraphOutput)
At most one of flavor/level/select may be set; combinations are rejected. Knowledge-graph flavors are written as magus.graph.v1alpha1 protojson (snake_case, wire-compatible). The targets flavor has no proto twin and is written as its domain JSON. ETag is sha256 of the body; If-None-Match yields a 304. Gzip is applied by the NewGraphHandler wrapper.
func NewGraphHandler ¶
func NewGraphHandler(src graphSource, log *slog.Logger) *GraphHandler
NewGraphHandler returns the GET /api/v1/graph handler reading from src, wrapped so its body is gzip-compressed when the client accepts it.
type Service ¶ added in v0.4.0
type Service struct {
// contains filtered or unexported fields
}
Service implements graphv1alpha1connect.GraphServiceHandler over the workspace knowledge graph. Every RPC is read-only; the daemon mounts it behind the console read bearer.
func NewService ¶ added in v0.4.0
func NewService(ws resolver) *Service
NewService builds a GraphService handler reading from ws.