Blink DB Documentation v1.0.0
Blink DB Documentation
Loading...
Searching...
No Matches
SS_Table Class Reference

Represents an SSTable (Sorted String Table) used in the LSM Tree. More...

#include <sstable.hpp>

Public Member Functions

 SS_Table (const std::string &filename)
 Constructs an SS_Table from a given filename (excluding extensions).
 SS_Table (const std::string &index_filename, const std::string &data_filename)
 Constructs an SS_Table from existing index and data filenames.
bool loadIndex ()
 Loads the SSTable index from the index file.
std::pair< bool, std::string > getValue (std::string key)
 Retrieves the value associated with a key from the SSTable.
std::string getIndexFile () const
 Gets the filename of the SSTable's index file.
std::string getDataFilename () const
 Gets the filename of the SSTable's data file.

Static Public Member Functions

static bool createFromMemTable (const std::string &filename, MemTable *memTable)
 Creates an SSTable from a given MemTable.

Detailed Description

Represents an SSTable (Sorted String Table) used in the LSM Tree.

This class handles persistent storage of key-value pairs by writing data in a structured format. It provides functions for loading indexes, retrieving values, and managing SSTable files.

Constructor & Destructor Documentation

◆ SS_Table() [1/2]

SS_Table::SS_Table ( const std::string & filename)
inline

Constructs an SS_Table from a given filename (excluding extensions).

Parameters
filenameBase name for the SSTable (without extensions).

◆ SS_Table() [2/2]

SS_Table::SS_Table ( const std::string & index_filename,
const std::string & data_filename )
inline

Constructs an SS_Table from existing index and data filenames.

Parameters
index_filenamePath to the index file.
data_filenamePath to the data file.

Member Function Documentation

◆ createFromMemTable()

bool SS_Table::createFromMemTable ( const std::string & filename,
MemTable * memTable )
inlinestatic

Creates an SSTable from a given MemTable.

Parameters
filenameBase filename for the new SSTable (without extensions).
memTablePointer to the MemTable containing data.
Returns
True if creation is successful, otherwise false.

◆ getDataFilename()

std::string SS_Table::getDataFilename ( ) const
inline

Gets the filename of the SSTable's data file.

Returns
The data file's name.

◆ getIndexFile()

std::string SS_Table::getIndexFile ( ) const
inline

Gets the filename of the SSTable's index file.

Returns
The index file's name.

◆ getValue()

std::pair< bool, std::string > SS_Table::getValue ( std::string key)
inline

Retrieves the value associated with a key from the SSTable.

Parameters
keyThe key to look up.
Returns
A pair containing a boolean (indicating success) and the value.

◆ loadIndex()

bool SS_Table::loadIndex ( )
inline

Loads the SSTable index from the index file.

Returns
True if the index is successfully loaded, otherwise false.

The documentation for this class was generated from the following file: