Пример #1
0
func writeIndex(t table.Inverted, nodes <-chan *srvpb.Node) error {
	for n := range nodes {
		if err := search.IndexNode(t, n); err != nil {
			return err
		}
	}
	return nil
}
Пример #2
0
func writePartialEdges(ctx context.Context, sorter disksort.Interface, idx table.BufferedInverted, src *assemble.Source) error {
	edges := assemble.PartialReverseEdges(src)
	for _, pe := range edges {
		if err := sorter.Add(pe); err != nil {
			return err
		}
	}
	if err := search.IndexNode(ctx, idx, edges[0].Source); err != nil {
		return err
	}
	return nil
}
Пример #3
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
}