| souffle
    2.0.2-371-g6315b36
    | 
 
 
 
The actual implementation of a b-tree data structure.  
 More...
#include <BTree.h>
|  | 
| struct | base | 
|  | The base type of all node types containing essential book-keeping information.  More... 
 | 
|  | 
| struct | btree_operation_hints | 
|  | A collection of operation hints speeding up some of the involved operations by exploiting temporal locality.  More... 
 | 
|  | 
| struct | hint_statistics | 
|  | 
| struct | inner_node | 
|  | The data type representing inner nodes of the b-tree.  More... 
 | 
|  | 
| class | iterator | 
|  | The iterator type to be utilized for scanning through btree instances.  More... 
 | 
|  | 
| struct | leaf_node | 
|  | The data type representing leaf nodes of the b-tree.  More... 
 | 
|  | 
| struct | node | 
|  | The actual, generic node implementation covering the operations for both, inner and leaf nodes.  More... 
 | 
|  | 
|  | 
| template<typename R , typename Iter > | 
| static std::enable_if< std::is_same< typename std::iterator_traits< Iter >::iterator_category, std::random_access_iterator_tag >::value, R >::type | load (const Iter &a, const Iter &b) | 
|  | A static member enabling the bulk-load of ordered data into an empty tree.  More... 
 | 
|  | 
|  | 
|  | btree (size_type, node *root, leaf_node *leftmost) | 
|  | An internal constructor enabling the specific creation of a tree based on internal parameters.  More... 
 | 
|  | 
| bool | covers (const node *node, const Key &k) const | 
|  | Determines whether the range covered by the given node is also covering the given key value.  More... 
 | 
|  | 
| bool | equal (const Key &a, const Key &b) const | 
|  | 
| bool | less (const Key &a, const Key &b) const | 
|  | 
| void | update (Key &old_k, const Key &new_k) | 
|  | 
| bool | weak_covers (const node *node, const Key &k) const | 
|  | Determines whether the range covered by the given node is also covering the given key value.  More... 
 | 
|  | 
| bool | weak_equal (const Key &a, const Key &b) const | 
|  | 
| bool | weak_less (const Key &a, const Key &b) const | 
|  | 
|  | 
| const static SearchStrategy | search | 
|  | 
template<typename Key, typename Comparator, typename Allocator, unsigned blockSize, typename SearchStrategy, bool isSet, typename WeakComparator = Comparator, typename Updater = detail::updater<Key>>
class souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >
The actual implementation of a b-tree data structure. 
- Template Parameters
- 
  
    | Key | .. the element type to be stored in this tree |  | Comparator | .. a class defining an order on the stored elements |  | Allocator | .. utilized for allocating memory for required nodes |  | blockSize | .. determines the number of bytes/block utilized by leaf nodes |  | SearchStrategy | .. enables switching between linear, binary or any other search strategy |  | isSet | .. true = set, false = multiset |  
 
Definition at line 265 of file BTree.h.
◆ chunk
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
      
 
 
◆ const_iterator
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
      
 
 
◆ element_type
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
      
 
 
◆ field_index_type
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
◆ key_type
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
      
 
 
◆ lock_type
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
◆ operation_hints
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
      
 
 
◆ size_type
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
◆ btree() [1/5]
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
◆ btree() [2/5]
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
template<typename Iter > 
 
 
◆ btree() [3/5]
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
  
  | 
        
          | souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::btree | ( | btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater > && | other | ) |  |  | inline | 
 
 
◆ btree() [4/5]
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
  
  | 
        
          | souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::btree | ( | const btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater > & | set | ) |  |  | inline | 
 
 
◆ btree() [5/5]
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
An internal constructor enabling the specific creation of a tree based on internal parameters. 
Definition at line 1305 of file BTree.h.
 
 
◆ ~btree()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
◆ begin()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
◆ buildSubTree()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
template<typename Iter > 
 
Definition at line 2169 of file BTree.h.
 2180             step = ((length - numKeys) / (numKeys + 1));
 
 2184         node* res = 
new inner_node();
 
 2185         res->numElements = numKeys;
 
 2188         for (
int i = 0; 
i < numKeys; 
i++) {
 
 2190             res->keys[
i] = c[step];
 
 2194             child->parent = res;
 
 2195             child->position = 
i;
 
 2196             res->getChildren()[
i] = child;
 
 2203         child->parent = res;
 
 2204         child->position = numKeys;
 
 2205         res->getChildren()[numKeys] = child;
 
 2213 template <
typename Key, 
typename Comparator, 
typename Allocator, 
unsigned blockSize, 
typename SearchStrategy,
 
 2214         bool isSet, 
typename WeakComparator, 
typename Updater>
 
 2215 const SearchStrategy
 
 
Referenced by souffle::detail::btree< Key, detail::comparator< Key >, std::allocator< Key >, blockSize, typename detail::default_strategy< Key >::type, isSet, detail::comparator< Key >, detail::updater< Key > >::check().
 
 
◆ check()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Checks the consistency of this tree. 
Definition at line 2089 of file BTree.h.
 
 
◆ clear()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Clears this tree. 
Definition at line 1948 of file BTree.h.
 1953         std::swap(
root, other.root);
 
 1954         std::swap(
leftmost, other.leftmost);
 
 
Referenced by souffle::detail::btree< Key, detail::comparator< Key >, std::allocator< Key >, blockSize, typename detail::default_strategy< Key >::type, isSet, detail::comparator< Key >, detail::updater< Key > >::btree(), and souffle::SparseDisjointSet< value_type >::size().
 
 
◆ contains() [1/2]
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Determines whether the given element is a member of this tree. 
Definition at line 1756 of file BTree.h.
Referenced by souffle::SparseDisjointSet< value_type >::makeNode(), souffle::detail::btree< Key, detail::comparator< Key >, std::allocator< Key >, blockSize, typename detail::default_strategy< Key >::type, isSet, detail::comparator< Key >, detail::updater< Key > >::operator==(), and souffle::detail::btree< Key, detail::comparator< Key >, std::allocator< Key >, blockSize, typename detail::default_strategy< Key >::type, isSet, detail::comparator< Key >, detail::updater< Key > >::partition().
 
 
◆ contains() [2/2]
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Determines whether the given element is a member of this tree. 
Definition at line 1764 of file BTree.h.
 
 
◆ covers()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Determines whether the range covered by the given node is also covering the given key value. 
Definition at line 2133 of file BTree.h.
 2135             return !node->isEmpty() && !
weak_less(
k, node->keys[0]) &&
 
 2136                    !
weak_less(node->keys[node->numElements - 1], 
k);
 
 2139         return !node->isEmpty() && 
weak_less(node->keys[0], 
k) &&
 
 2140                weak_less(
k, node->keys[node->numElements - 1]);
 
 
Referenced by souffle::detail::btree< Key, detail::comparator< Key >, std::allocator< Key >, blockSize, typename detail::default_strategy< Key >::type, isSet, detail::comparator< Key >, detail::updater< Key > >::find(), and souffle::detail::btree< Key, detail::comparator< Key >, std::allocator< Key >, blockSize, typename detail::default_strategy< Key >::type, isSet, detail::comparator< Key >, detail::updater< Key > >::lower_bound().
 
 
◆ coversUpperBound()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
◆ empty()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
◆ end()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Definition at line 1729 of file BTree.h.
Referenced by souffle::EquivalenceRelation< Arity >::anteriorIt(), souffle::detail::btree< Key, detail::comparator< Key >, std::allocator< Key >, blockSize, typename detail::default_strategy< Key >::type, isSet, detail::comparator< Key >, detail::updater< Key > >::contains(), souffle::EquivalenceRelation< Arity >::size(), and souffle::EquivalenceRelation< Arity >::upper_bound().
 
 
◆ equal()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
  
  | 
        
          | bool souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::equal | ( | const Key & | a, |  
          |  |  | const Key & | b |  
          |  | ) |  | const |  | inlineprotected | 
 
 
◆ find() [1/2]
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Locates the given key within this tree and returns an iterator referencing its position. 
If not found, an end-iterator will be returned. 
Definition at line 1772 of file BTree.h.
 1775             if (!last_find_end) 
return false;
 
 
Referenced by souffle::EquivalenceRelation< Arity >::anteriorIt(), souffle::EquivalenceRelation< Arity >::antpostit(), souffle::detail::btree< Key, detail::comparator< Key >, std::allocator< Key >, blockSize, typename detail::default_strategy< Key >::type, isSet, detail::comparator< Key >, detail::updater< Key > >::contains(), and souffle::EquivalenceRelation< Arity >::upper_bound().
 
 
◆ find() [2/2]
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Locates the given key within this tree and returns an iterator referencing its position. 
If not found, an end-iterator will be returned. 
Definition at line 1781 of file BTree.h.
 1793             auto a = &(cur->keys[0]);
 
 1794             auto b = &(cur->keys[cur->numElements]);
 
 1798             if (pos < 
b && 
equal(*pos, 
k)) {
 
 1799                 hints.last_find_end.access(cur);
 
 1804                 hints.last_find_end.access(cur);
 
 1809             cur = cur->getChild(pos - a);
 
 
 
 
◆ getChunks()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
◆ getDepth()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
◆ getMemoryUsage()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
◆ getNumNodes()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
◆ insert() [1/3]
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
template<typename Iter > 
 
Inserts the given range of elements into this tree. 
Definition at line 1713 of file BTree.h.
 
 
◆ insert() [2/3]
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Inserts the given key into this tree. 
Definition at line 1328 of file BTree.h.
Referenced by souffle::btree_multiset< Key, Comparator, Allocator, blockSize, SearchStrategy, WeakComparator, Updater >::btree_multiset(), souffle::btree_set< Key, Comparator, Allocator, blockSize, SearchStrategy, WeakComparator, Updater >::btree_set(), and souffle::test::TEST().
 
 
◆ insert() [3/3]
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Inserts the given key into this tree. 
Definition at line 1336 of file BTree.h.
 1363             if (!last_insert) 
return false;
 
 1365             auto hint_lease = last_insert->lock.start_read();
 
 1369             if (!last_insert->lock.validate(hint_lease)) 
return false;
 
 1373             cur_lease = hint_lease;
 
 1378         if (hints.last_insert.any(checkHint)) {
 
 1396                 cur_lease = cur->lock.start_read();
 
 1409                 auto a = &(cur->keys[0]);
 
 1410                 auto b = &(cur->keys[cur->numElements]);
 
 1418                     if (!cur->lock.validate(cur_lease)) {
 
 1425                         if (!cur->lock.try_upgrade_to_write(cur_lease)) {
 
 1430                         cur->lock.end_write();
 
 1439                 auto next = cur->getChild(idx);
 
 1442                 auto next_lease = next->lock.start_read();
 
 1445                 if (!cur->lock.end_read(cur_lease)) {
 
 1454                 cur_lease = next_lease;
 
 1460             assert(!cur->inner);
 
 1464             auto a = &(cur->keys[0]);
 
 1465             auto b = &(cur->keys[cur->numElements]);
 
 1471             if (isSet && pos != a && 
weak_equal(*(pos - 1), 
k)) {
 
 1473                 if (!cur->lock.validate(cur_lease)) {
 
 1479                 if (
typeid(
Comparator) != 
typeid(WeakComparator) && 
less(
k, *(pos - 1))) {
 
 1480                     if (!cur->lock.try_upgrade_to_write(cur_lease)) {
 
 1485                     cur->lock.end_write();
 
 1494             if (!cur->lock.try_upgrade_to_write(cur_lease)) {
 
 1496                 hints.last_insert.access(cur);
 
 1503                 auto parent = priv->parent;
 
 1504                 std::vector<node*> parents;
 
 1507                         parent->lock.start_write();
 
 1510                             if (parent == priv->parent) {
 
 1514                             parent->lock.abort_write();
 
 1515                             parent = priv->parent;
 
 1516                             parent->lock.start_write();
 
 1524                     parents.push_back(parent);
 
 1527                     if (!parent || !parent->isFull()) {
 
 1533                     parent = parent->parent;
 
 1538                 auto old_root = 
root;
 
 1542                 for (
auto it = parents.rbegin(); it != parents.rend(); ++it) {
 
 1547                         parent->lock.end_write();
 
 1549                         if (old_root != 
root) {
 
 1558                 if (((
size_type)idx) > cur->numElements) {
 
 1560                     cur->lock.end_write();
 
 1568             assert(cur->numElements < 
node::maxKeys && 
"Split required!");
 
 1571             for (
int j = cur->numElements; 
j > idx; --
j) {
 
 1572                 cur->keys[
j] = cur->keys[
j - 1];
 
 1580             cur->lock.end_write();
 
 1583             hints.last_insert.access(cur);
 
 1596             hints.last_insert.access(
leftmost);
 
 1604         auto checkHints = [&](node* last_insert) {
 
 1605             if (!last_insert) 
return false;
 
 1612         if (hints.last_insert.any(checkHints)) {
 
 1621                 auto a = &(cur->keys[0]);
 
 1622                 auto b = &(cur->keys[cur->numElements]);
 
 1638                 cur = cur->getChild(idx);
 
 1643             assert(!cur->inner);
 
 1647             auto a = &(cur->keys[0]);
 
 1648             auto b = &(cur->keys[cur->numElements]);
 
 1654             if (isSet && pos != a && 
weak_equal(*(pos - 1), 
k)) {
 
 1656                 if (
typeid(
Comparator) != 
typeid(WeakComparator) && 
less(
k, *(pos - 1))) {
 
 1666                 idx -= cur->rebalance_or_split(&
root, 
root_lock, 
static_cast<int>(idx));
 
 1669                 if (((
size_type)idx) > cur->numElements) {
 
 1670                     idx -= cur->numElements + 1;
 
 1671                     cur = cur->parent->getChild(cur->position + 1);
 
 1676             assert(cur->numElements < 
node::maxKeys && 
"Split required!");
 
 1679             for (
int j = 
static_cast<int>(cur->numElements); 
j > idx; --
j) {
 
 1680                 cur->keys[
j] = cur->keys[
j - 1];
 
 1688             hints.last_insert.access(cur);
 
 1698     template <
typename Iter>
 
 1699     void insert(
const Iter& a, 
const Iter& 
b) {
 
 1703         for (
auto it = a; it != 
b; ++it) {
 
 
 
 
◆ less()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
  
  | 
        
          | bool souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::less | ( | const Key & | a, |  
          |  |  | const Key & | b |  
          |  | ) |  | const |  | inlineprotected | 
 
 
◆ load()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
template<typename R , typename Iter > 
  
  | 
        
          | static std::enable_if<std::is_same<typename std::iterator_traits<Iter>::iterator_category, std::random_access_iterator_tag>::value, R>::type souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::load | ( | const Iter & | a, |  
          |  |  | const Iter & | b |  
          |  | ) |  |  |  | inlinestatic | 
 
A static member enabling the bulk-load of ordered data into an empty tree. 
This function is much more efficient in creating a index over an ordered set of elements than an iterative insertion of values.
- Template Parameters
- 
  
    | Iter | .. the type of iterator specifying the range it must be a random-access iterator |  
 
Definition at line 2109 of file BTree.h.
 2119     bool covers(
const node* node, 
const Key& 
k)
 const {
 
 2122             return !node->isEmpty() && !
less(
k, node->keys[0]) && !
less(node->keys[node->numElements - 1], 
k);
 
 2125         return !node->isEmpty() && 
less(node->keys[0], 
k) && 
less(
k, node->keys[node->numElements - 1]);
 
 
 
 
◆ lower_bound() [1/2]
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Obtains a lower boundary for the given key – hence an iterator referencing the smallest value that is not less the given key. 
If there is no such element, an end-iterator will be returned. 
Definition at line 1832 of file BTree.h.
 
 
◆ lower_bound() [2/2]
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Obtains a lower boundary for the given key – hence an iterator referencing the smallest value that is not less the given key. 
If there is no such element, an end-iterator will be returned. 
Definition at line 1842 of file BTree.h.
 1849         iterator res = 
end();
 
 1851             auto a = &(cur->keys[0]);
 
 1852             auto b = &(cur->keys[cur->numElements]);
 
 1858                 hints.last_lower_bound_end.access(cur);
 
 1859                 return (pos != 
b) ? iterator(cur, idx) : res;
 
 1862             if (isSet && pos != 
b && 
equal(*pos, 
k)) {
 
 1863                 return iterator(cur, idx);
 
 1867                 res = iterator(cur, idx);
 
 1870             cur = cur->getChild(idx);
 
 
 
 
◆ operator!=()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
  
  | 
        
          | bool souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::operator!= | ( | const btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater > & | other | ) | const |  | inline | 
 
 
◆ operator=()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
  
  | 
        
          | btree& souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::operator= | ( | const btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater > & | other | ) |  |  | inline | 
 
Definition at line 1972 of file BTree.h.
 1976             tmp = tmp->getChild(0);
 
 1978         leftmost = 
static_cast<leaf_node*
>(tmp);
 
 1987         if (
this == &other) {
 
 1992         if (
size() != other.size()) {
 
 1995         if (
size() < other.size()) {
 
 1996             return other == *
this;
 
 
 
 
◆ operator==()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
  
  | 
        
          | bool souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::operator== | ( | const btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater > & | other | ) | const |  | inline | 
 
Definition at line 1999 of file BTree.h.
 2010         return !(*
this == other);
 
 
 
 
◆ partition()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Partitions the full range of this set into up to a given number of chunks. 
The chunks will cover approximately the same number of elements. Also, the number of chunks will only approximate the desired number of chunks.
- Parameters
- 
  
    | num | .. the number of chunks requested |  
 
- Returns
- a list of chunks partitioning this tree 
Definition at line 1741 of file BTree.h.
 
 
◆ printStats()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
  
  | 
        
          | void souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::printStats | ( | std::ostream & | out = std::cout | ) | const |  | inline | 
 
Prints a textual summary of statistical properties of this tree to the given output stream (for debugging and tuning). 
Definition at line 2061 of file BTree.h.
 2061                                                  : 
" << hint_stats.inserts.getHits() << "/
" 
 2062             << hint_stats.inserts.getMisses() << "/
" << hint_stats.inserts.getAccesses() << "\n"; 
 2063         out << "  contains-hint(hits/misses/total):
" << hint_stats.contains.getHits() << "/
" 
 2064             << hint_stats.contains.getMisses() << "/
" << hint_stats.contains.getAccesses() << "\
n"; 
 2065         out << "  lower-bound-hint (hits/misses/total):
" << hint_stats.lower_bound.getHits() << "/
" 
 2066             << hint_stats.lower_bound.getMisses() << "/
" << hint_stats.lower_bound.getAccesses() << "\
n"; 
 2067         out << "  upper-bound-hint (hits/misses/total):
" << hint_stats.upper_bound.getHits() << "/
" 
 2068             << hint_stats.upper_bound.getMisses() << "/
" << hint_stats.upper_bound.getAccesses() << "\
n"; 
 2069         out << " ---------------------------------\
n"; 
 2076         auto ok = empty() || root->check(comp, root);
 
 
 
◆ printTree()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
  
  | 
        
          | void souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::printTree | ( | std::ostream & | out = std::cout | ) | const |  | inline | 
 
Definition at line 2048 of file BTree.h.
 2050                           : 
" << size() << "\n"; 
 2051         out << "  Depth:    
" << (empty() ? 0 : root->getDepth()) << "\n"; 
 2052         out << "  Nodes:    
" << nodes << "\n"; 
 2053         out << " ---------------------------------
\n"; 
 2054         out << "  Size of inner node: 
" << sizeof(inner_node) << "\n"; 
 2055         out << "  Size of leaf node:  
" << sizeof(leaf_node) << "\n"; 
 
 
◆ size()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
◆ swap()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
  
  | 
        
          | void souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::swap | ( | btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater > & | other | ) |  |  | inline | 
 
Swaps the content of this tree with the given tree. 
This is a much more efficient operation than creating a copy and realizing the swap utilizing assignment operations. 
Definition at line 1965 of file BTree.h.
 
 
◆ update()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
◆ upper_bound() [1/2]
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Obtains an upper boundary for the given key – hence an iterator referencing the first element that the given key is less than the referenced value. 
If there is no such element, an end-iterator will be returned. 
Definition at line 1893 of file BTree.h.
 
 
◆ upper_bound() [2/2]
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Obtains an upper boundary for the given key – hence an iterator referencing the first element that the given key is less than the referenced value. 
If there is no such element, an end-iterator will be returned. 
Definition at line 1903 of file BTree.h.
 1910         iterator res = 
end();
 
 1912             auto a = &(cur->keys[0]);
 
 1913             auto b = &(cur->keys[cur->numElements]);
 
 1919                 hints.last_upper_bound_end.access(cur);
 
 1920                 return (pos != 
b) ? iterator(cur, idx) : res;
 
 1924                 res = iterator(cur, idx);
 
 1927             cur = cur->getChild(idx);
 
 1935         if (
root != 
nullptr) {
 
 1937                 delete static_cast<leaf_node*
>(
root);
 
 1939                 delete static_cast<inner_node*
>(
root);
 
 
 
 
◆ weak_covers()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Determines whether the range covered by the given node is also covering the given key value. 
Definition at line 2146 of file BTree.h.
 2150         return !node->isEmpty() && !
less(
k, node->keys[0]) && 
less(
k, node->keys[node->numElements - 1]);
 
 2154     template <
typename Iter>
 
 
 
 
◆ weak_equal()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
  
  | 
        
          | bool souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::weak_equal | ( | const Key & | a, |  
          |  |  | const Key & | b |  
          |  | ) |  | const |  | inlineprotected | 
 
 
◆ weak_less()
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
  
  | 
        
          | bool souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::weak_less | ( | const Key & | a, |  
          |  |  | const Key & | b |  
          |  | ) |  | const |  | inlineprotected | 
 
 
◆ comp
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
◆ hint_stats
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Definition at line 1269 of file BTree.h.
Referenced by souffle::detail::btree< Key, detail::comparator< Key >, std::allocator< Key >, blockSize, typename detail::default_strategy< Key >::type, isSet, detail::comparator< Key >, detail::updater< Key > >::find(), souffle::detail::btree< Key, detail::comparator< Key >, std::allocator< Key >, blockSize, typename detail::default_strategy< Key >::type, isSet, detail::comparator< Key >, detail::updater< Key > >::lower_bound(), and souffle::detail::btree< Key, detail::comparator< Key >, std::allocator< Key >, blockSize, typename detail::default_strategy< Key >::type, isSet, detail::comparator< Key >, detail::updater< Key > >::upper_bound().
 
 
◆ leftmost
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Definition at line 1249 of file BTree.h.
Referenced by souffle::detail::btree< Key, detail::comparator< Key >, std::allocator< Key >, blockSize, typename detail::default_strategy< Key >::type, isSet, detail::comparator< Key >, detail::updater< Key > >::check(), and souffle::detail::btree< Key, detail::comparator< Key >, std::allocator< Key >, blockSize, typename detail::default_strategy< Key >::type, isSet, detail::comparator< Key >, detail::updater< Key > >::clear().
 
 
◆ max_keys_per_node
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
◆ root
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
Definition at line 1242 of file BTree.h.
Referenced by souffle::detail::btree< Key, detail::comparator< Key >, std::allocator< Key >, blockSize, typename detail::default_strategy< Key >::type, isSet, detail::comparator< Key >, detail::updater< Key > >::btree(), souffle::detail::btree< Key, detail::comparator< Key >, std::allocator< Key >, blockSize, typename detail::default_strategy< Key >::type, isSet, detail::comparator< Key >, detail::updater< Key > >::check(), souffle::detail::btree< Key, detail::comparator< Key >, std::allocator< Key >, blockSize, typename detail::default_strategy< Key >::type, isSet, detail::comparator< Key >, detail::updater< Key > >::clear(), souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::node::rebalance_or_split(), and souffle::detail::btree< Key, detail::comparator< Key >, std::allocator< Key >, blockSize, typename detail::default_strategy< Key >::type, isSet, detail::comparator< Key >, detail::updater< Key > >::size().
 
 
◆ root_lock
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
◆ search
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator , typename Updater > 
 
 
◆ upd
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
◆ weak_comp
template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator  = Comparator, typename Updater  = detail::updater<Key>> 
 
 
The documentation for this class was generated from the following file:
- include/souffle/datastructure/BTree.h
 
bool weak_less(const Key &a, const Key &b) const
const static SearchStrategy search
int rebalance_or_split(node **root, lock_type &root_lock, int idx)
Moves keys from this node to one of its siblings or splits this node to make some space for the inser...
void clear()
Clears this tree.
void update(Key &old_k, const Key &new_k)
CacheAccessCounter upper_bound
bool equal(const Key &a, const Key &b) const
btree(Comparator comp=Comparator(), WeakComparator weak_comp=WeakComparator())
bool less(const Key &a, const Key &b) const
bool operator!=(const btree &other) const
bool operator==(const btree &other) const
MinIndexSelection::SearchSet Nodes
bool insert(const Key &k)
Inserts the given key into this tree.
bool weak_equal(const Key &a, const Key &b) const
static node * buildSubTree(const Iter &a, const Iter &b)
bool weak_covers(const node *node, const Key &k) const
Determines whether the range covered by the given node is also covering the given key value.
CacheAccessCounter inserts
hint_statistics hint_stats
size_type getDepth() const
Computes the number of nested levels of the tree rooted by this node.
iterator find(const Key &k) const
Locates the given key within this tree and returns an iterator referencing its position.
bool covers(const node *node, const Key &k) const
Determines whether the range covered by the given node is also covering the given key value.
size_type getDepth() const
l j a showGridBackground &&c b raw series this eventEmitter b
btree & operator=(const btree &other)
bool end_read(const Lease &)
iterator upper_bound(const Key &k) const
Obtains an upper boundary for the given key – hence an iterator referencing the first element that th...
bool contains(const Key &k) const
Determines whether the given element is a member of this tree.
CacheAccessCounter contains
iterator lower_bound(const Key &k) const
Obtains a lower boundary for the given key – hence an iterator referencing the smallest value that is...
btree_operation_hints< 1 > operation_hints
CacheAccessCounter lower_bound
static constexpr size_t maxKeys
The actual number of keys/node corrected by functional requirements.