taco-db  0.1.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
taco::VolatileTree Class Reference

An in-memory tree index that is stored only in memory. More...

#include <index/volatiletree/VolatileTree.h>

Inheritance diagram for taco::VolatileTree:
taco::Index

Classes

class  Iterator
 

Public Types

using tree_type = VolatileTreeBase::tree_type
 
typedef std::decay< decltype(std::declval< VolatileTreeBase >).m_tree.begin())>::type map_iterator
 

Public Member Functions

virtual ~VolatileTree ()
 
bool InsertKey (const IndexKey *key, RecordId rid) override
 Inserts the (key, rid) pair into the index. More...
 
bool DeleteKey (const IndexKey *key, RecordId &rid) override
 Deletes an arbitrary data entry with matching key if rid is invalid. More...
 
std::unique_ptr< Index::IteratorStartScan (const IndexKey *lower, bool lower_isstrict, const IndexKey *upper, bool upper_isstrict) override
 Returns a forward-iterator for all the indexed items in the specified range defined by the arguments. More...
 
- Public Member Functions inherited from taco::Index
virtual ~Index ()
 Index object destructor. More...
 
const IndexDescGetIndexDesc () const
 Returns the index descriptor of this index. More...
 
const SchemaGetKeySchema () const
 Returns the key schema of this index. More...
 
virtual void BulkLoad (BulkLoadIterator &iter)
 Loads all the (key, record id) pairs provided by the iterator iter into an empty index. More...
 
bool InsertRecord (const Record &rec, const Schema *tabschema=nullptr)
 Inserts the (key, rid) extracted from the table record into the index. More...
 
bool DeleteRecord (Record &rec, const Schema *tabschema=nullptr)
 Deletes the (key, rid) extracted from the table record from the index. More...
 

Static Public Member Functions

static void Initialize (const IndexDesc *idxdesc)
 
static std::unique_ptr< VolatileTreeCreate (std::shared_ptr< const IndexDesc > idxdesc)
 
- Static Public Member Functions inherited from taco::Index
static void Initialize (const IndexDesc *idxdesc)
 Initializes an index described by an index descriptor. More...
 
static std::unique_ptr< IndexCreate (std::shared_ptr< const IndexDesc > idxdesc)
 Creates an index object over an index file described by the index descriptor, which has already been initialized. More...
 

Private Member Functions

 VolatileTree (std::shared_ptr< const IndexDesc > idxdesc, std::shared_ptr< VolatileTreeBase > base)
 

Private Attributes

std::shared_ptr< VolatileTreeBasem_base
 

Friends

class Iterator
 

Additional Inherited Members

- Protected Member Functions inherited from taco::Index
 Index (std::shared_ptr< const IndexDesc > idxdesc)
 

Detailed Description

An in-memory tree index that is stored only in memory.

It needs to be rebuilt on every restart.

Member Typedef Documentation

◆ map_iterator

typedef std::decay< decltype(std::declval<VolatileTreeBase>).m_tree.begin())>::type taco::VolatileTree::map_iterator

◆ tree_type

Constructor & Destructor Documentation

◆ VolatileTree()

taco::VolatileTree::VolatileTree ( std::shared_ptr< const IndexDesc idxdesc,
std::shared_ptr< VolatileTreeBase base 
)
private

◆ ~VolatileTree()

taco::VolatileTree::~VolatileTree ( )
virtual

Member Function Documentation

◆ Create()

std::unique_ptr< VolatileTree > taco::VolatileTree::Create ( std::shared_ptr< const IndexDesc idxdesc)
static

◆ DeleteKey()

bool taco::VolatileTree::DeleteKey ( const IndexKey key,
RecordId rid 
)
overridevirtual

Deletes an arbitrary data entry with matching key if rid is invalid.

Deletes the data entry with matching (key, rid) pair if rid is valid.

Returns true if the deletion succeeds. Upon successful return, update rid to the deleted indexed item's record id. Returns false if the key (if rid is invalid) or (key, rid) pair (if rid is valid) is not found in the index, in which case, rid should be set to invalid.

Implements taco::Index.

◆ Initialize()

void taco::VolatileTree::Initialize ( const IndexDesc idxdesc)
static

◆ InsertKey()

bool taco::VolatileTree::InsertKey ( const IndexKey key,
RecordId  rid 
)
overridevirtual

Inserts the (key, rid) pair into the index.

Returns true if the insertion succeeds. Returns false if the index was declared as a unique index and a duplicate key is found, or for a non-unique index, the (key, rid) pair already exists in the index.

Implements taco::Index.

◆ StartScan()

std::unique_ptr< Index::Iterator > taco::VolatileTree::StartScan ( const IndexKey lower,
bool  lower_isstrict,
const IndexKey upper,
bool  upper_isstrict 
)
overridevirtual

Returns a forward-iterator for all the indexed items in the specified range defined by the arguments.

A non-null lower defines the lower bound and the iterator should return the indexed items with keys that are >= (lower_isstrict == false), or > (lower_isstrict == true) lower. A non-null upper defines the upper bound, and the iterator should not return the indexed items whose keys are >= (upper_isstrict == true), or > (upper_isstrict = false). If lower (and/or upper) is null, there is no lower (upper resp.) bound for the returned indexed items, in which case, lower_isstrict and upper_isstrict are ignored.

lower and upper are allowed to have fewer keys than the index schema does, the comparison between the key of an indexed item and lower or upper should be done only on the prefix of lower->GetNumKeys() or upper->GetNumKeys() keys.

Not all combinations of arguments can be supported by the underlying index and it should throw an error if the underlying index cannot reasonably support that. Tree indexes (e.g., B-tree) should support range search and prefix searches, while hash indexes may just support equality searches.

Implements taco::Index.

Friends And Related Function Documentation

◆ Iterator

friend class Iterator
friend

Member Data Documentation

◆ m_base

std::shared_ptr<VolatileTreeBase> taco::VolatileTree::m_base
private

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