kkli08 / KV-Store

Key-Value Storage Database
https://kkli08.github.io/VeloxDB/
MIT License
1 stars 0 forks source link

Update Memtable::generateSstFilename() method #41

Closed kkli08 closed 2 months ago

kkli08 commented 2 months ago

Generate names for SSTs:

string Memtable::generateSstFilename() {
    auto now = std::chrono::system_clock::now();
    auto in_time_t = std::chrono::system_clock::to_time_t(now);
    std::stringstream ss;
    ss << std::put_time(std::localtime(&in_time_t), "%Y_%m_%d_%H%M");
    return ss.str() + ".sst";
}

Design need to be refined: Generate name by the time (accurate to the minute), it may cause some unpredictable issues

kkli08 commented 2 months ago

https://github.com/kkli08/KV-Store/blob/main/memtable/Memtable.cpp#L123-L140