10#ifndef _SWATDB_CATALOG_H_
11#define _SWATDB_CATALOG_H_
22#include <unordered_map>
240 std::string file_name,
bool to_save =
true);
370 void setSave(
bool save_on_exit, std::string rel_name);
380 void setRelName(std::string old_rel_name, std::string new_rel_name);
417 std::unordered_map<std::string, FileId> relations;
FileId next_fid
Definition catalog.h:431
Catalog(std::string db_metadata_file)
create a catalog from existing DB state stored in meta data file
FileId getFileId(std::string name)
Returns the FileId associated with the File identified by the given relation name.
File * getFile(FileId file_id)
Returns the File object associated with the given FileId.
std::uint32_t getNumValid()
Returns the number of valid entries in the catalog.
void setRelName(std::string old_rel_name, std::string new_rel_name)
Setter method for the relation name and file name of a relation. Note that both the rel_name and the ...
std::string getFileName(FileId file_id)
Returns the filename associated with the given FileId.
void _setFile(FileId file_id, File *file_ptr)
Set the File * field of a Catalog entry.
std::vector< CatalogEntry > entries
Definition catalog.h:421
void _saveDBStateToFile(std::string db_metadata_filename)
Valled by SwatDB on shutdown to save DB meta data state to a file.
std::mutex cat_mux
Definition catalog.h:445
Schema * getSchema(FileId file_id)
Returns the schema of the requested file.
void deleteEntry(FileId file_id)
Deletes an entry from the database.
CatType getType(FileId file_id)
Returns the type of the requested file.
std::uint32_t num_valid_entries
Definition catalog.h:440
Catalog()
creates an empty Catalog (should only be one in the system)
void printCatInfo()
prints out all files in the catalog and its type, then prints out the relation file associated with i...
std::vector< FileId > getFileIds()
Gets the set of valid FileIDs in the system.
FileId addEntry(std::string name, Schema *schema, File *file, SearchKeyFormat *key_format, CatType type, FileId relation, std::string file_name, bool to_save=true)
Adds an entry to the catalog with a defined schema. May be called to create an entry for an index or ...
FileId getRelationFileId(FileId file_id)
Returns the FileId for the relation file associated with the given index file id.
void setSave(bool save_on_exit, std::string rel_name)
Setter method for the boolean save_on_exit.
~Catalog()
Destroys the Catalog object.
std::string name
Definition catalog.h:72
std::vector< FileId > index_list
Definition catalog.h:121
bool save_on_exit
Definition catalog.h:127
File * file
Definition catalog.h:92
bool valid
Definition catalog.h:102
SearchKeyFormat * key_format
Definition catalog.h:87
FileId relation
Definition catalog.h:115
FileId file_id
Definition catalog.h:67
bool alloced
Definition catalog.h:107
CatType entry_type
Definition catalog.h:77
std::string file_name
Definition catalog.h:97
Schema * schema
Definition catalog.h:82
std::uint32_t FileId
Definition swatdb_types.h:33
CatType
Definition swatdb_types.h:145