Documentation ¶
Overview ¶
Package graph defines the graph Service interface and some useful utility functions.
Index ¶
- func AllEdges(ctx context.Context, es Service, req *gpb.EdgesRequest) (*gpb.EdgesReply, error)
- func EdgesMap(edges map[string]*gpb.EdgeSet) map[string]map[string]map[string]map[int32]struct{}
- func NodesMap(nodes map[string]*cpb.NodeInfo) map[string]map[string][]byte
- func RegisterHTTPHandlers(ctx context.Context, gs Service, mux *http.ServeMux)
- type BoundedRequests
- type ByOrdinal
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllEdges ¶
func AllEdges(ctx context.Context, es Service, req *gpb.EdgesRequest) (*gpb.EdgesReply, error)
AllEdges returns all edges for a particular EdgesRequest. This means that the returned reply will not have a next page token. WARNING: the paging API exists for a reason; using this can lead to very large memory consumption depending on the request.
func RegisterHTTPHandlers ¶
RegisterHTTPHandlers registers JSON HTTP handlers with mux using the given graph Service. The following methods with be exposed:
GET /nodes Request: JSON encoded graph.NodesRequest Response: JSON encoded graph.NodesReply GET /edges Request: JSON encoded graph.EdgesRequest Response: JSON encoded graph.EdgesReply
Note: /nodes, and /edges will return their responses as serialized protobufs if the "proto" query parameter is set.
Types ¶
type BoundedRequests ¶
BoundedRequests guards against requests for more tickets than allowed per the MaxTickets configuration.
func (BoundedRequests) Edges ¶
func (b BoundedRequests) Edges(ctx context.Context, req *gpb.EdgesRequest) (*gpb.EdgesReply, error)
Edges implements part of the Service interface.
func (BoundedRequests) Nodes ¶
func (b BoundedRequests) Nodes(ctx context.Context, req *gpb.NodesRequest) (*gpb.NodesReply, error)
Nodes implements part of the Service interface.
type ByOrdinal ¶
type ByOrdinal []*gpb.EdgeSet_Group_Edge
ByOrdinal orders the edges in an edge group by their ordinals, with ties broken by ticket.
type Service ¶
type Service interface { Nodes(context.Context, *gpb.NodesRequest) (*gpb.NodesReply, error) Edges(context.Context, *gpb.EdgesRequest) (*gpb.EdgesReply, error) }
Service exposes direct access to nodes and edges in a Kythe graph.