write create snap shot

This commit is contained in:
2024-05-04 14:33:12 +00:00
parent 6af4d88535
commit c59775c184
6 changed files with 152 additions and 2 deletions

View File

@ -78,5 +78,9 @@ class DiskMap : public DataDriverBase {
indexer->Put(key, data_id);
return true;
}
void Flush() {
indexer->Flush();
data_storage->Flush();
}
};
#endif // DISK_MAP_H

View File

@ -13,5 +13,6 @@ class DataDriverBase {
DataDriverBase() = default;
virtual ~DataDriverBase() = default;
virtual sjtu::vector<FileEntry> ListFiles() = 0;
virtual void Flush() = 0;
};
#endif // DRIVER_H

View File

@ -47,7 +47,10 @@ class SingleValueStorage {
~SingleValueStorage() {
if (bpm != nullptr) CloseFile();
}
void Flush() {
memcpy(raw_mem, &first_blank_element_pair_id, sizeof(size_t));
bpm->FlushAllPages();
}
void get_info(int &tmp, int n) {
if (n > info_len) return;
n += 2;