hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
iroha::ametsuchi::RocksDbCommon Class Reference

#include "rocksdb_common.hpp"

Collaboration diagram for iroha::ametsuchi::RocksDbCommon:
Collaboration graph

Public Member Functions

 RocksDbCommon (std::shared_ptr< RocksDBContext > tx_context)
 
auto & valueBuffer ()
 Get value buffer. More...
 
auto & keyBuffer ()
 Get key buffer. More...
 
auto commit ()
 Makes commit to DB. More...
 
auto rollback ()
 Rollback all transaction changes. More...
 
auto release ()
 
auto prepare ()
 Prepare tx for 2pc. More...
 
void skip ()
 Skips all changes made in this transaction. More...
 
void savepoint ()
 Saves current state of a transaction. More...
 
auto rollbackToSavepoint ()
 Restores to the previously saved savepoint. More...
 
auto encode (uint64_t number)
 Encode number into. More...
 
auto decode (uint64_t &number)
 Decode number from. More...
 
template<typename S , typename... Args>
auto get (S const &fmtstring, Args &&... args)
 Read data from database to. More...
 
template<typename S , typename... Args>
auto put (S const &fmtstring, Args &&... args)
 Put data from. More...
 
template<typename S , typename... Args>
auto del (S const &fmtstring, Args &&... args)
 Delete database entry by the key. More...
 
template<typename S , typename... Args>
auto seek (S const &fmtstring, Args &&... args)
 Searches for the first key that matches a prefix. More...
 
template<typename F , typename S , typename... Args>
auto enumerate (std::unique_ptr< rocksdb::Iterator > &it, F &&func, S const &fmtstring, Args &&... args)
 
template<typename F , typename S , typename... Args>
auto enumerate (F &&func, S const &fmtstring, Args &&... args)
 
template<typename S , typename... Args>
auto filterDelete (S const &fmtstring, Args &&... args)
 Removes range of items by key-filter. More...
 

Detailed Description

Base functions to interact with RocksDB data.

Constructor & Destructor Documentation

◆ RocksDbCommon()

iroha::ametsuchi::RocksDbCommon::RocksDbCommon ( std::shared_ptr< RocksDBContext tx_context)
inlineexplicit

Member Function Documentation

◆ commit()

auto iroha::ametsuchi::RocksDbCommon::commit ( )
inline

Makes commit to DB.

Here is the caller graph for this function:

◆ decode()

auto iroha::ametsuchi::RocksDbCommon::decode ( uint64_t &  number)
inline

Decode number from.

See also
valueBuffer
Here is the caller graph for this function:

◆ del()

template<typename S , typename... Args>
auto iroha::ametsuchi::RocksDbCommon::del ( S const &  fmtstring,
Args &&...  args 
)
inline

Delete database entry by the key.

Here is the caller graph for this function:

◆ encode()

auto iroha::ametsuchi::RocksDbCommon::encode ( uint64_t  number)
inline

Encode number into.

See also
valueBuffer
Here is the caller graph for this function:

◆ enumerate() [1/2]

template<typename F , typename S , typename... Args>
auto iroha::ametsuchi::RocksDbCommon::enumerate ( std::unique_ptr< rocksdb::Iterator > &  it,
F &&  func,
S const &  fmtstring,
Args &&...  args 
)
inline

Iterate over all the keys begins from it, and matches a prefix and call lambda with key-value. To stop enumeration callback F must return false.

◆ enumerate() [2/2]

template<typename F , typename S , typename... Args>
auto iroha::ametsuchi::RocksDbCommon::enumerate ( F &&  func,
S const &  fmtstring,
Args &&...  args 
)
inline

Iterate over all the keys that matches a prefix and call lambda with key-value. To stop enumeration callback F must return false.

◆ filterDelete()

template<typename S , typename... Args>
auto iroha::ametsuchi::RocksDbCommon::filterDelete ( S const &  fmtstring,
Args &&...  args 
)
inline

Removes range of items by key-filter.

Here is the caller graph for this function:

◆ get()

template<typename S , typename... Args>
auto iroha::ametsuchi::RocksDbCommon::get ( S const &  fmtstring,
Args &&...  args 
)
inline

Read data from database to.

See also
valueBuffer
Here is the caller graph for this function:

◆ keyBuffer()

auto& iroha::ametsuchi::RocksDbCommon::keyBuffer ( )
inline

Get key buffer.

◆ prepare()

auto iroha::ametsuchi::RocksDbCommon::prepare ( )
inline

Prepare tx for 2pc.

Here is the caller graph for this function:

◆ put()

template<typename S , typename... Args>
auto iroha::ametsuchi::RocksDbCommon::put ( S const &  fmtstring,
Args &&...  args 
)
inline

Put data from.

See also
valueBuffer to database
Here is the caller graph for this function:

◆ release()

auto iroha::ametsuchi::RocksDbCommon::release ( )
inline
Here is the caller graph for this function:

◆ rollback()

auto iroha::ametsuchi::RocksDbCommon::rollback ( )
inline

Rollback all transaction changes.

Here is the caller graph for this function:

◆ rollbackToSavepoint()

auto iroha::ametsuchi::RocksDbCommon::rollbackToSavepoint ( )
inline

Restores to the previously saved savepoint.

Here is the caller graph for this function:

◆ savepoint()

void iroha::ametsuchi::RocksDbCommon::savepoint ( )
inline

Saves current state of a transaction.

Here is the caller graph for this function:

◆ seek()

template<typename S , typename... Args>
auto iroha::ametsuchi::RocksDbCommon::seek ( S const &  fmtstring,
Args &&...  args 
)
inline

Searches for the first key that matches a prefix.

◆ skip()

void iroha::ametsuchi::RocksDbCommon::skip ( )
inline

Skips all changes made in this transaction.

Here is the caller graph for this function:

◆ valueBuffer()

auto& iroha::ametsuchi::RocksDbCommon::valueBuffer ( )
inline

Get value buffer.

Here is the caller graph for this function:

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