Documentation ¶
Overview ¶
Package xrefs defines the xrefs Service interface and some useful utility functions.
Index ¶
- func ConvertFilters(filters []string) []*regexp.Regexp
- func EdgesMap(edges []*xpb.EdgeSet) map[string]map[string][]string
- func MatchesAny(str string, patterns []*regexp.Regexp) bool
- func NodesMap(nodes []*xpb.NodeInfo) map[string]map[string][]byte
- func RegisterHTTPHandlers(ctx context.Context, xs Service, mux *http.ServeMux)
- type DecorationsService
- type EdgesService
- type NodesEdgesService
- type NodesService
- type Normalizer
- type Patcher
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertFilters ¶
ConvertFilters converts each filter glob into an equivalent regexp.
func MatchesAny ¶
MatchesAny reports whether if str matches any of the patterns
func RegisterHTTPHandlers ¶
RegisterHTTPHandlers registers JSON HTTP handlers with mux using the given xrefs Service. The following methods with be exposed:
GET /nodes Request: JSON encoded xrefs.NodesRequest Response: JSON encoded xrefs.NodesResponse GET /edges Request: JSON encoded xrefs.EdgesRequest Response: JSON encoded xrefs.EdgesResponse GET /decorations Request: JSON encoded xrefs.DecorationsRequest Response: JSON encoded xrefs.DecorationsResponse
Note: /nodes, /edges, and /decorations will return their responses as serialized protobufs if the "proto" query parameter is set.
Types ¶
type DecorationsService ¶
type DecorationsService interface { // Decorations returns an index of the nodes and edges associated with a // particular file node. Decorations(context.Context, *xpb.DecorationsRequest) (*xpb.DecorationsReply, error) }
DecorationsService provides fast access to file decorations in a Kythe graph.
type EdgesService ¶
type EdgesService interface { // Edges returns a subset of the outbound edges for each of a set of requested // nodes. Edges(context.Context, *xpb.EdgesRequest) (*xpb.EdgesReply, error) }
EdgesService provides fast access to edges in a Kythe graph.
type NodesEdgesService ¶
type NodesEdgesService interface { NodesService EdgesService }
NodesEdgesService provides fast access to nodes and edges in a Kythe graph.
type NodesService ¶
type NodesService interface { // Nodes returns a subset of the facts for each of the requested nodes. Nodes(context.Context, *xpb.NodesRequest) (*xpb.NodesReply, error) }
NodesService provides fast access to nodes in a Kythe graph.
type Normalizer ¶
type Normalizer struct {
// contains filtered or unexported fields
}
Normalizer fixes xref.Locations within a given source text so that each point has consistent byte_offset, line_number, and column_offset fields within the range of text's length and its line lengths.
func NewNormalizer ¶
func NewNormalizer(text []byte) *Normalizer
NewNormalizer returns a Normalizer for Locations within text.
func (*Normalizer) Location ¶
Location returns a normalized location within the Normalizer's text. Normalized FILE locations have no start/end points. Normalized SPAN locations have fully populated start/end points clamped in the range [0, len(text)).
func (*Normalizer) Point ¶
func (n *Normalizer) Point(p *xpb.Location_Point) *xpb.Location_Point
Point returns a normalized point within the Normalizer's text. A normalized point has all of its fields set consistently and clamped within the range [0,len(text)).
type Patcher ¶ added in v0.0.5
type Patcher struct {
// contains filtered or unexported fields
}
Patcher uses a computed diff between two texts to map spans from the original text to the new text.
func NewPatcher ¶ added in v0.0.5
NewPatcher returns a Patcher based on the diff between oldText and newText.
func (*Patcher) Patch ¶ added in v0.0.5
Patch returns the resulting span of mapping the given span from the Patcher's constructed oldText to its newText. If the span no longer exists in newText or is invalid, the returned bool will be false. As a convenience, if p==nil, the original span will be returned.
type Service ¶
type Service interface { NodesEdgesService DecorationsService }
Service provides access to a Kythe graph for fast access to cross-references.
func GRPC ¶
func GRPC(c xpb.XRefServiceClient) Service
GRPC returns an xrefs Service backed by the given GRPC client and context.