#47 Adding API to get the available history buckets based upon the configuration

This commit is contained in:
Daniel Larimer 2015-06-24 12:46:03 -04:00
parent 44313ac8a4
commit af812a7b51
5 changed files with 34 additions and 23 deletions

2
docs

@ -1 +1 @@
Subproject commit 94ec061b91edbe9d1ebae576e641f921998428c8 Subproject commit 71ed2984b71d57cab13cdf12074cff150edc1d3d

View file

@ -445,7 +445,17 @@ namespace graphene { namespace app {
} }
return result; return result;
} }
vector<bucket_object> history_api::get_market_history( asset_id_type a, asset_id_type b, uint32_t bucket_seconds, fc::time_point_sec start, fc::time_point_sec end )const
flat_set<uint32_t> history_api::get_market_history_buckets()const
{
auto hist = _app.get_plugin<market_history_plugin>( "market_history" );
FC_ASSERT( hist );
return hist->tracked_buckets();
}
vector<bucket_object> history_api::get_market_history( asset_id_type a, asset_id_type b,
uint32_t bucket_seconds, fc::time_point_sec start, fc::time_point_sec end )const
{ try { { try {
FC_ASSERT(_app.chain_database()); FC_ASSERT(_app.chain_database());
const auto& db = *_app.chain_database(); const auto& db = *_app.chain_database();

View file

@ -274,7 +274,9 @@ namespace graphene { namespace app {
int limit = 100, int limit = 100,
operation_history_id_type start = operation_history_id_type())const; operation_history_id_type start = operation_history_id_type())const;
vector<bucket_object> get_market_history( asset_id_type a, asset_id_type b, uint32_t bucket_seconds, fc::time_point_sec start, fc::time_point_sec end )const; vector<bucket_object> get_market_history( asset_id_type a, asset_id_type b, uint32_t bucket_seconds,
fc::time_point_sec start, fc::time_point_sec end )const;
flat_set<uint32_t> get_market_history_buckets()const;
private: private:
application& _app; application& _app;
}; };
@ -377,7 +379,7 @@ FC_API(graphene::app::database_api,
(get_transaction_hex) (get_transaction_hex)
(get_proposed_transactions) (get_proposed_transactions)
) )
FC_API(graphene::app::history_api, (get_account_history)(get_market_history)) FC_API(graphene::app::history_api, (get_account_history)(get_market_history)(get_market_history_buckets))
FC_API(graphene::app::network_api, (broadcast_transaction)(add_node)(get_connected_peers)) FC_API(graphene::app::network_api, (broadcast_transaction)(add_node)(get_connected_peers))
FC_API(graphene::app::login_api, FC_API(graphene::app::login_api,
(login) (login)

@ -1 +1 @@
Subproject commit 701b9ac00c46234ee7cc6385027f5942590debc9 Subproject commit c09035dba0cdab7fcb2c11bf81aaeaffaa981f66

View file

@ -117,7 +117,6 @@ class market_history_plugin : public graphene::app::plugin
const boost::program_options::variables_map& options) override; const boost::program_options::variables_map& options) override;
virtual void plugin_startup() override; virtual void plugin_startup() override;
vector<bucket_object> get_history( const bucket_key& start, const bucket_key& end )const;
const flat_set<uint32_t>& tracked_buckets()const; const flat_set<uint32_t>& tracked_buckets()const;
private: private: