Documentation
¶
Overview ¶
Package assemble provides functions to build the various components (nodes, edges, and decorations) of an xrefs serving table.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecorationFragments ¶
func DecorationFragments(src *Source) []*srvpb.FileDecorations
DecorationFragments returns 0 or more FileDecorations fragments from the given Source, depending on its node kind. If given an anchor, decoration fragments will be returned for each of the anchor's parents (assumed to be files). If given a file, 1 decoration fragment will be returned with the file's source text and encoding populated. All other nodes return 0 decoration fragments.
Types ¶
type ByOffset ¶
type ByOffset []*srvpb.FileDecorations_Decoration
ByOffset sorts file decorations by their byte offsets.
type EdgeSetBuilder ¶
type EdgeSetBuilder struct { // MaxEdgePageSize is maximum number of edges that are allowed in the // PagedEdgeSet and any EdgePage. If MaxEdgePageSize <= 0, no paging is // attempted. MaxEdgePageSize int // Output is used to emit each PagedEdgeSet constructed. Output func(context.Context, *srvpb.PagedEdgeSet) error // OutputPage is used to emit each EdgePage constructed. OutputPage func(context.Context, *srvpb.EdgePage) error // contains filtered or unexported fields }
EdgeSetBuilder constructs a set of PagedEdgeSets and EdgePages from a sequence of EdgeSet_Groups. All EdgeSet_Groups for the same source are assumed to be given sequentially to AddGroup, secondarily ordered by the group's edge kind. If given in this order, Output will be given exactly 1 PagedEdgeSet per source with as few EdgeSet_Group per edge kind as to satisfy MaxEdgePageSize (MaxEdgePageSize == 0 indicates that there will be exactly 1 edge group per edge kind). If not given in this order, no guarantees can be made. Flush must be called after the final call to AddGroup.
func (*EdgeSetBuilder) AddGroup ¶
func (b *EdgeSetBuilder) AddGroup(ctx context.Context, src string, eg *srvpb.EdgeSet_Group) error
AddGroup adds the given EdgeSet_Group to the builder, possibly emitting a new PagedEdgeSet and/or EdgePage. See EdgeSetBuilder's documentation for the assumed order of the groups.
func (*EdgeSetBuilder) Flush ¶
func (b *EdgeSetBuilder) Flush(ctx context.Context) error
Flush signals the end of the current PagedEdgeSet being built, flushing it, and its EdgeSet_Groups to the output function. This should be called after the final call to AddGroup. Manually calling Flush at any other time is unnecessary.
type Source ¶
Source is a collection of facts and edges with a common source.
func SourceFromEntries ¶
SourceFromEntries returns a new Source from the given a set of entries with the same source VName.