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,
49 FILE*
create(
const std::string& fullPath,
const size_t requestedFileSize);
57 FILE*
open(
int fileId);
59 FILE*
open(
const std::string& path);
91 const std::string& file_path);
103 size_t write(FILE*
f,
const size_t offset,
const size_t size,
const int8_t* buf);
114 size_t append(FILE*
f,
const size_t size,
const int8_t* buf);
127 const size_t pageSize,
128 const size_t pageNum,
130 const std::string& file_path);
142 size_t writePage(FILE*
f,
const size_t pageSize,
const size_t pageNum, int8_t* buf);
153 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.
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.
std::string filename(char const *path)
FILE * open(int fileId)
Opens/creates the file with the given id; returns NULL on error.
void close(FILE *f)
Closes the file pointed to by the FILE pointer.
bool removeFile(const std::string basePath, const std::string filename)
Deletes 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.