10#ifndef _SWATDB_FILEMGR_H_
11#define _SWATDB_FILEMGR_H_
98 std::string file_name,
bool save_on_exit =
true);
133 std::string index_file_name,
FileId rel_fid,
134 bool save_on_exit =
false);
BufferManager * buf_mgr
Definition filemgr.h:320
void _saveOrRemoveFiles()
Flushes and closes all underlying files in the system, saving db state.
void _loadAllFiles()
Loads all Files listed in the Catalog.
FileId createRelation(std::string name, Schema *schema, CatType type, std::string file_name, bool save_on_exit=true)
Creates a new Relation in the system. Adds an entry for the new file to the Catalog and creates the u...
void removeFile(FileId file_id)
Deletes a File or Index from the system and removes its underlying storage from the database.
void removeRelation(std::string name)
Deletes relation from the system and removes its underlying storage from the database.
void _removeAllFiles()
Removes all Files in the system and their underlying storage from the database.
File * getRelation(std::string name)
Retuns File object identified by the relation name.
File * getFile(FileId file_id)
Retuns File object identified by the given FileId.
void fileToText(FileId file_id, std::string file_name)
saves contents of a file to a text file.
void printFile(FileId file_id, std::uint64_t max_to_print=50)
prints a file's contents to stdout (default, only prints up to the first 50 records)
void _loadFile(FileId fid)
Loads an existing relation into the system, whose contents are already stored in a file on disk.
~FileManager()
Destructor.
FileId createIndex(std::string name, std::vector< std::string > field_list, std::string index_file_name, FileId rel_fid, bool save_on_exit=false)
Creates a new Index in the system. Adds an entry for the new file to the Catalog and creates the unde...
std::uint64_t getNumRecords(FileId file_id)
returns the number of records in a relation file
Catalog * catalog
Definition filemgr.h:315
FileManager(Catalog *cat, BufferManager *buf_mgr, bool load=false)
Creates SwatDB FileManager, the interface to the File layer.
std::uint32_t FileId
Definition swatdb_types.h:33
CatType
Definition swatdb_types.h:145