OmniSciDB
a5dc49c757
|
#include <FileReader.h>
Public Member Functions | |
SingleTextFileReader (const std::string &file_path, const import_export::CopyParams ©_params) | |
SingleTextFileReader (const std::string &file_path, const import_export::CopyParams ©_params, const rapidjson::Value &value) | |
~SingleTextFileReader () override | |
SingleTextFileReader (const SingleTextFileReader &)=delete | |
SingleTextFileReader & | operator= (const SingleTextFileReader &)=delete |
size_t | read (void *buffer, size_t max_size) override |
size_t | readRegion (void *buffer, size_t offset, size_t size) override |
bool | isScanFinished () const override |
size_t | getRemainingSize () override |
bool | isRemainingSizeKnown () override |
void | checkForMoreRows (size_t file_offset, const shared::FilePathOptions &options, const ForeignServer *server_options, const UserMapping *user_mapping) override |
void | serialize (rapidjson::Value &value, rapidjson::Document::AllocatorType &allocator) const override |
Public Member Functions inherited from foreign_storage::SingleFileReader | |
SingleFileReader (const std::string &file_path, const import_export::CopyParams ©_params) | |
~SingleFileReader () override=default | |
FirstLineByFilePath | getFirstLineForEachFile () const override |
bool | isEndOfLastFile () override |
std::string | getCurrentFilePath () const override |
Public Member Functions inherited from foreign_storage::FileReader | |
FileReader (const std::string &file_path, const import_export::CopyParams ©_params) | |
virtual | ~FileReader ()=default |
Private Member Functions | |
std::string | getFirstLine () const override |
void | skipHeader () override |
Private Attributes | |
std::FILE * | file_ |
size_t | data_size_ |
bool | scan_finished_ |
size_t | header_offset_ |
size_t | total_bytes_read_ |
Additional Inherited Members | |
Protected Attributes inherited from foreign_storage::FileReader | |
import_export::CopyParams | copy_params_ |
std::string | file_path_ |
Static Protected Attributes inherited from foreign_storage::SingleFileReader | |
static constexpr size_t | DEFAULT_HEADER_READ_SIZE {1024} |
Definition at line 153 of file FileReader.h.
foreign_storage::SingleTextFileReader::SingleTextFileReader | ( | const std::string & | file_path, |
const import_export::CopyParams & | copy_params | ||
) |
Definition at line 89 of file FileReader.cpp.
References data_size_, file_, heavyai::fopen(), foreign_storage::anonymous_namespace{FileReader.cpp}::get_data_size(), header_offset_, scan_finished_, and skipHeader().
foreign_storage::SingleTextFileReader::SingleTextFileReader | ( | const std::string & | file_path, |
const import_export::CopyParams & | copy_params, | ||
const rapidjson::Value & | value | ||
) |
Definition at line 117 of file FileReader.cpp.
References data_size_, file_, heavyai::fopen(), json_utils::get_value_from_object(), header_offset_, and total_bytes_read_.
|
inlineoverride |
|
delete |
|
overridevirtual |
Rescan the target files Throws an exception if the rescan fails (ie files are not in a valid appended state or not supported)
file_offset | - where to resume the scan from (end of the last row) as not all of the bytes may have been consumed by the upstream compoennet |
server_options | - only needed for S3 backed files |
user_mapping | - only needed for S3 backed files |
Reimplemented from foreign_storage::FileReader.
Definition at line 144 of file FileReader.cpp.
References CHECK, data_size_, file_, foreign_storage::FileReader::file_path_, heavyai::fopen(), foreign_storage::anonymous_namespace{FileReader.cpp}::get_data_size(), header_offset_, isScanFinished(), scan_finished_, foreign_storage::throw_removed_row_in_file_error(), to_string(), and total_bytes_read_.
|
overrideprivatevirtual |
Implements foreign_storage::SingleFileReader.
Definition at line 180 of file FileReader.cpp.
References CHECK, foreign_storage::FileReader::copy_params_, foreign_storage::FileReader::file_path_, parse_ast::line, and import_export::CopyParams::line_delim.
Referenced by skipHeader().
|
inlineoverridevirtual |
Implements foreign_storage::FileReader.
Definition at line 188 of file FileReader.h.
References data_size_, and total_bytes_read_.
|
inlineoverridevirtual |
Implements foreign_storage::FileReader.
Definition at line 190 of file FileReader.h.
|
inlineoverridevirtual |
Implements foreign_storage::FileReader.
Definition at line 186 of file FileReader.h.
References scan_finished_.
Referenced by checkForMoreRows(), and readRegion().
|
delete |
|
inlineoverridevirtual |
Read up to max_size bytes from archive into buffer starting starting from the end of the last read
buffer | - buffer to load into |
max_size | - maximum number of bytes to read into the buffer |
Implements foreign_storage::FileReader.
Definition at line 166 of file FileReader.h.
References file_, scan_finished_, and total_bytes_read_.
|
inlineoverridevirtual |
Read up to max_size bytes from archive, starting at given offset isScanFinished() must return true to use readRegion
buffer | - buffer to load into |
offset | - starting point into the archive to read |
size | - maximum number of bytes to read into the buffer |
Implements foreign_storage::FileReader.
Definition at line 176 of file FileReader.h.
References CHECK, file_, foreign_storage::FileReader::file_path_, header_offset_, isScanFinished(), and to_string().
|
overridevirtual |
Serialize internal state to given json object This Json will later be used to restore the reader state through a constructor must be called when isScanFinished() is true
value | - json object to store needed state to this function can store any needed data or none |
allocator | - allocator to use for json contruction |
Implements foreign_storage::FileReader.
Definition at line 134 of file FileReader.cpp.
References json_utils::add_value_to_object(), CHECK, data_size_, header_offset_, scan_finished_, and total_bytes_read_.
|
overrideprivatevirtual |
Implements foreign_storage::SingleFileReader.
Definition at line 174 of file FileReader.cpp.
References foreign_storage::FileReader::copy_params_, getFirstLine(), import_export::CopyParams::has_header, header_offset_, and import_export::kNoHeader.
Referenced by SingleTextFileReader().
|
private |
Definition at line 206 of file FileReader.h.
Referenced by checkForMoreRows(), getRemainingSize(), serialize(), and SingleTextFileReader().
|
private |
Definition at line 204 of file FileReader.h.
Referenced by checkForMoreRows(), read(), readRegion(), SingleTextFileReader(), and ~SingleTextFileReader().
|
private |
Definition at line 211 of file FileReader.h.
Referenced by checkForMoreRows(), readRegion(), serialize(), SingleTextFileReader(), and skipHeader().
|
private |
Definition at line 208 of file FileReader.h.
Referenced by checkForMoreRows(), isScanFinished(), read(), serialize(), and SingleTextFileReader().
|
private |
Definition at line 213 of file FileReader.h.
Referenced by checkForMoreRows(), getRemainingSize(), read(), serialize(), and SingleTextFileReader().