Apache Singa
A General Distributed Deep Learning Library
|
General Reader that provides functions for reading tuples. More...
#include <reader.h>
Public Member Functions | |
virtual | ~Reader () |
In case that users forget to call Close() to release resources, e.g., memory, you can release them here. More... | |
virtual bool | Open (const std::string &path)=0 |
path is the path to the storage, could be a file path, database connection, or hdfs path. More... | |
virtual void | Close ()=0 |
Release resources. | |
virtual bool | Read (std::string *key, std::string *value)=0 |
Read a tuple. More... | |
virtual int | Count ()=0 |
Iterate through all tuples to get the num of all tuples. More... | |
virtual void | SeekToFirst ()=0 |
Seek to the first tuple when the cursor arrives to the end of the file. | |
General Reader that provides functions for reading tuples.
Subclasses implement the functions for a specific data storage, e.g., CSV file, HDFS, kvfile, leveldb, lmdb, etc.
|
inlinevirtual |
In case that users forget to call Close() to release resources, e.g., memory, you can release them here.
|
pure virtual |
Iterate through all tuples to get the num of all tuples.
return num of tuples
Implemented in singa::io::TextFileReader, and singa::io::BinFileReader.
|
pure virtual |
path is the path to the storage, could be a file path, database connection, or hdfs path.
return true if open successfully, otherwise false.
Implemented in singa::io::TextFileReader, and singa::io::BinFileReader.
|
pure virtual |
Read a tuple.
return true if read successfully; return flase if coming to the end of the file; LOG(FATAL) if error happens.
Implemented in singa::io::TextFileReader, and singa::io::BinFileReader.