BitShares-Core  4.0.0
BitShares blockchain implementation and command-line interface software
Public Member Functions | Static Public Member Functions | 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 ()
 
 ~object_database ()
 
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 (object_id_type id) const
 
const objectfind_object (object_id_type id) const
 
template<typename T >
const T & get (object_id_type id) const
 
template<typename T >
const T * find (object_id_type id) const
 
template<uint8_t SpaceID, uint8_t TypeID>
auto find (object_id< SpaceID, TypeID > id) const -> const object_downcast_t< decltype(id)> *
 
template<uint8_t SpaceID, uint8_t TypeID>
auto get (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 (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
 

Protected Member Functions

template<typename IndexType >
IndexType & get_mutable_index_type ()
 
template<typename T >
indexget_mutable_index ()
 
indexget_mutable_index (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

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

Definition at line 32 of file object_database.cpp.

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

Definition at line 39 of file object_database.cpp.

Member Function Documentation

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

Definition at line 135 of file object_database.hpp.

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

Definition at line 147 of file object_database.hpp.

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

Definition at line 97 of file object_database.hpp.

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

Definition at line 103 of file object_database.hpp.

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

Definition at line 41 of file object_database.cpp.

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

Definition at line 57 of file object_database.hpp.

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

Definition at line 117 of file object_database.hpp.

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

Definition at line 125 of file object_database.hpp.

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

Definition at line 45 of file object_database.cpp.

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

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

Definition at line 71 of file object_database.cpp.

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

Definition at line 110 of file object_database.hpp.

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

Definition at line 130 of file object_database.hpp.

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

Definition at line 154 of file object_database.hpp.

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

Definition at line 75 of file object_database.hpp.

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

Definition at line 54 of file object_database.cpp.

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

Definition at line 77 of file object_database.hpp.

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 70 of file object_database.hpp.

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

Definition at line 165 of file object_database.hpp.

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

Definition at line 166 of file object_database.hpp.

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

Definition at line 62 of file object_database.cpp.

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

Definition at line 160 of file object_database.hpp.

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

Definition at line 49 of file object_database.cpp.

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 87 of file object_database.hpp.

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

Definition at line 90 of file object_database.hpp.

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

Definition at line 104 of file object_database.cpp.

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

Definition at line 128 of file object_database.cpp.

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

Definition at line 88 of file object_database.hpp.

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

Definition at line 45 of file object_database.hpp.

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

Definition at line 96 of file object_database.cpp.

Friends And Related Function Documentation

friend class base_primary_index
friend

Definition at line 171 of file object_database.hpp.

friend class undo_database
friend

Definition at line 172 of file object_database.hpp.

Member Data Documentation

undo_database graphene::db::object_database::_undo_db

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

Definition at line 157 of file object_database.hpp.


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