Struct File_Namespace::FileInfo

struct FileInfo

Public Functions

FileInfo(FileMgr *fileMgr, const int32_t fileId, FILE *f, const size_t pageSize, const size_t numPages, const bool init = false)

Constructor.

~FileInfo()

Destructor.

void initNewFile()

Adds all pages to freePages and zeroes first four bytes of header.

void freePageDeferred(int32_t pageId)
void freePage(int32_t pageId, const bool isRolloff, int32_t epoch)
int32_t getFreePage()
size_t write(const size_t offset, const size_t size, const int8_t *buf)
size_t read(const size_t offset, const size_t size, int8_t *buf)
void openExistingFile(std::vector<HeaderInfo> &headerVec)
void print(bool pagesummary)

Prints a summary of the file to stdout.

size_t size() const

Returns the number of bytes used by the file.

int32_t syncToDisk()

Syncs file to disk via a buffer flush and then a sync (fflush and fsync on posix systems)

size_t available()

Returns the number of free bytes available.

size_t numFreePages()

Returns the number of free pages available.

size_t used()

Returns the amount of used bytes; size() - available()

void freePageImmediate(int32_t page_num)
void recoverPage(const ChunkKey &chunk_key, int32_t page_num)

Public Members

FileMgr *fileMgr
int32_t fileId
FILE *f

unique file identifier (i.e., used for a file name)

size_t pageSize

file stream object for the represented file

size_t numPages

the fixed size of each page in the file

bool isDirty = {false}

the number of pages in the file

std::set<size_t> freePages
std::mutex freePagesMutex_

set of page numbers of free pages

std::mutex readWriteMutex_