DECENT
Public Member Functions | Public Attributes | List of all members
graphene::app::database_api_impl Class Reference
Inheritance diagram for graphene::app::database_api_impl:

Public Member Functions

 database_api_impl (graphene::chain::database &db)
 
 ~database_api_impl ()
 
fc::variants get_objects (const vector< object_id_type > &ids) const
 
void set_subscribe_callback (std::function< void(const variant &)> cb, bool clear_filter)
 
void set_content_update_callback (const string &URI, std::function< void()> cb)
 
void set_pending_transaction_callback (std::function< void(const variant &)> cb)
 
void set_block_applied_callback (std::function< void(const variant &block_id)> cb)
 
void cancel_all_subscriptions ()
 
optional< block_headerget_block_header (uint32_t block_num) const
 
optional< signed_blockget_block (uint32_t block_num) const
 
processed_transaction get_transaction (uint32_t block_num, uint32_t trx_in_block) const
 
fc::time_point_sec head_block_time () const
 
miner_reward_input get_time_to_maint_by_block_time (fc::time_point_sec block_time) const
 
share_type get_miner_pay_from_fees_by_block_time (fc::time_point_sec block_time) const
 
optional< signed_transactionget_transaction_by_id (const transaction_id_type &id) const
 
chain_property_object get_chain_properties () const
 
global_property_object get_global_properties () const
 
fc::variant_object get_config () const
 
chain_id_type get_chain_id () const
 
dynamic_global_property_object get_dynamic_global_properties () const
 
vector< vector< account_id_type > > get_key_references (vector< public_key_type > key) const
 
vector< optional< account_object > > get_accounts (const vector< account_id_type > &account_ids) const
 
std::map< string, full_accountget_full_accounts (const vector< string > &names_or_ids, bool subscribe)
 
optional< account_objectget_account_by_name (string name) const
 
vector< account_id_typeget_account_references (account_id_type account_id) const
 
vector< optional< account_object > > lookup_account_names (const vector< string > &account_names) const
 
map< string, account_id_typelookup_accounts (const string &lower_bound_name, uint32_t limit) const
 
vector< account_objectsearch_accounts (const string &search_term, const string order, const object_id_type &id, uint32_t limit) const
 
vector< transaction_detail_objectsearch_account_history (account_id_type const &account, string const &order, object_id_type const &id, int limit) const
 
uint64_t get_account_count () const
 
vector< assetget_account_balances (account_id_type id, const flat_set< asset_id_type > &assets) const
 
vector< assetget_named_account_balances (const std::string &name, const flat_set< asset_id_type > &assets) const
 
vector< vesting_balance_objectget_vesting_balances (account_id_type account_id) const
 
uint64_t get_asset_count () const
 
vector< optional< asset_object > > get_assets (const vector< asset_id_type > &asset_ids) const
 
vector< asset_objectlist_assets (const string &lower_bound_symbol, uint32_t limit) const
 
vector< optional< asset_object > > lookup_asset_symbols (const vector< string > &symbols_or_ids) const
 
share_type get_new_asset_per_block () const
 
share_type get_asset_per_block_by_block_num (uint32_t block_num) const
 
asset price_to_dct (asset price) const
 
vector< optional< miner_object > > get_miners (const vector< miner_id_type > &miner_ids) const
 
fc::optional< miner_objectget_miner_by_account (account_id_type account) const
 
map< string, miner_id_typelookup_miner_accounts (const string &lower_bound_name, uint32_t limit) const
 
uint64_t get_miner_count () const
 
multimap< time_point_sec, price_feedget_feeds_by_miner (const account_id_type account_id, uint32_t count) const
 
vector< variant > lookup_vote_ids (const vector< vote_id_type > &votes) const
 
vector< miner_voting_infosearch_miner_voting (const string &account_id, const string &term, bool only_my_votes, const string &order, const string &id, uint32_t count) const
 
std::string get_transaction_hex (const signed_transaction &trx) const
 
set< public_key_typeget_required_signatures (const signed_transaction &trx, const flat_set< public_key_type > &available_keys) const
 
set< public_key_typeget_potential_signatures (const signed_transaction &trx) const
 
bool verify_authority (const signed_transaction &trx) const
 
bool verify_account_authority (const string &name_or_id, const flat_set< public_key_type > &signers) const
 
processed_transaction validate_transaction (const signed_transaction &trx) const
 
fc::variants get_required_fees (vector< operation > ops, asset_id_type id) const
 
vector< proposal_objectget_proposed_transactions (account_id_type id) const
 
vector< operation_infolist_operations () const
 
vector< account_id_typelist_publishing_managers (const string &lower_bound_name, uint32_t limit) const
 
vector< buying_objectget_open_buyings () const
 
vector< buying_objectget_open_buyings_by_URI (const string &URI) const
 
vector< buying_objectget_open_buyings_by_consumer (const account_id_type &consumer) const
 
optional< buying_objectget_buying_by_consumer_URI (const account_id_type &consumer, const string &URI) const
 
vector< buying_objectget_buying_history_objects_by_consumer (const account_id_type &consumer) const
 
vector< buying_objectget_buying_objects_by_consumer (const account_id_type &consumer, const string &order, const object_id_type &id, const string &term, uint32_t count) const
 
vector< buying_objectsearch_feedback (const string &user, const string &URI, const object_id_type &id, uint32_t count) const
 
optional< content_objectget_content (const string &URI) const
 
vector< content_summarysearch_content (const string &term, const string &order, const string &user, const string &region_code, const object_id_type &id, const string &type, uint32_t count) const
 
vector< seeder_objectlist_seeders_by_price (const uint32_t count) const
 
optional< seeder_objectget_seeder (account_id_type) const
 
optional< vector< seeder_object > > list_seeders_by_upload (const uint32_t count) const
 
vector< seeder_objectlist_seeders_by_region (const string region_code) const
 
vector< seeder_objectlist_seeders_by_rating (const uint32_t count) const
 
vector< subscription_objectlist_active_subscriptions_by_consumer (const account_id_type &account, const uint32_t count) const
 
vector< subscription_objectlist_subscriptions_by_consumer (const account_id_type &account, const uint32_t count) const
 
vector< subscription_objectlist_active_subscriptions_by_author (const account_id_type &account, const uint32_t count) const
 
vector< subscription_objectlist_subscriptions_by_author (const account_id_type &account, const uint32_t count) const
 
optional< subscription_objectget_subscription (const subscription_id_type &sid) const
 
template<typename T >
void subscribe_to_item (const T &i) const
 
template<typename T >
bool is_subscribed_to_item (const T &i) const
 
void broadcast_updates (const vector< variant > &updates)
 
void on_objects_changed (const vector< object_id_type > &ids)
 
void on_objects_removed (const vector< const object * > &objs)
 
void on_applied_block ()
 

Public Attributes

fc::bloom_filter _subscribe_filter
 
std::function< void(const fc::variant &)> _subscribe_callback
 
std::function< void(const fc::variant &)> _pending_trx_callback
 
std::function< void(const fc::variant &)> _block_applied_callback
 
boost::signals2::scoped_connection _change_connection
 
boost::signals2::scoped_connection _removed_connection
 
boost::signals2::scoped_connection _applied_block_connection
 
boost::signals2::scoped_connection _pending_trx_connection
 
map< string, std::function< void()> > _content_subscriptions
 
graphene::chain::database_db
 

Detailed Description

Definition at line 67 of file database_api.cpp.

Constructor & Destructor Documentation

graphene::app::database_api_impl::database_api_impl ( graphene::chain::database db)

Definition at line 245 of file database_api.cpp.

graphene::app::database_api_impl::~database_api_impl ( )

Definition at line 261 of file database_api.cpp.

Member Function Documentation

void graphene::app::database_api_impl::broadcast_updates ( const vector< variant > &  updates)

Definition at line 2506 of file database_api.cpp.

void graphene::app::database_api_impl::cancel_all_subscriptions ( )

Definition at line 368 of file database_api.cpp.

vector< asset > graphene::app::database_api_impl::get_account_balances ( account_id_type  id,
const flat_set< asset_id_type > &  assets 
) const

Definition at line 947 of file database_api.cpp.

optional< account_object > graphene::app::database_api_impl::get_account_by_name ( string  name) const

Definition at line 674 of file database_api.cpp.

uint64_t graphene::app::database_api_impl::get_account_count ( ) const

Definition at line 931 of file database_api.cpp.

vector< account_id_type > graphene::app::database_api_impl::get_account_references ( account_id_type  account_id) const

Definition at line 688 of file database_api.cpp.

vector< optional< account_object > > graphene::app::database_api_impl::get_accounts ( const vector< account_id_type > &  account_ids) const

Definition at line 573 of file database_api.cpp.

uint64_t graphene::app::database_api_impl::get_asset_count ( ) const

Definition at line 1013 of file database_api.cpp.

share_type graphene::app::database_api_impl::get_asset_per_block_by_block_num ( uint32_t  block_num) const

Definition at line 2612 of file database_api.cpp.

vector< optional< asset_object > > graphene::app::database_api_impl::get_assets ( const vector< asset_id_type > &  asset_ids) const

Definition at line 1023 of file database_api.cpp.

optional< signed_block > graphene::app::database_api_impl::get_block ( uint32_t  block_num) const

Definition at line 397 of file database_api.cpp.

optional< block_header > graphene::app::database_api_impl::get_block_header ( uint32_t  block_num) const

Definition at line 384 of file database_api.cpp.

optional< buying_object > graphene::app::database_api_impl::get_buying_by_consumer_URI ( const account_id_type consumer,
const string &  URI 
) const

Definition at line 2032 of file database_api.cpp.

vector< buying_object > graphene::app::database_api_impl::get_buying_history_objects_by_consumer ( const account_id_type consumer) const

Definition at line 1764 of file database_api.cpp.

vector< buying_object > graphene::app::database_api_impl::get_buying_objects_by_consumer ( const account_id_type consumer,
const string &  order,
const object_id_type &  id,
const string &  term,
uint32_t  count 
) const

Definition at line 1839 of file database_api.cpp.

chain_id_type graphene::app::database_api_impl::get_chain_id ( ) const

Definition at line 503 of file database_api.cpp.

chain_property_object graphene::app::database_api_impl::get_chain_properties ( ) const

Definition at line 473 of file database_api.cpp.

fc::variant_object graphene::app::database_api_impl::get_config ( ) const

Definition at line 493 of file database_api.cpp.

optional< content_object > graphene::app::database_api_impl::get_content ( const string &  URI) const

Definition at line 1950 of file database_api.cpp.

dynamic_global_property_object graphene::app::database_api_impl::get_dynamic_global_properties ( ) const

Definition at line 513 of file database_api.cpp.

multimap< time_point_sec, price_feed > graphene::app::database_api_impl::get_feeds_by_miner ( const account_id_type  account_id,
uint32_t  count 
) const

Definition at line 1175 of file database_api.cpp.

std::map< std::string, full_account > graphene::app::database_api_impl::get_full_accounts ( const vector< string > &  names_or_ids,
bool  subscribe 
)

Definition at line 593 of file database_api.cpp.

global_property_object graphene::app::database_api_impl::get_global_properties ( ) const

Definition at line 483 of file database_api.cpp.

vector< vector< account_id_type > > graphene::app::database_api_impl::get_key_references ( vector< public_key_type keys) const
Returns
all accounts that refer to the key or account id in their owner or active authorities.

Definition at line 532 of file database_api.cpp.

fc::optional< miner_object > graphene::app::database_api_impl::get_miner_by_account ( account_id_type  account) const

Definition at line 1123 of file database_api.cpp.

uint64_t graphene::app::database_api_impl::get_miner_count ( ) const

Definition at line 1165 of file database_api.cpp.

share_type graphene::app::database_api_impl::get_miner_pay_from_fees_by_block_time ( fc::time_point_sec  block_time) const

Definition at line 2457 of file database_api.cpp.

vector< optional< miner_object > > graphene::app::database_api_impl::get_miners ( const vector< miner_id_type > &  miner_ids) const

Definition at line 1106 of file database_api.cpp.

vector< asset > graphene::app::database_api_impl::get_named_account_balances ( const std::string &  name,
const flat_set< asset_id_type > &  assets 
) const

Definition at line 974 of file database_api.cpp.

share_type graphene::app::database_api_impl::get_new_asset_per_block ( ) const

Definition at line 2602 of file database_api.cpp.

fc::variants graphene::app::database_api_impl::get_objects ( const vector< object_id_type > &  ids) const

Definition at line 277 of file database_api.cpp.

vector< buying_object > graphene::app::database_api_impl::get_open_buyings ( ) const

Definition at line 1702 of file database_api.cpp.

vector< buying_object > graphene::app::database_api_impl::get_open_buyings_by_consumer ( const account_id_type consumer) const

Definition at line 1741 of file database_api.cpp.

vector< buying_object > graphene::app::database_api_impl::get_open_buyings_by_URI ( const string &  URI) const

Definition at line 1720 of file database_api.cpp.

set< public_key_type > graphene::app::database_api_impl::get_potential_signatures ( const signed_transaction trx) const

Definition at line 1383 of file database_api.cpp.

vector< proposal_object > graphene::app::database_api_impl::get_proposed_transactions ( account_id_type  id) const

TODO: add secondary index that will accelerate this process

Definition at line 1581 of file database_api.cpp.

fc::variants graphene::app::database_api_impl::get_required_fees ( vector< operation ops,
asset_id_type  id 
) const

Definition at line 1546 of file database_api.cpp.

set< public_key_type > graphene::app::database_api_impl::get_required_signatures ( const signed_transaction trx,
const flat_set< public_key_type > &  available_keys 
) const

Definition at line 1366 of file database_api.cpp.

optional< seeder_object > graphene::app::database_api_impl::get_seeder ( account_id_type  aid) const

Definition at line 2046 of file database_api.cpp.

optional< subscription_object > graphene::app::database_api_impl::get_subscription ( const subscription_id_type sid) const

Definition at line 2060 of file database_api.cpp.

miner_reward_input graphene::app::database_api_impl::get_time_to_maint_by_block_time ( fc::time_point_sec  block_time) const

Definition at line 2434 of file database_api.cpp.

processed_transaction graphene::app::database_api_impl::get_transaction ( uint32_t  block_num,
uint32_t  trx_in_block 
) const

Definition at line 421 of file database_api.cpp.

optional< signed_transaction > graphene::app::database_api_impl::get_transaction_by_id ( const transaction_id_type id) const

Definition at line 439 of file database_api.cpp.

std::string graphene::app::database_api_impl::get_transaction_hex ( const signed_transaction trx) const

Definition at line 1356 of file database_api.cpp.

vector< vesting_balance_object > graphene::app::database_api_impl::get_vesting_balances ( account_id_type  account_id) const

Definition at line 987 of file database_api.cpp.

fc::time_point_sec graphene::app::database_api_impl::head_block_time ( ) const

Definition at line 429 of file database_api.cpp.

template<typename T >
bool graphene::app::database_api_impl::is_subscribed_to_item ( const T &  i) const
inline

Definition at line 206 of file database_api.cpp.

vector< subscription_object > graphene::app::database_api_impl::list_active_subscriptions_by_author ( const account_id_type account,
const uint32_t  count 
) const

Definition at line 2122 of file database_api.cpp.

vector< subscription_object > graphene::app::database_api_impl::list_active_subscriptions_by_consumer ( const account_id_type account,
const uint32_t  count 
) const

Definition at line 2074 of file database_api.cpp.

vector< asset_object > graphene::app::database_api_impl::list_assets ( const string &  lower_bound_symbol,
uint32_t  limit 
) const

Definition at line 1043 of file database_api.cpp.

vector< operation_info > graphene::app::database_api_impl::list_operations ( ) const

Definition at line 1613 of file database_api.cpp.

vector< account_id_type > graphene::app::database_api_impl::list_publishing_managers ( const string &  lower_bound_name,
uint32_t  limit 
) const

Definition at line 1683 of file database_api.cpp.

vector< seeder_object > graphene::app::database_api_impl::list_seeders_by_price ( const uint32_t  count) const

Definition at line 2337 of file database_api.cpp.

vector< seeder_object > graphene::app::database_api_impl::list_seeders_by_rating ( const uint32_t  count) const

Definition at line 2412 of file database_api.cpp.

vector< seeder_object > graphene::app::database_api_impl::list_seeders_by_region ( const string  region_code) const

Definition at line 2389 of file database_api.cpp.

optional< vector< seeder_object > > graphene::app::database_api_impl::list_seeders_by_upload ( const uint32_t  count) const

Definition at line 2364 of file database_api.cpp.

vector< subscription_object > graphene::app::database_api_impl::list_subscriptions_by_author ( const account_id_type account,
const uint32_t  count 
) const

Definition at line 2146 of file database_api.cpp.

vector< subscription_object > graphene::app::database_api_impl::list_subscriptions_by_consumer ( const account_id_type account,
const uint32_t  count 
) const

Definition at line 2096 of file database_api.cpp.

vector< optional< account_object > > graphene::app::database_api_impl::lookup_account_names ( const vector< string > &  account_names) const

Definition at line 709 of file database_api.cpp.

map< string, account_id_type > graphene::app::database_api_impl::lookup_accounts ( const string &  lower_bound_name,
uint32_t  limit 
) const

Definition at line 908 of file database_api.cpp.

vector< optional< asset_object > > graphene::app::database_api_impl::lookup_asset_symbols ( const vector< string > &  symbols_or_ids) const

Definition at line 1066 of file database_api.cpp.

map< string, miner_id_type > graphene::app::database_api_impl::lookup_miner_accounts ( const string &  lower_bound_name,
uint32_t  limit 
) const

Definition at line 1137 of file database_api.cpp.

vector< variant > graphene::app::database_api_impl::lookup_vote_ids ( const vector< vote_id_type > &  votes) const

Definition at line 1208 of file database_api.cpp.

void graphene::app::database_api_impl::on_applied_block ( )

note: this method cannot yield because it is called in the middle of apply a block.

Definition at line 2585 of file database_api.cpp.

void graphene::app::database_api_impl::on_objects_changed ( const vector< object_id_type > &  ids)

called every time a block is applied to report the objects that were changed

pushing the future back / popping the prior future if it is complete. if a connection hangs then this could get backed up and result in a failure to exit cleanly.

Definition at line 2531 of file database_api.cpp.

void graphene::app::database_api_impl::on_objects_removed ( const vector< const object * > &  objs)

we need to ensure the database_api is not deleted for the life of the async operation

Definition at line 2516 of file database_api.cpp.

asset graphene::app::database_api_impl::price_to_dct ( asset  price) const

Definition at line 1089 of file database_api.cpp.

vector< transaction_detail_object > graphene::app::database_api_impl::search_account_history ( account_id_type const &  account,
string const &  order,
object_id_type const &  id,
int  limit 
) const

Definition at line 869 of file database_api.cpp.

vector< account_object > graphene::app::database_api_impl::search_accounts ( const string &  search_term,
const string  order,
const object_id_type &  id,
uint32_t  limit 
) const

Definition at line 819 of file database_api.cpp.

vector< content_summary > graphene::app::database_api_impl::search_content ( const string &  term,
const string &  order,
const string &  user,
const string &  region_code,
const object_id_type &  id,
const string &  type,
uint32_t  count 
) const

Definition at line 2286 of file database_api.cpp.

vector< buying_object > graphene::app::database_api_impl::search_feedback ( const string &  user,
const string &  URI,
const object_id_type &  id,
uint32_t  count 
) const

Definition at line 1996 of file database_api.cpp.

vector< miner_voting_info > graphene::app::database_api_impl::search_miner_voting ( const string &  account_id,
const string &  term,
bool  only_my_votes,
const string &  order,
const string &  id,
uint32_t  count 
) const

Definition at line 1246 of file database_api.cpp.

void graphene::app::database_api_impl::set_block_applied_callback ( std::function< void(const variant &block_id)>  cb)

Definition at line 358 of file database_api.cpp.

void graphene::app::database_api_impl::set_content_update_callback ( const string &  URI,
std::function< void()>  cb 
)

Definition at line 338 of file database_api.cpp.

void graphene::app::database_api_impl::set_pending_transaction_callback ( std::function< void(const variant &)>  cb)

Definition at line 348 of file database_api.cpp.

void graphene::app::database_api_impl::set_subscribe_callback ( std::function< void(const variant &)>  cb,
bool  clear_filter 
)

Definition at line 317 of file database_api.cpp.

template<typename T >
void graphene::app::database_api_impl::subscribe_to_item ( const T &  i) const
inline

Definition at line 192 of file database_api.cpp.

processed_transaction graphene::app::database_api_impl::validate_transaction ( const signed_transaction trx) const

Definition at line 1480 of file database_api.cpp.

bool graphene::app::database_api_impl::verify_account_authority ( const string &  name_or_id,
const flat_set< public_key_type > &  signers 
) const

reuse trx.verify_authority by creating a dummy transfer

Definition at line 1439 of file database_api.cpp.

bool graphene::app::database_api_impl::verify_authority ( const signed_transaction trx) const

Definition at line 1416 of file database_api.cpp.

Member Data Documentation

boost::signals2::scoped_connection graphene::app::database_api_impl::_applied_block_connection

Definition at line 228 of file database_api.cpp.

std::function<void(const fc::variant&)> graphene::app::database_api_impl::_block_applied_callback

Definition at line 224 of file database_api.cpp.

boost::signals2::scoped_connection graphene::app::database_api_impl::_change_connection

Definition at line 226 of file database_api.cpp.

map< string, std::function<void()> > graphene::app::database_api_impl::_content_subscriptions

Definition at line 230 of file database_api.cpp.

graphene::chain::database& graphene::app::database_api_impl::_db

Definition at line 231 of file database_api.cpp.

std::function<void(const fc::variant&)> graphene::app::database_api_impl::_pending_trx_callback

Definition at line 223 of file database_api.cpp.

boost::signals2::scoped_connection graphene::app::database_api_impl::_pending_trx_connection

Definition at line 229 of file database_api.cpp.

boost::signals2::scoped_connection graphene::app::database_api_impl::_removed_connection

Definition at line 227 of file database_api.cpp.

std::function<void(const fc::variant&)> graphene::app::database_api_impl::_subscribe_callback

Definition at line 222 of file database_api.cpp.

fc::bloom_filter graphene::app::database_api_impl::_subscribe_filter
mutable

Definition at line 221 of file database_api.cpp.


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