| 103 | } |
| 104 | |
| 105 | void DataReader::Body::read_one(db::Cursor* cursor, QueuePair* qp) { |
| 106 | Datum* datum = qp->free_.pop(); |
| 107 | // TODO deserialize in-place instead of copy? |
| 108 | datum->ParseFromString(cursor->value()); |
| 109 | qp->full_.push(datum); |
| 110 | |
| 111 | // go to the next iter |
| 112 | cursor->Next(); |
| 113 | if (!cursor->valid()) { |
| 114 | DLOG(INFO) << "Restarting data prefetching from start."; |
| 115 | cursor->SeekToFirst(); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | } // namespace caffe |