BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Friends | List of all members
graphene::db::object_database Class Reference

maintains a set of indexed objects that can be modified with multi-level rollback support More...

#include <object_database.hpp>

Inheritance diagram for graphene::db::object_database:
graphene::chain::database

Public Member Functions

 object_database ()
 
virtual ~object_database ()=default
 
void reset_indexes ()
 
void open (const fc::path &data_dir)
 
void flush ()
 
void wipe (const fc::path &data_dir)
 
void close ()
 
template<typename T , typename F >
const T & create (F &&constructor)
 
const objectget_object (const object_id_type &id) const
 
const objectfind_object (const object_id_type &id) const
 
template<typename T >
const T & get (const object_id_type &id) const
 
template<typename T >
const T * find (const object_id_type &id) const
 
template<uint8_t SpaceID, uint8_t TypeID>
auto find (const object_id< SpaceID, TypeID > &id) const -> const object_downcast_t< decltype(id)> *
 
template<uint8_t SpaceID, uint8_t TypeID>
auto get (const object_id< SpaceID, TypeID > &id) const -> const object_downcast_t< decltype(id)> &
 
template<typename IndexType >
IndexType * add_index ()
 
template<typename IndexType , typename SecondaryIndexType , typename... Args>
SecondaryIndexType * add_secondary_index (Args... args)
 
void pop_undo ()
 
fc::path get_data_dir () const
 
template<typename IndexType >
const IndexType & get_index_type () const
 
template<typename T >
const indexget_index () const
 
const indexget_index (uint8_t space_id, uint8_t type_id) const
 
const indexget_index (const object_id_type &id) const
 
const objectinsert (object &&obj)
 
void remove (const object &obj)
 
template<typename T , typename Lambda >
void modify (const T &obj, const Lambda &m)
 

Static Public Member Functions

template<typename T >
static const T & cast (const object &obj)
 
template<typename T >
static T & cast (object &obj)
 

Public Attributes

undo_database _undo_db
 

Static Public Attributes

static constexpr uint8_t _index_size = 255
 

Protected Member Functions

template<typename IndexType >
IndexType & get_mutable_index_type ()
 
template<typename T >
indexget_mutable_index ()
 
indexget_mutable_index (const object_id_type &id)
 
indexget_mutable_index (uint8_t space_id, uint8_t type_id)
 

Friends

class base_primary_index
 
class undo_database
 

Detailed Description

maintains a set of indexed objects that can be modified with multi-level rollback support

Definition at line 39 of file object_database.hpp.

Constructor & Destructor Documentation

◆ object_database()

graphene::db::object_database::object_database ( )

Definition at line 32 of file object_database.cpp.

◆ ~object_database()

virtual graphene::db::object_database::~object_database ( )
virtualdefault

Member Function Documentation

◆ add_index()

template<typename IndexType >
IndexType* graphene::db::object_database::add_index ( )
inline

Definition at line 144 of file object_database.hpp.

◆ add_secondary_index()

template<typename IndexType , typename SecondaryIndexType , typename... Args>
SecondaryIndexType* graphene::db::object_database::add_secondary_index ( Args...  args)
inline

Definition at line 159 of file object_database.hpp.

◆ cast() [1/2]

template<typename T >
static const T& graphene::db::object_database::cast ( const object obj)
inlinestatic

Definition at line 106 of file object_database.hpp.

◆ cast() [2/2]

template<typename T >
static T& graphene::db::object_database::cast ( object obj)
inlinestatic

Definition at line 112 of file object_database.hpp.

◆ close()

void graphene::db::object_database::close ( )

Definition at line 39 of file object_database.cpp.

◆ create()

template<typename T , typename F >
const T& graphene::db::object_database::create ( F &&  constructor)
inline

Definition at line 63 of file object_database.hpp.

◆ find() [1/2]

template<uint8_t SpaceID, uint8_t TypeID>
auto graphene::db::object_database::find ( const object_id< SpaceID, TypeID > &  id) const -> const object_downcast_t<decltype(id)>*
inline

Definition at line 134 of file object_database.hpp.

◆ find() [2/2]

template<typename T >
const T* graphene::db::object_database::find ( const object_id_type id) const
inline

Definition at line 126 of file object_database.hpp.

◆ find_object()

const object * graphene::db::object_database::find_object ( const object_id_type id) const

Definition at line 43 of file object_database.cpp.

◆ flush()

void graphene::db::object_database::flush ( )

Saves the complete state of the object_database to disk, this could take a while

Definition at line 81 of file object_database.cpp.

◆ get() [1/2]

template<uint8_t SpaceID, uint8_t TypeID>
auto graphene::db::object_database::get ( const object_id< SpaceID, TypeID > &  id) const -> const object_downcast_t<decltype(id)>&
inline

Definition at line 139 of file object_database.hpp.

◆ get() [2/2]

template<typename T >
const T& graphene::db::object_database::get ( const object_id_type id) const
inline

Definition at line 119 of file object_database.hpp.

◆ get_data_dir()

fc::path graphene::db::object_database::get_data_dir ( ) const
inline

Definition at line 167 of file object_database.hpp.

◆ get_index() [1/3]

template<typename T >
const index& graphene::db::object_database::get_index ( ) const
inline

Definition at line 83 of file object_database.hpp.

◆ get_index() [2/3]

const index& graphene::db::object_database::get_index ( const object_id_type id) const
inline

Definition at line 85 of file object_database.hpp.

◆ get_index() [3/3]

const index & graphene::db::object_database::get_index ( uint8_t  space_id,
uint8_t  type_id 
) const

Definition at line 52 of file object_database.cpp.

◆ get_index_type()

template<typename IndexType >
const IndexType& graphene::db::object_database::get_index_type ( ) const
inline

These methods are used to retrieve indexes on the object_database. All public index accessors are const-access only.

Definition at line 77 of file object_database.hpp.

◆ get_mutable_index() [1/3]

template<typename T >
index& graphene::db::object_database::get_mutable_index ( )
inlineprotected

Definition at line 179 of file object_database.hpp.

◆ get_mutable_index() [2/3]

index& graphene::db::object_database::get_mutable_index ( const object_id_type id)
inlineprotected

Definition at line 180 of file object_database.hpp.

◆ get_mutable_index() [3/3]

index & graphene::db::object_database::get_mutable_index ( uint8_t  space_id,
uint8_t  type_id 
)
protected

Definition at line 66 of file object_database.cpp.

◆ get_mutable_index_type()

template<typename IndexType >
IndexType& graphene::db::object_database::get_mutable_index_type ( )
inlineprotected

Definition at line 173 of file object_database.hpp.

◆ get_object()

const object & graphene::db::object_database::get_object ( const object_id_type id) const

Definition at line 47 of file object_database.cpp.

◆ insert()

const object& graphene::db::object_database::insert ( object &&  obj)
inline

These methods are mutators of the object_database. You must use these methods to make changes to the object_database, in order to maintain proper undo history.

Definition at line 96 of file object_database.hpp.

◆ modify()

template<typename T , typename Lambda >
void graphene::db::object_database::modify ( const T &  obj,
const Lambda &  m 
)
inline

Definition at line 99 of file object_database.hpp.

◆ open()

void graphene::db::object_database::open ( const fc::path data_dir)

Definition at line 130 of file object_database.cpp.

◆ pop_undo()

void graphene::db::object_database::pop_undo ( )

Definition at line 163 of file object_database.cpp.

◆ remove()

void graphene::db::object_database::remove ( const object obj)
inline

Definition at line 97 of file object_database.hpp.

◆ reset_indexes()

void graphene::db::object_database::reset_indexes ( )
inline

Definition at line 47 of file object_database.hpp.

◆ wipe()

void graphene::db::object_database::wipe ( const fc::path data_dir)

Definition at line 122 of file object_database.cpp.

Friends And Related Function Documentation

◆ base_primary_index

friend class base_primary_index
friend

Definition at line 185 of file object_database.hpp.

◆ undo_database

friend class undo_database
friend

Definition at line 186 of file object_database.hpp.

Member Data Documentation

◆ _index_size

constexpr uint8_t graphene::db::object_database::_index_size = 255
staticconstexpr

Definition at line 45 of file object_database.hpp.

◆ _undo_db

undo_database graphene::db::object_database::_undo_db

public for testing purposes only... should be private in practice.

Definition at line 170 of file object_database.hpp.


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