Skip to content

Commit

Permalink
code cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
kkli08 committed Nov 2, 2024
1 parent 46efcd5 commit b290653
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 9 deletions.
3 changes: 0 additions & 3 deletions Memory/Memtable/Memtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ class Memtable {
// Flush the memtable to disk (SST file)
void flushToDisk();

// set sstFileManager degree
void setSstFileManager_BTree_Degree(int degree) {sstFileManager->setDegree(degree);};

// get current size
int get_currentSize() const {return currentSize;};

Expand Down
2 changes: 1 addition & 1 deletion Storage/SstFileManager/SstFileManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace fs = std::filesystem;

// Constructor
SSTFileManager::SSTFileManager(const std::string& dbDirectory)
: dbDirectory(dbDirectory), degree(degree) {
: dbDirectory(dbDirectory) {
// std::cout << "SSTFileManager initialized with directory: " << dbDirectory << " and degree: " << degree << std::endl;
// Ensure the database directory exists
if (!fs::exists(dbDirectory)) {
Expand Down
4 changes: 0 additions & 4 deletions Storage/SstFileManager/SstFileManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ class SSTFileManager {
// Scan keys within a range across all SST files
void scan(const KeyValueWrapper& startKey, const KeyValueWrapper& endKey, std::vector<KeyValueWrapper>& result);

// set degree
void setDegree(int _degree) {degree = _degree;};
// set path
void setPath(string _path) {dbDirectory = _path;};

Expand All @@ -41,8 +39,6 @@ class SSTFileManager {
// Directory where SST files are stored
std::string dbDirectory;

// B+ tree degree
int degree;

// List of SST files (DiskBTree instances)
std::vector<std::shared_ptr<DiskBTree>> sstFiles;
Expand Down
3 changes: 2 additions & 1 deletion kv/KeyValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ std::string KeyValueWrapper::keyValueTypeToString(KeyValue::KeyValueType type) c
}

size_t KeyValueWrapper::getSerializedSize() const {
return sizeof(kv.key_case()) + sizeof(kv.value_case()) + sizeof(kv.key_type()) + sizeof(kv.value_type()) + sizeof(size_t);
// sizeof kv pair + sequence number + tombstone
return sizeof(kv.key_case()) + sizeof(kv.value_case()) + sizeof(kv.key_type()) + sizeof(kv.value_type()) + sizeof(size_t) + sizeof(uint64_t);
}


Expand Down

0 comments on commit b290653

Please sign in to comment.