示例#1
0
func writeNodes(t table.Proto, nodeEntries <-chan *spb.Entry, nodes chan<- *srvpb.Node) error {
	defer close(nodes)
	for node := range collectNodes(nodeEntries) {
		nodes <- node
		if err := t.Put(xsrv.NodeKey(node.Ticket), node); err != nil {
			return err
		}
	}
	return nil
}
示例#2
0
文件: pipeline.go 项目: kidaa/kythe
func writeNodes(ctx context.Context, t table.Proto, nodeEntries <-chan *spb.Entry, nodes chan<- *srvpb.Node) error {
	defer close(nodes)
	defer drainEntries(nodeEntries) // ensure channel is drained on errors
	for node := range collectNodes(nodeEntries) {
		nodes <- node
		if err := t.Put(ctx, xrefs.NodeKey(node.Ticket), node); err != nil {
			return err
		}
	}
	return nil
}