NOTE(sethtroisi): At this time PyRecordReader doesn't benefit from taking RecordReaderOptions, if this changes the API can be updated at that time.
| 33 | // NOTE(sethtroisi): At this time PyRecordReader doesn't benefit from taking |
| 34 | // RecordReaderOptions, if this changes the API can be updated at that time. |
| 35 | PyRecordReader* PyRecordReader::New(const string& filename, uint64 start_offset, |
| 36 | const string& compression_type_string, |
| 37 | TF_Status* out_status) { |
| 38 | std::unique_ptr<RandomAccessFile> file; |
| 39 | Status s = Env::Default()->NewRandomAccessFile(filename, &file); |
| 40 | if (!s.ok()) { |
| 41 | Set_TF_Status_from_Status(out_status, s); |
| 42 | return nullptr; |
| 43 | } |
| 44 | PyRecordReader* reader = new PyRecordReader; |
| 45 | reader->offset_ = start_offset; |
| 46 | reader->file_ = file.release(); |
| 47 | |
| 48 | static const uint64 kReaderBufferSize = 16 * 1024 * 1024; |
| 49 | RecordReaderOptions options = |
| 50 | RecordReaderOptions::CreateRecordReaderOptions(compression_type_string); |
| 51 | options.buffer_size = kReaderBufferSize; |
| 52 | reader->reader_ = new RecordReader(reader->file_, options); |
| 53 | return reader; |
| 54 | } |
| 55 | |
| 56 | PyRecordReader::~PyRecordReader() { |
| 57 | delete reader_; |
nothing calls this directly
no test coverage detected