25 #define DATA_FILE_EXT ".data"
34 namespace File_Namespace {
44 std::pair<FILE*, std::string>
create(
const std::string& basePath,
46 const size_t pageSize,
57 FILE*
create(
const std::string& full_path,
const size_t requested_file_size);
65 FILE*
open(
int file_id);
66 FILE*
open(
const std::string& path);
98 const std::string& file_path);
110 size_t write(FILE*
f,
const size_t offset,
const size_t size,
const int8_t* buf);
121 size_t append(FILE*
f,
const size_t size,
const int8_t* buf);
134 const size_t pageSize,
135 const size_t pageNum,
137 const std::string& file_path);
149 size_t writePage(FILE*
f,
const size_t pageSize,
const size_t pageNum, int8_t* buf);
160 size_t appendPage(FILE*
f,
const size_t pageSize, int8_t* buf);
size_t appendPage(FILE *f, const size_t pageSize, int8_t *buf)
Appends a page from buf to the file.
size_t append(FILE *f, const size_t size, const int8_t *buf)
Appends the specified number of bytes to the end of the file f from buf.
std::string get_legacy_data_file_path(const std::string &new_data_file_path)
size_t writePage(FILE *f, const size_t pageSize, const size_t pageNum, int8_t *buf)
Writes a page from buf to the file.
std::pair< FILE *, std::string > create(const std::string &basePath, const int fileId, const size_t pageSize, const size_t numPages)
size_t write(FILE *f, const size_t offset, const size_t size, const int8_t *buf)
Writes the specified number of bytes to the offset position in file f from buf.
bool removeFile(const std::string &base_path, const std::string &filename)
Deletes the file pointed to by the FILE pointer.
size_t read(FILE *f, const size_t offset, const size_t size, int8_t *buf, const std::string &file_path)
Reads the specified number of bytes from the offset position in file f into buf.
size_t fileSize(FILE *f)
Returns the size of the specified file.
torch::Tensor f(torch::Tensor x, torch::Tensor W_target, torch::Tensor b_target)
FILE * open(int file_id)
Opens the file with the given id; fatal crash on error.
std::string filename(char const *path)
void close(FILE *f)
Closes the file pointed to by the FILE pointer.
std::string get_data_file_path(const std::string &base_path, int file_id, size_t page_size)
void renameForDelete(const std::string directoryName)
Renames a directory to DELETE_ME_<EPOCH>_<oldname>.
constexpr auto kLegacyDataFileExtension
size_t readPage(FILE *f, const size_t pageSize, const size_t pageNum, int8_t *buf, const std::string &file_path)
Reads the specified page from the file f into buf.