28 #include "../../Shared/types.h"
33 namespace File_Namespace {
72 const bool init =
false);
82 void freePage(int32_t pageId,
const bool isRolloff);
84 size_t write(
const size_t offset,
const size_t size, int8_t* buf);
85 size_t read(
const size_t offset,
const size_t size, int8_t* buf);
87 void openExistingFile(std::vector<HeaderInfo>& headerVec,
const int32_t fileMgrEpoch);
89 void print(
bool pagesummary);
FileInfo(FileMgr *fileMgr, const int32_t fileId, FILE *f, const size_t pageSize, const size_t numPages, const bool init=false)
Constructor.
std::mutex readWriteMutex_
size_t write(const size_t offset, const size_t size, int8_t *buf)
std::set< size_t > freePages
size_t pageSize
file stream object for the represented file
constexpr int32_t DELETE_CONTINGENT
A FileInfo type has a file pointer and metadata about a file.
void init(LogOptions const &log_opts)
void initNewFile()
Adds all pages to freePages and zeroes first four bytes of header.
size_t size() const
Returns the number of bytes used by the file.
std::mutex freePagesMutex_
set of page numbers of free pages
void freePage(int32_t pageId, const bool isRolloff)
constexpr int32_t ROLLOFF_CONTINGENT
void openExistingFile(std::vector< HeaderInfo > &headerVec, const int32_t fileMgrEpoch)
size_t read(const size_t offset, const size_t size, int8_t *buf)
FILE * f
unique file identifier (i.e., used for a file name)
void freePageDeferred(int32_t pageId)
size_t used()
Returns the amount of used bytes; size() - available()
size_t numFreePages()
Returns the number of free pages available.
void print(bool pagesummary)
Prints a summary of the file to stdout.
size_t numPages
the fixed size of each page in the file
bool isDirty
the number of pages in the file
size_t available()
Returns the number of free bytes available.