Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
lmdb_store.test.cpp File Reference
#include <cstddef>
#include <cstdint>
#include <gtest/gtest.h>
#include <chrono>
#include <cstdlib>
#include <filesystem>
#include <memory>
#include <optional>
#include <sstream>
#include <stdexcept>
#include <thread>
#include <vector>
#include "barretenberg/common/serialize.hpp"
#include "barretenberg/common/streams.hpp"
#include "barretenberg/common/test.hpp"
#include "barretenberg/lmdblib/fixtures.hpp"
#include "barretenberg/lmdblib/lmdb_cursor.hpp"
#include "barretenberg/lmdblib/lmdb_database.hpp"
#include "barretenberg/lmdblib/lmdb_db_transaction.hpp"
#include "barretenberg/lmdblib/lmdb_environment.hpp"
#include "barretenberg/lmdblib/lmdb_read_transaction.hpp"
#include "barretenberg/lmdblib/lmdb_store.hpp"
#include "barretenberg/lmdblib/lmdb_write_transaction.hpp"
#include "barretenberg/lmdblib/queries.hpp"
#include "barretenberg/lmdblib/types.hpp"

Go to the source code of this file.

Classes

class  LMDBStoreTest
 

Functions

LMDBStore::Ptr create_store (uint32_t maxNumDbs=1)
 
void prepare_test_data (int64_t numKeys, int64_t numValues, KeyDupValuesVector &testData, int64_t keyOffset=0)
 
void write_test_data (std::vector< std::string > dbNames, int64_t numKeys, int64_t numValues, LMDBStore &store, int64_t keyOffset=0)
 
 TEST_F (LMDBStoreTest, can_create_store)
 
 TEST_F (LMDBStoreTest, can_create_database)
 
 TEST_F (LMDBStoreTest, can_not_create_more_databases_then_specified)
 
 TEST_F (LMDBStoreTest, can_write_to_database)
 
 TEST_F (LMDBStoreTest, can_not_write_to_database_that_does_not_exist)
 
 TEST_F (LMDBStoreTest, can_close_database)
 
 TEST_F (LMDBStoreTest, can_write_duplicate_keys_to_database)
 
 TEST_F (LMDBStoreTest, can_write_the_same_data_multiple_times)
 
 TEST_F (LMDBStoreTest, can_read_from_database)
 
 TEST_F (LMDBStoreTest, can_not_read_from_non_existent_database)
 
 TEST_F (LMDBStoreTest, can_write_and_read_multiple)
 
 TEST_F (LMDBStoreTest, can_write_and_read_multiple_duplicates)
 
 TEST_F (LMDBStoreTest, can_read_missing_keys_from_database)
 
 TEST_F (LMDBStoreTest, can_write_and_delete)
 
 TEST_F (LMDBStoreTest, can_write_and_delete_duplicates)
 
 TEST_F (LMDBStoreTest, can_delete_all_values_from_keys)
 
 TEST_F (LMDBStoreTest, can_read_forwards_with_cursors)
 
 TEST_F (LMDBStoreTest, can_read_duplicate_values_forwards_with_cursors)
 
 TEST_F (LMDBStoreTest, can_read_backwards_with_cursors)
 
 TEST_F (LMDBStoreTest, can_read_duplicate_values_backwards_with_cursors)
 
 TEST_F (LMDBStoreTest, can_read_past_the_end_with_cursors)
 
 TEST_F (LMDBStoreTest, can_read_past_the_start_with_cursors)
 
 TEST_F (LMDBStoreTest, can_read_duplicates_past_the_end_with_cursors)
 
 TEST_F (LMDBStoreTest, can_read_duplicates_past_the_start_with_cursors)
 
 TEST_F (LMDBStoreTest, can_read_in_both_directions_with_cursors)
 
 TEST_F (LMDBStoreTest, can_count_in_both_directions_with_cursors)
 
 TEST_F (LMDBStoreTest, can_count_in_both_directions_with_cursors_with_holes)
 
 TEST_F (LMDBStoreTest, can_count_past_end_in_both_directions_with_cursors)
 
 TEST_F (LMDBStoreTest, can_count_duplicates_in_both_directions_with_cursors)
 
 TEST_F (LMDBStoreTest, can_count_duplicates_past_end_in_both_directions_with_cursors)
 
 TEST_F (LMDBStoreTest, can_use_multiple_cursors_with_same_tx)
 
 TEST_F (LMDBStoreTest, can_write_and_delete_many_times)
 
 TEST_F (LMDBStoreTest, reports_stats)
 
 TEST_F (LMDBStoreTest, can_read_data_from_multiple_threads)
 

Function Documentation

◆ create_store()

LMDBStore::Ptr create_store ( uint32_t  maxNumDbs = 1)

Definition at line 53 of file lmdb_store.test.cpp.

◆ prepare_test_data()

void prepare_test_data ( int64_t  numKeys,
int64_t  numValues,
KeyDupValuesVector testData,
int64_t  keyOffset = 0 
)

Definition at line 59 of file lmdb_store.test.cpp.

◆ TEST_F() [1/34]

TEST_F ( LMDBStoreTest  ,
can_close_database   
)

Definition at line 140 of file lmdb_store.test.cpp.

◆ TEST_F() [2/34]

TEST_F ( LMDBStoreTest  ,
can_count_duplicates_in_both_directions_with_cursors   
)

Definition at line 1092 of file lmdb_store.test.cpp.

◆ TEST_F() [3/34]

TEST_F ( LMDBStoreTest  ,
can_count_duplicates_past_end_in_both_directions_with_cursors   
)

Definition at line 1157 of file lmdb_store.test.cpp.

◆ TEST_F() [4/34]

TEST_F ( LMDBStoreTest  ,
can_count_in_both_directions_with_cursors   
)

Definition at line 919 of file lmdb_store.test.cpp.

◆ TEST_F() [5/34]

TEST_F ( LMDBStoreTest  ,
can_count_in_both_directions_with_cursors_with_holes   
)

Definition at line 984 of file lmdb_store.test.cpp.

◆ TEST_F() [6/34]

TEST_F ( LMDBStoreTest  ,
can_count_past_end_in_both_directions_with_cursors   
)

Definition at line 1027 of file lmdb_store.test.cpp.

◆ TEST_F() [7/34]

TEST_F ( LMDBStoreTest  ,
can_create_database   
)

Definition at line 92 of file lmdb_store.test.cpp.

◆ TEST_F() [8/34]

TEST_F ( LMDBStoreTest  ,
can_create_store   
)

Definition at line 87 of file lmdb_store.test.cpp.

◆ TEST_F() [9/34]

TEST_F ( LMDBStoreTest  ,
can_delete_all_values_from_keys   
)

Definition at line 500 of file lmdb_store.test.cpp.

◆ TEST_F() [10/34]

TEST_F ( LMDBStoreTest  ,
can_not_create_more_databases_then_specified   
)

Definition at line 99 of file lmdb_store.test.cpp.

◆ TEST_F() [11/34]

TEST_F ( LMDBStoreTest  ,
can_not_read_from_non_existent_database   
)

Definition at line 235 of file lmdb_store.test.cpp.

◆ TEST_F() [12/34]

TEST_F ( LMDBStoreTest  ,
can_not_write_to_database_that_does_not_exist   
)

Definition at line 125 of file lmdb_store.test.cpp.

◆ TEST_F() [13/34]

TEST_F ( LMDBStoreTest  ,
can_read_backwards_with_cursors   
)

Definition at line 653 of file lmdb_store.test.cpp.

◆ TEST_F() [14/34]

TEST_F ( LMDBStoreTest  ,
can_read_data_from_multiple_threads   
)

Definition at line 1328 of file lmdb_store.test.cpp.

◆ TEST_F() [15/34]

TEST_F ( LMDBStoreTest  ,
can_read_duplicate_values_backwards_with_cursors   
)

Definition at line 688 of file lmdb_store.test.cpp.

◆ TEST_F() [16/34]

TEST_F ( LMDBStoreTest  ,
can_read_duplicate_values_forwards_with_cursors   
)

Definition at line 613 of file lmdb_store.test.cpp.

◆ TEST_F() [17/34]

TEST_F ( LMDBStoreTest  ,
can_read_duplicates_past_the_end_with_cursors   
)

Definition at line 798 of file lmdb_store.test.cpp.

◆ TEST_F() [18/34]

TEST_F ( LMDBStoreTest  ,
can_read_duplicates_past_the_start_with_cursors   
)

Definition at line 838 of file lmdb_store.test.cpp.

◆ TEST_F() [19/34]

TEST_F ( LMDBStoreTest  ,
can_read_forwards_with_cursors   
)

Definition at line 578 of file lmdb_store.test.cpp.

◆ TEST_F() [20/34]

TEST_F ( LMDBStoreTest  ,
can_read_from_database   
)

Definition at line 213 of file lmdb_store.test.cpp.

◆ TEST_F() [21/34]

TEST_F ( LMDBStoreTest  ,
can_read_in_both_directions_with_cursors   
)

Definition at line 878 of file lmdb_store.test.cpp.

◆ TEST_F() [22/34]

TEST_F ( LMDBStoreTest  ,
can_read_missing_keys_from_database   
)

Definition at line 343 of file lmdb_store.test.cpp.

◆ TEST_F() [23/34]

TEST_F ( LMDBStoreTest  ,
can_read_past_the_end_with_cursors   
)

Definition at line 728 of file lmdb_store.test.cpp.

◆ TEST_F() [24/34]

TEST_F ( LMDBStoreTest  ,
can_read_past_the_start_with_cursors   
)

Definition at line 763 of file lmdb_store.test.cpp.

◆ TEST_F() [25/34]

TEST_F ( LMDBStoreTest  ,
can_use_multiple_cursors_with_same_tx   
)

Definition at line 1221 of file lmdb_store.test.cpp.

◆ TEST_F() [26/34]

TEST_F ( LMDBStoreTest  ,
can_write_and_delete   
)

Definition at line 369 of file lmdb_store.test.cpp.

◆ TEST_F() [27/34]

TEST_F ( LMDBStoreTest  ,
can_write_and_delete_duplicates   
)

Definition at line 425 of file lmdb_store.test.cpp.

◆ TEST_F() [28/34]

TEST_F ( LMDBStoreTest  ,
can_write_and_delete_many_times   
)

Definition at line 1262 of file lmdb_store.test.cpp.

◆ TEST_F() [29/34]

TEST_F ( LMDBStoreTest  ,
can_write_and_read_multiple   
)

Definition at line 254 of file lmdb_store.test.cpp.

◆ TEST_F() [30/34]

TEST_F ( LMDBStoreTest  ,
can_write_and_read_multiple_duplicates   
)

Definition at line 294 of file lmdb_store.test.cpp.

◆ TEST_F() [31/34]

TEST_F ( LMDBStoreTest  ,
can_write_duplicate_keys_to_database   
)

Definition at line 165 of file lmdb_store.test.cpp.

◆ TEST_F() [32/34]

TEST_F ( LMDBStoreTest  ,
can_write_the_same_data_multiple_times   
)

Definition at line 187 of file lmdb_store.test.cpp.

◆ TEST_F() [33/34]

TEST_F ( LMDBStoreTest  ,
can_write_to_database   
)

Definition at line 110 of file lmdb_store.test.cpp.

◆ TEST_F() [34/34]

TEST_F ( LMDBStoreTest  ,
reports_stats   
)

Definition at line 1294 of file lmdb_store.test.cpp.

◆ write_test_data()

void write_test_data ( std::vector< std::string >  dbNames,
int64_t  numKeys,
int64_t  numValues,
LMDBStore store,
int64_t  keyOffset = 0 
)

Definition at line 74 of file lmdb_store.test.cpp.