// Scan scans the key range specified by start key through end key up // to some maximum number of results. The last key of the iteration is // returned with the reply. func (r *Range) Scan(batch engine.Engine, args proto.ScanRequest) (proto.ScanResponse, []proto.Intent, error) { var reply proto.ScanResponse rows, intents, err := engine.MVCCScan(batch, args.Key, args.EndKey, args.MaxResults, args.Timestamp, args.ReadConsistency == proto.CONSISTENT, args.Txn) reply.Rows = rows return reply, intents, err }
// Scan scans the key range specified by start key through end key up // to some maximum number of results. The last key of the iteration is // returned with the reply. func (r *Range) Scan(args *proto.ScanRequest, reply *proto.ScanResponse) { kvs, err := r.engine.Scan(args.Key, args.EndKey, args.MaxResults) if err != nil { reply.SetGoError(err) return } reply.Rows = make([]proto.KeyValue, len(kvs)) for idx, kv := range kvs { // TODO(Jiang-Ming): provide the correct timestamp and checksum once switch to mvcc reply.Rows[idx] = proto.KeyValue{Key: kv.Key, Value: proto.Value{Bytes: kv.Value}} } }
// Scan scans the key range specified by start key through end key up // to some maximum number of results. The last key of the iteration is // returned with the reply. func (r *Range) Scan(batch engine.Engine, args *proto.ScanRequest, reply *proto.ScanResponse) []proto.Intent { kvs, intents, err := engine.MVCCScan(batch, args.Key, args.EndKey, args.MaxResults, args.Timestamp, args.ReadConsistency == proto.CONSISTENT, args.Txn) reply.Rows = kvs reply.SetGoError(err) return intents }
// Scan scans the key range specified by start key through end key up // to some maximum number of results. The last key of the iteration is // returned with the reply. func (r *Range) Scan(args *proto.ScanRequest, reply *proto.ScanResponse) { kvs, err := r.mvcc.Scan(args.Key, args.EndKey, args.MaxResults, args.Timestamp, args.Txn) reply.Rows = kvs reply.SetGoError(err) }