Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::lmdblib::LMDBStore Class Reference

#include <lmdb_store.hpp>

Inheritance diagram for bb::lmdblib::LMDBStore:
bb::lmdblib::LMDBStoreBase

Classes

struct  PutData
 

Public Types

using Ptr = std::unique_ptr< LMDBStore >
 
using SharedPtr = std::shared_ptr< LMDBStore >
 
using WriteTransaction = LMDBWriteTransaction
 
using ReadTransaction = LMDBReadTransaction
 
using Database = LMDBDatabase
 
using Cursor = LMDBCursor
 
- Public Types inherited from bb::lmdblib::LMDBStoreBase
using ReadTransaction = LMDBReadTransaction
 
using WriteTransaction = LMDBWriteTransaction
 
using DBCreationTransaction = LMDBDatabaseCreationTransaction
 

Public Member Functions

 LMDBStore (std::string directory, uint64_t mapSizeKb, uint64_t maxNumReaders, uint64_t maxDbs)
 
 LMDBStore (const LMDBStore &other)=delete
 
 LMDBStore (LMDBStore &&other)=delete
 
LMDBStoreoperator= (const LMDBStore &other)=delete
 
LMDBStoreoperator= (LMDBStore &&other)=delete
 
 ~LMDBStore () override=default
 
void open_database (const std::string &name, bool duplicateKeysPermitted=false)
 
void close_database (const std::string &name)
 
void put (std::vector< PutData > &data)
 
void get (KeysVector &keys, OptionalValuesVector &values, const std::string &name)
 
Cursor::Ptr create_cursor (ReadTransaction::SharedPtr tx, const std::string &dbName)
 
std::pair< uint64_t, uint64_tget_stats (std::vector< DBStats > &stats) const
 
- Public Member Functions inherited from bb::lmdblib::LMDBStoreBase
 LMDBStoreBase (std::string directory, uint64_t mapSizeKb, uint64_t maxNumReaders, uint64_t maxDbs)
 
 LMDBStoreBase (const LMDBStoreBase &other)=delete
 
LMDBStoreBaseoperator= (const LMDBStoreBase &other)=delete
 
 LMDBStoreBase (LMDBStoreBase &&other) noexcept=default
 
LMDBStoreBaseoperator= (LMDBStoreBase &&other) noexcept=default
 
virtual ~LMDBStoreBase ()=0
 
ReadTransaction::Ptr create_read_transaction () const
 
ReadTransaction::SharedPtr create_shared_read_transaction () const
 
WriteTransaction::Ptr create_write_transaction () const
 
LMDBDatabaseCreationTransaction::Ptr create_db_transaction () const
 
void copy_store (const std::string &dstPath, bool compact)
 

Private Member Functions

void put (KeyDupValuesVector &toWrite, KeyOptionalValuesVector &toDelete, const LMDBDatabase &db, LMDBWriteTransaction &tx)
 
void get (KeysVector &keys, OptionalValuesVector &values, LMDBDatabase::SharedPtr db)
 
Database::SharedPtr get_database (const std::string &name)
 
std::vector< Database::SharedPtrget_databases () const
 
std::vector< Database::SharedPtrget_databases (const std::vector< PutData > &puts) const
 

Private Attributes

std::mutex databasesMutex
 
std::unordered_map< std::string, LMDBDatabase::SharedPtrdatabases
 

Additional Inherited Members

- Protected Attributes inherited from bb::lmdblib::LMDBStoreBase
std::string _dbDirectory
 
LMDBEnvironment::SharedPtr _environment
 

Detailed Description

Implements a basic lmdb store. Consisting of an environment, any number of databases, transactions and cursors

Definition at line 23 of file lmdb_store.hpp.

Member Typedef Documentation

◆ Cursor

◆ Database

◆ Ptr

Definition at line 25 of file lmdb_store.hpp.

◆ ReadTransaction

◆ SharedPtr

Definition at line 26 of file lmdb_store.hpp.

◆ WriteTransaction

Constructor & Destructor Documentation

◆ LMDBStore() [1/3]

bb::lmdblib::LMDBStore::LMDBStore ( std::string  directory,
uint64_t  mapSizeKb,
uint64_t  maxNumReaders,
uint64_t  maxDbs 
)

Definition at line 15 of file lmdb_store.cpp.

◆ LMDBStore() [2/3]

bb::lmdblib::LMDBStore::LMDBStore ( const LMDBStore other)
delete

◆ LMDBStore() [3/3]

bb::lmdblib::LMDBStore::LMDBStore ( LMDBStore &&  other)
delete

◆ ~LMDBStore()

bb::lmdblib::LMDBStore::~LMDBStore ( )
overridedefault

Member Function Documentation

◆ close_database()

void bb::lmdblib::LMDBStore::close_database ( const std::string &  name)

Definition at line 37 of file lmdb_store.cpp.

◆ create_cursor()

LMDBStore::Cursor::Ptr bb::lmdblib::LMDBStore::create_cursor ( ReadTransaction::SharedPtr  tx,
const std::string &  dbName 
)

Definition at line 179 of file lmdb_store.cpp.

◆ get() [1/2]

void bb::lmdblib::LMDBStore::get ( KeysVector keys,
OptionalValuesVector values,
const std::string &  name 
)

Definition at line 112 of file lmdb_store.cpp.

◆ get() [2/2]

void bb::lmdblib::LMDBStore::get ( KeysVector keys,
OptionalValuesVector values,
LMDBDatabase::SharedPtr  db 
)
private

Definition at line 137 of file lmdb_store.cpp.

◆ get_database()

LMDBStore::Database::SharedPtr bb::lmdblib::LMDBStore::get_database ( const std::string &  name)
private

Definition at line 51 of file lmdb_store.cpp.

◆ get_databases() [1/2]

std::vector< LMDBStore::Database::SharedPtr > bb::lmdblib::LMDBStore::get_databases ( ) const
private

Definition at line 61 of file lmdb_store.cpp.

◆ get_databases() [2/2]

std::vector< LMDBStore::Database::SharedPtr > bb::lmdblib::LMDBStore::get_databases ( const std::vector< PutData > &  puts) const
private

Definition at line 72 of file lmdb_store.cpp.

◆ get_stats()

std::pair< uint64_t, uint64_t > bb::lmdblib::LMDBStore::get_stats ( std::vector< DBStats > &  stats) const

Definition at line 87 of file lmdb_store.cpp.

◆ open_database()

void bb::lmdblib::LMDBStore::open_database ( const std::string &  name,
bool  duplicateKeysPermitted = false 
)

Definition at line 19 of file lmdb_store.cpp.

◆ operator=() [1/2]

◆ operator=() [2/2]

◆ put() [1/2]

void bb::lmdblib::LMDBStore::put ( KeyDupValuesVector toWrite,
KeyOptionalValuesVector toDelete,
const LMDBDatabase db,
LMDBWriteTransaction tx 
)
private

Definition at line 117 of file lmdb_store.cpp.

◆ put() [2/2]

void bb::lmdblib::LMDBStore::put ( std::vector< PutData > &  data)

Definition at line 97 of file lmdb_store.cpp.

Member Data Documentation

◆ databases

std::unordered_map<std::string, LMDBDatabase::SharedPtr> bb::lmdblib::LMDBStore::databases
private

Definition at line 58 of file lmdb_store.hpp.

◆ databasesMutex

std::mutex bb::lmdblib::LMDBStore::databasesMutex
mutableprivate

Definition at line 57 of file lmdb_store.hpp.


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