Documentation ¶
Overview ¶
Package paths specializes the util/reduce interfaces for Kythe *ipb.Paths.
Index ¶
- func FromSource(src *ipb.Source) []*ipb.Path
- func KeyValue(sortKey string, p *ipb.Path) (*ipb.SortedKeyValue, error)
- func OriginalNode(n *ipb.Path_Node) (g *srvpb.Node)
- func RawAnchor(n *ipb.Path_Node) *srvpb.RawAnchor
- func ReverseSinglePath(p *ipb.Path) *ipb.Path
- func ToString(p *ipb.Path) string
- type Reducer
- type ReducerIO
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromSource ¶
FromSource creates a set of *ipb.Paths for each of its edges as well as a single *ipb.Path with only its pivot set to be the source node.
func KeyValue ¶
KeyValue returns an equivalent SortedKeyValue of the given Path. Steps will be taken to mimimize the data stored in p. Each key value is meant to be read as a sorted ReducerIO stream.
func OriginalNode ¶
OriginalNode returns the given node's original serving node, synthesizing one if necessary.
func RawAnchor ¶
RawAnchor returns and coerces n if it is an anchor node. nil will be returned otherwise.
func ReverseSinglePath ¶
ReverseSinglePath returns the reverse p, assuming it is a single-edge Path.
Types ¶
type Reducer ¶
type Reducer struct { Func func(context.Context, *ipb.Path_Node, ReducerIO) error OutputSort func(*ipb.Path) string }
Reducer implements the reduce.Reduce interface for *ipb.Paths. Func will be called once per Reduce call. If non-nil, OutputSort will be called on each emitted *ipb.Path and used as its sort-key in the constructed *ipb.SortedKeyValue.
The Reducer's underlying input/output values are *ipb.SortedKeyValues with keys matching each Path's pivot ticket and user-defined sort keys. Each Reducer is meant to be used with reduce.Sort.
Paths are not written/read as given. To limit the amount of data written/read, all specializations (and orignal facts) will be removed from each Pivot node. A Reducer can pass-through these fields with a Path only populated with its Pivot node (not edges). These pivot-only paths will be yielded to Func as its second parameter (and not through its ReducerIO). Prefix pivot-only paths will also be used to replace later Path pivots. Duplicate pivot-only paths will be discarded; the most specialized version will be chosen (or if that is ambiguous, the first).
Likewise, each file target in an edge will have its specialization (and original facts) removed and ExpandedAnchor specializations will have their kind filled in based on their encompassing Path Edge kind.