29 #include "../../Shared/types.h"
33 namespace File_Namespace {
72 const bool init =
false);
82 void freePage(int32_t pageId,
const bool isRolloff, int32_t epoch);
84 size_t write(
const size_t offset,
const size_t size,
const int8_t* buf);
85 size_t read(
const size_t offset,
const size_t size, int8_t* buf);
89 void print(
bool pagesummary);
std::vector< int > ChunkKey
FileInfo(FileMgr *fileMgr, const int32_t fileId, FILE *f, const size_t pageSize, const size_t numPages, const bool init=false)
Constructor.
size_t write(const size_t offset, const size_t size, const int8_t *buf)
bool is_page_deleted_without_checkpoint(int32_t table_epoch, int32_t page_epoch, int32_t contingent)
std::mutex readWriteMutex_
void freePageImmediate(int32_t page_num)
void freePage(int32_t pageId, const bool isRolloff, int32_t epoch)
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
constexpr int32_t ROLLOFF_CONTINGENT
size_t read(const size_t offset, const size_t size, int8_t *buf)
bool is_page_deleted_with_checkpoint(int32_t table_epoch, int32_t page_epoch, int32_t contingent)
FILE * f
unique file identifier (i.e., used for a file name)
This file contains the declaration and definition of a Page type and a MultiPage type.
void openExistingFile(std::vector< HeaderInfo > &headerVec)
void recoverPage(const ChunkKey &chunk_key, int32_t page_num)
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.