Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::db_size_api_plugin Class Reference

#include <db_size_api_plugin.hpp>

Inheritance diagram for sysio::db_size_api_plugin:
Collaboration diagram for sysio::db_size_api_plugin:

Public Member Functions

 APPBASE_PLUGIN_REQUIRES ((http_plugin)(chain_plugin)) db_size_api_plugin()=default
 
 db_size_api_plugin (const db_size_api_plugin &)=delete
 
 db_size_api_plugin (db_size_api_plugin &&)=delete
 
db_size_api_pluginoperator= (const db_size_api_plugin &)=delete
 
db_size_api_pluginoperator= (db_size_api_plugin &&)=delete
 
virtual ~db_size_api_plugin () override=default
 
virtual void set_program_options (options_description &cli, options_description &cfg) override
 
void plugin_initialize (const variables_map &vm)
 
void plugin_startup ()
 
void plugin_shutdown ()
 
db_size_stats get ()
 
- Public Member Functions inherited from appbase::plugin< db_size_api_plugin >
 plugin ()
 
virtual ~plugin ()
 
virtual state get_state () const override
 
virtual const std::string & name () const override
 
virtual void register_dependencies ()
 
virtual void initialize (const variables_map &options) override
 
virtual void handle_sighup () override
 
virtual void startup () override
 
virtual void shutdown () override
 
- Public Member Functions inherited from appbase::abstract_plugin
virtual ~abstract_plugin ()
 

Additional Inherited Members

- Public Types inherited from appbase::abstract_plugin
enum  state { registered , initialized , started , stopped }
 
- Protected Member Functions inherited from appbase::plugin< db_size_api_plugin >
 plugin (const string &name)
 

Detailed Description

Definition at line 24 of file db_size_api_plugin.hpp.

Constructor & Destructor Documentation

◆ db_size_api_plugin() [1/2]

sysio::db_size_api_plugin::db_size_api_plugin ( const db_size_api_plugin & )
delete

◆ db_size_api_plugin() [2/2]

sysio::db_size_api_plugin::db_size_api_plugin ( db_size_api_plugin && )
delete

◆ ~db_size_api_plugin()

virtual sysio::db_size_api_plugin::~db_size_api_plugin ( )
overridevirtualdefault

Member Function Documentation

◆ APPBASE_PLUGIN_REQUIRES()

sysio::db_size_api_plugin::APPBASE_PLUGIN_REQUIRES ( (http_plugin)(chain_plugin) )
default

◆ get()

db_size_stats sysio::db_size_api_plugin::get ( )

Definition at line 34 of file db_size_api_plugin.cpp.

34 {
35 const chainbase::database& db = app().get_plugin<chain_plugin>().chain().db();
36 db_size_stats ret;
37
38 ret.free_bytes = db.get_segment_manager()->get_free_memory();
39 ret.size = db.get_segment_manager()->get_size();
40 ret.used_bytes = ret.size - ret.free_bytes;
41
43 for(const auto& i : indices)
44 ret.indices.emplace_back(db_size_index_count{i.second, i.first});
45
46 return ret;
47}
abstract_plugin & get_plugin(const string &name) const
database & db()
Definition main.cpp:35
pinnable_mapped_file::segment_manager * get_segment_manager()
std::multiset< std::pair< unsigned, std::string > > database_index_row_count_multiset
database_index_row_count_multiset row_count_per_index() const
application & app()
CK_RV ret
Here is the call graph for this function:

◆ operator=() [1/2]

db_size_api_plugin & sysio::db_size_api_plugin::operator= ( const db_size_api_plugin & )
delete

◆ operator=() [2/2]

db_size_api_plugin & sysio::db_size_api_plugin::operator= ( db_size_api_plugin && )
delete

◆ plugin_initialize()

void sysio::db_size_api_plugin::plugin_initialize ( const variables_map & vm)
inline

Definition at line 36 of file db_size_api_plugin.hpp.

36{}

◆ plugin_shutdown()

void sysio::db_size_api_plugin::plugin_shutdown ( )
inline

Definition at line 38 of file db_size_api_plugin.hpp.

38{}

◆ plugin_startup()

void sysio::db_size_api_plugin::plugin_startup ( )

Definition at line 28 of file db_size_api_plugin.cpp.

28 {
29 app().get_plugin<http_plugin>().add_api({
30 CALL_WITH_400(db_size, this, get, INVOKE_R_V(this, get), 200),
31 });
32}
#define CALL_WITH_400(api_name, api_handle, api_namespace, call_name, http_response_code, params_type)
#define INVOKE_R_V(api_handle, call_name)
Here is the call graph for this function:

◆ set_program_options()

virtual void sysio::db_size_api_plugin::set_program_options ( options_description & cli,
options_description & cfg )
inlineoverridevirtual

Implements appbase::abstract_plugin.

Definition at line 35 of file db_size_api_plugin.hpp.

35{}

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