Documentation ¶
Overview ¶
Package xrefs defines the xrefs Service interface and some useful utility functions.
Index ¶
- Variables
- func ConvertFilters(filters []string) []*regexp.Regexp
- func FixTickets(tickets []string) ([]string, error)
- func IsCallerKind(requestedKind xpb.CrossReferencesRequest_CallerKind, edgeKind string) bool
- func IsDeclKind(requestedKind xpb.CrossReferencesRequest_DeclarationKind, edgeKind string, ...) bool
- func IsDefKind(requestedKind xpb.CrossReferencesRequest_DefinitionKind, edgeKind string, ...) bool
- func IsInternalKind(kind string) bool
- func IsRefKind(requestedKind xpb.CrossReferencesRequest_ReferenceKind, edgeKind string) bool
- func IsRelatedNodeKind(requestedKinds stringset.Set, kind string) bool
- func MatchesAny(str string, patterns []*regexp.Regexp) bool
- func RegisterHTTPHandlers(ctx context.Context, xs Service, mux *http.ServeMux)
- type BoundedRequests
- type ByName
- type Service
Constants ¶
This section is empty.
Variables ¶
var ( // ErrPermissionDenied is returned by an implementation of a method when the // user is not allowed to view the content because of some restrictions. ErrPermissionDenied = status.Error(codes.PermissionDenied, "access denied") // ErrDecorationsNotFound is returned by an implementation of the Decorations // method when decorations for the given file cannot be found. ErrDecorationsNotFound = status.Error(codes.NotFound, "file decorations not found") // ErrCanceled is returned by services when the caller cancels the RPC. ErrCanceled = status.Error(codes.Canceled, "canceled") // ErrDeadlineExceeded is returned by services when something times out. ErrDeadlineExceeded = status.Error(codes.DeadlineExceeded, "deadline exceeded") )
Functions ¶
func ConvertFilters ¶
ConvertFilters converts each filter glob into an equivalent regexp.
func FixTickets ¶ added in v0.0.18
FixTickets converts the specified tickets, which are expected to be Kythe URIs, into canonical form. It is an error if len(tickets) == 0.
func IsCallerKind ¶ added in v0.0.27
func IsCallerKind(requestedKind xpb.CrossReferencesRequest_CallerKind, edgeKind string) bool
IsCallerKind determines whether the given edgeKind matches the requested caller kind.
func IsDeclKind ¶ added in v0.0.21
func IsDeclKind(requestedKind xpb.CrossReferencesRequest_DeclarationKind, edgeKind string, incomplete bool) bool
IsDeclKind reports whether the given edgeKind matches the requested declaration kind
func IsDefKind ¶ added in v0.0.17
func IsDefKind(requestedKind xpb.CrossReferencesRequest_DefinitionKind, edgeKind string, incomplete bool) bool
IsDefKind reports whether the given edgeKind matches the requested definition kind.
func IsInternalKind ¶ added in v0.0.27
IsInternalKind determines whether the given edge kind is an internal variant.
func IsRefKind ¶ added in v0.0.17
func IsRefKind(requestedKind xpb.CrossReferencesRequest_ReferenceKind, edgeKind string) bool
IsRefKind determines whether the given edgeKind matches the requested reference kind.
func IsRelatedNodeKind ¶ added in v0.0.27
IsRelatedNodeKind determines whether the give edge kind matches the requested related node kinds.
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 /decorations Request: JSON encoded xrefs.DecorationsRequest Response: JSON encoded xrefs.DecorationsReply GET /xrefs Request: JSON encoded xrefs.CrossReferencesRequest Response: JSON encoded xrefs.CrossReferencesReply GET /documentation Request: JSON encoded xrefs.DocumentationRequest Response: JSON encoded xrefs.DocumentationReply
Note: /nodes, /edges, /decorations, and /xrefs will return their responses as serialized protobufs if the "proto" query parameter is set.
Types ¶
type BoundedRequests ¶ added in v0.0.27
BoundedRequests guards against requests for more tickets than allowed per the MaxTickets configuration.
func (BoundedRequests) CrossReferences ¶ added in v0.0.27
func (b BoundedRequests) CrossReferences(ctx context.Context, req *xpb.CrossReferencesRequest) (*xpb.CrossReferencesReply, error)
CrossReferences implements part of the Service interface.
func (BoundedRequests) Documentation ¶ added in v0.0.27
func (b BoundedRequests) Documentation(ctx context.Context, req *xpb.DocumentationRequest) (*xpb.DocumentationReply, error)
Documentation implements part of the Service interface.
type Service ¶
type Service interface { // Decorations returns an index of the nodes associated with a specified file. Decorations(context.Context, *xpb.DecorationsRequest) (*xpb.DecorationsReply, error) // CrossReferences returns the global cross-references for the given nodes. CrossReferences(context.Context, *xpb.CrossReferencesRequest) (*xpb.CrossReferencesReply, error) // Documentation takes a set of tickets and returns documentation for them. Documentation(context.Context, *xpb.DocumentationRequest) (*xpb.DocumentationReply, error) }
Service defines the interface for file based cross-references. Informally, the cross-references of an entity comprise the definitions of that entity, together with all the places where those definitions are referenced through constructs such as type declarations, variable references, function calls, and so on.