54 # include <dsn/utility/factory_store.h>    55 # include <dsn/tool-api/global_config.h>    56 # include <dsn/tool-api/command.h>    57 # include <dsn/tool-api/global_checkers.h>    58 # include <dsn/tool-api/task_queue.h>    59 # include <dsn/tool-api/task_worker.h>    60 # include <dsn/tool-api/admission_controller.h>    61 # include <dsn/tool-api/network.h>    62 # include <dsn/tool-api/aio_provider.h>    63 # include <dsn/tool-api/env_provider.h>    64 # include <dsn/tool-api/nfs.h>    65 # include <dsn/tool-api/zlock_provider.h>    66 # include <dsn/tool-api/message_parser.h>    67 # include <dsn/tool-api/logging_provider.h>    68 # include <dsn/tool-api/memory_provider.h>    69 # include <dsn/tool-api/timer_service.h>    70 # include <dsn/tool-api/partition_resolver.h>    72 namespace dsn { 
namespace tools {
    85     DSN_API 
explicit tool_base(
const char* name);
    87     const std::string& name()
 const { 
return _name; }
    96     template <
typename T> 
static toollet* create(
const char* name)
   101     typedef toollet* (*factory)(
const char*);
   104     DSN_API 
toollet(
const char* name);
   106     virtual void install(service_spec& spec) = 0;
   112     template <
typename T> 
static tool_app* create(
const char* name)
   117     typedef tool_app* (*factory)(
const char*);
   122     virtual void install(service_spec& spec) = 0;
   131     DSN_API 
virtual void start_all_apps();
   132     DSN_API 
virtual void stop_all_apps(
bool cleanup);
   134     DSN_API 
static const service_spec& get_service_spec();
   137 namespace internal_use_only
   139     DSN_API 
bool register_component_provider(
const char* name, timer_service::factory f, ::dsn::provider_type type);
   140     DSN_API 
bool register_component_provider(
const char* name, task_queue::factory f, ::dsn::provider_type type);
   141     DSN_API 
bool register_component_provider(
const char* name, task_worker::factory f, ::dsn::provider_type type);
   142     DSN_API 
bool register_component_provider(
const char* name, admission_controller::factory f, ::dsn::provider_type type);
   143     DSN_API 
bool register_component_provider(
const char* name, lock_provider::factory f, ::dsn::provider_type type);
   144     DSN_API 
bool register_component_provider(
const char* name, lock_nr_provider::factory f, ::dsn::provider_type type);
   145     DSN_API 
bool register_component_provider(
const char* name, rwlock_nr_provider::factory f, ::dsn::provider_type type);
   146     DSN_API 
bool register_component_provider(
const char* name, semaphore_provider::factory f, ::dsn::provider_type type);
   147     DSN_API 
bool register_component_provider(
const char* name, network::factory f, ::dsn::provider_type type);
   148     DSN_API 
bool register_component_provider(
const char* name, aio_provider::factory f, ::dsn::provider_type type);
   149     DSN_API 
bool register_component_provider(
const char* name, env_provider::factory f, ::dsn::provider_type type);
   150     DSN_API 
bool register_component_provider(
const char* name, perf_counter::factory f, ::dsn::provider_type type);
   151     DSN_API 
bool register_component_provider(
const char* name, logging_provider::factory f, ::dsn::provider_type type);
   152     DSN_API 
bool register_component_provider(
const char* name, memory_provider::factory f, ::dsn::provider_type type);
   153     DSN_API 
bool register_component_provider(
const char* name, nfs_node::factory f, ::dsn::provider_type type);
   154     DSN_API 
bool register_component_provider(network_header_format fmt, 
const std::vector<const char*>& signatures, message_parser::factory f, message_parser::factory2 f2, 
size_t sz);
   155     DSN_API 
bool register_component_provider(
const char* name, ::dsn::dist::partition_resolver::factory f, ::dsn::provider_type type);
   156     DSN_API 
bool register_toollet(
const char* name, toollet::factory f, ::dsn::provider_type type);
   157     DSN_API 
bool register_tool(
const char* name, tool_app::factory f, ::dsn::provider_type type);
   158     DSN_API 
toollet* get_toollet(
const char* name, ::dsn::provider_type type);
   165 DSN_API 
extern join_point<void> sys_init_before_app_created;
   166 DSN_API 
extern join_point<void> sys_init_after_app_created;
   167 DSN_API 
extern join_point<void, sys_exit_type>     sys_exit;
   170 template <
typename T> 
bool register_component_provider(
const char* name) { 
return internal_use_only::register_component_provider(name, T::template create<T>, ::dsn::PROVIDER_TYPE_MAIN); }
   171 template <
typename T> 
bool register_component_aspect(
const char* name) { 
return internal_use_only::register_component_provider(name, T::template create<T>, ::dsn::PROVIDER_TYPE_ASPECT); }
   172 template <
typename T> 
bool register_message_header_parser(network_header_format fmt, 
const std::vector<const char*>& signatures);
   174 template <
typename T> 
bool register_toollet(
const char* name) { 
return internal_use_only::register_toollet(name, toollet::template create<T>, ::dsn::PROVIDER_TYPE_MAIN); }
   175 template <
typename T> 
bool register_tool(
const char* name) { 
return internal_use_only::register_tool(name, tool_app::template create<T>, ::dsn::PROVIDER_TYPE_MAIN); }
   176 template <
typename T> T* get_toollet(
const char* name) { 
return (T*)internal_use_only::get_toollet(name, ::dsn::PROVIDER_TYPE_MAIN); }
   177 DSN_API 
tool_app* get_current_tool();
   178 DSN_API 
const service_spec& spec();
   179 DSN_API 
const char* get_service_node_name(service_node* node);
   180 DSN_API 
bool is_engine_ready();
   187 template <
typename T> 
bool register_message_header_parser(network_header_format fmt, 
const std::vector<const char*>& signatures)
   189     return internal_use_only::register_component_provider(fmt, signatures, T::template create<T>, T::template create2<T>, 
sizeof(T));