UC-Riverside-DatabaseLab / leveldb-LazyIndex

leveldb_standalone_secondary-index with lazy updates: A key-value store on top of leveldb supporting stand alone secondary indexing with lazy updates in the database. It also supports range queries on secondary index.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

leveldb_standalone_secondary-index with lazy updates: A key-value store on top of leveldb supporting stand alone secondary indexing with lazy updates in the database.
Authors: Mohiuddin Abdul Qader (mabdu002@cs.ucr.edu)
leveldb version: 1.14.0

The code under this directory implements a system for maintaining a
persistent key/value store with stand alone index support for secondary attribute with lazy updates and implements a lookup interface for query on secondary attribute returning most recent k records. 


The Public APIs:

1. static Status Open(const Options& options, const std::string& name, DB** dbptr);

This API creates/open a database. The new addition to original leveldb option is that primary attribute and secondary attribute name has to be set in database options. options.using_s_index has to be set to true and options.isSecondaryDB has to be set to false.
Options{
 bool using_s_index;
 std::string primary_key;
 std::string secondary_key;
 bool isSecondaryDB;
}

2. Status Put(const WriteOptions& o, const Slice& val);

This API writes a record in database. It will parse the the primary key and secondary key from the val argument by checking primary and secondary attribute that has been set when the database was created.


3. Status Delete(const WriteOptions& options, const Slice& key);

This API deletes a record from database with the specified primary key. This is same as original leveldb Delete API.


4. Status Get(const ReadOptions& options, const Slice& key, std::string* value);

This API reads a record from database with the specified primary key. This is same as original leveldb Get API.


5. virtual Status Get(const ReadOptions& options, const Slice& skey, std::vector<SKeyReturnVal>* value, int kNoOfOutputs);

This API is the new LOOKUP procedure which takes a secondary key and ReadOptions as input argument. A new field in ReadOptions (num_records) has been added which has to be set to the number of K outputs that has to be  returned. This API then returns the most recent top-K a record from database containing the specified secondary key.


The return value KeyValuePair contains key and value of the resulting records.

struct KeyValuePair {
  std::string key;
  std::string value;
}

6. virtual Status RangeLookUp(const ReadOptions& options, const Slice& startSkey, const Slice& endSkey,
                   std::vector<RangeKeyValuePair>* value);
                   
This API is the new Range LOOKUP procedure which takes a secondary start key and end key and ReadOptions as input argument. A new field in ReadOptions (num_records) has been added which has to be set to the number of K outputs that has to be  returned. This API then returns the most recent top-K a record from database containing the specified secondary key range.
                   

The return value KeyValuePair contains key and value of the resulting records.

struct RangeKeyValuePair {
  std::string key;
  std::string value;
  uint64_t sequence_number; 
}



Implementation Details:


See doc/index.html for more explanation on original leveldb.
See doc/impl.html for a brief overview of the implementation of original leveldb.
See doc/Header files.txt for the guide to header files.

About

leveldb_standalone_secondary-index with lazy updates: A key-value store on top of leveldb supporting stand alone secondary indexing with lazy updates in the database. It also supports range queries on secondary index.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:C++ 95.6%Language:C 2.7%Language:Makefile 0.9%Language:Shell 0.8%