size of kvs won't be too big, we would take care before proposing.
(ctx context.Context, kvs []*bpb.KV)
| 39 | |
| 40 | // size of kvs won't be too big, we would take care before proposing. |
| 41 | func populateKeyValues(ctx context.Context, kvs []*bpb.KV) error { |
| 42 | glog.Infof("Writing %d keys\n", len(kvs)) |
| 43 | if len(kvs) == 0 { |
| 44 | return nil |
| 45 | } |
| 46 | writer := posting.NewTxnWriter(pstore) |
| 47 | if err := writer.Write(&bpb.KVList{Kv: kvs}); err != nil { |
| 48 | return err |
| 49 | } |
| 50 | if err := writer.Flush(); err != nil { |
| 51 | return err |
| 52 | } |
| 53 | pk, err := x.Parse(kvs[0].Key) |
| 54 | if err != nil { |
| 55 | return errors.Errorf("while parsing KV: %+v, got error: %v", kvs[0], err) |
| 56 | } |
| 57 | return schema.Load(pk.Attr) |
| 58 | } |
| 59 | |
| 60 | func batchAndProposeKeyValues(ctx context.Context, kvs chan *pb.KVS) error { |
| 61 | glog.Infoln("Receiving predicate. Batching and proposing key values") |
no test coverage detected