Exemple #1
0
func writePartialEdges(ctx context.Context, sorter disksort.Interface, idx table.BufferedInverted, src *ipb.Source) error {
	edges := assemble.PartialReverseEdges(src)
	for _, pe := range edges {
		if err := sorter.Add(pe); err != nil {
			return err
		}
	}
	return nil
}
Exemple #2
0
func writePartialEdges(ctx context.Context, out *servingOutput, src *assemble.Source) error {
	edges := assemble.PartialReverseEdges(src)
	for _, pe := range edges {
		var target string
		if pe.Target != nil {
			target = pe.Target.Ticket
		}
		if err := out.completeEdges.Put(ctx,
			[]byte(pe.Source.Ticket+tempTableKeySep+pe.Kind+tempTableKeySep+target), pe); err != nil {
			return fmt.Errorf("error writing partial edge: %v", err)
		}
	}
	if err := search.IndexNode(ctx, out.idx, edges[0].Source); err != nil {
		return err
	}
	return nil
}