29 #include "../../Shared/types.h"
33 namespace File_Namespace {
74 const bool init =
false);
84 void freePage(int32_t pageId,
const bool isRolloff, int32_t epoch);
86 size_t write(
const size_t offset,
const size_t size,
const int8_t* buf);
87 size_t read(
const size_t offset,
const size_t size, int8_t* buf);
92 std::string
print()
const;
std::vector< int > ChunkKey
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)
std::string print() const
Prints a summary of the file to stdout.
std::string file_path
set of page numbers of free pages
size_t numFreePages() const
Returns the number of free pages available.
void freePage(int32_t pageId, const bool isRolloff, int32_t epoch)
FileInfo(FileMgr *fileMgr, const int32_t fileId, FILE *f, const size_t pageSize, const size_t numPages, const std::string &file_path, const bool init=false)
Constructor.
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)
size_t used() const
Returns the amount of used bytes; size() - available()
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_
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 available() const
Returns the number of free bytes available.
size_t numPages
the fixed size of each page in the file
std::set< size_t > getFreePages() const
bool isDirty
the number of pages in the file