//p_表示plugin,pi_表示plugin_info //建立proto_graph并建立连接 void init_plugin_graph() { //add plugin到graph DEBUG_BEGIN(); vector<plugin_info>::iterator begin = plugin_info_list.begin(); cout << "plugin size:" << plugin_info_list.size() << endl; for (; begin != plugin_info_list.end(); begin++) { plugin_graph.add(begin->plug_in); DEBUG("%s%s","pluin_info_vector add:",begin->plug_in.proto_name); } //link各个plugin begin = plugin_info_list.begin(); for (; begin != plugin_info_list.end(); begin++) { plugin& p = begin->plug_in; const char *p_lower_name = p.lower_proto_name; vector<plugin_info>::iterator pi_lower_itr; pi_lower_itr = find_if(plugin_info_list.begin(), plugin_info_list.end(), bind2nd(find_plugin_info(), p_lower_name)); if (pi_lower_itr != plugin_info_list.end()) { plugin& p_lower = pi_lower_itr->plug_in; plugin_graph.link(p_lower,p); DEBUG("%s%s%s%s","proto_graph link:",p_lower.proto_name," ==> ",p.proto_name); } } DEBUG_END(); }
std::string nsclient::core::plugin_cache::find_plugin_alias(unsigned int plugin_id) { boost::optional<plugin_cache_item> info = find_plugin_info(plugin_id); if (!info) { return "Failed to find plugin: " + str::xtos(plugin_id); } return info->alias; }
/** * Note, the 'pi' is just a context variable to ensure the pointers copied * to the options are valid. It is *not* meant to be inspected. */ static lcb_error_t generate_options(plugin_info *pi, const struct lcb_create_io_ops_st *user, struct lcb_create_io_ops_st *ours, lcb_io_ops_type_t *type) { if (user) { memcpy(ours, user, sizeof(*user)); } else { memset(ours, 0, sizeof(*ours)); ours->version = 0; ours->v.v0.type = LCB_IO_OPS_DEFAULT; } if (ours->version > 0) { if (type) { *type = LCB_IO_OPS_INVALID; } /* we don't handle non-v0 options */ return LCB_SUCCESS; } if (ours->v.v0.type == LCB_IO_OPS_DEFAULT) { int rv; memset(pi, 0, sizeof(*pi)); rv = get_env_plugin_info(pi); if (rv > 0) { options_from_info(ours, pi); if (type) { *type = pi->iotype; } } else if (rv < 0) { return LCB_BAD_ENVIRONMENT; } else { plugin_info *pip = find_plugin_info(LCB_IO_OPS_DEFAULT); lcb_assert(pip); if (type) { *type = pip->iotype; } options_from_info(ours, pip); /* if the plugin is dynamically loadable, we need to * fallback to select(2) plugin in case we cannot find the * create function */ if (ours->version == 1) { struct plugin_st plugin; int want_debug; lcb_error_t ret; if (lcb_getenv_boolean_multi("LIBCOUCHBASE_DLOPEN_DEBUG", "LCB_DLOPEN_DEBUG", NULL)) { want_debug = 1; } else { want_debug = want_dl_debug; } ret = get_create_func(ours->v.v1.sofile, ours->v.v1.symbol, &plugin, want_debug); if (ret != LCB_SUCCESS) { if (type) { *type = LCB_IO_OPS_SELECT; } ours->version = 2; ours->v.v2.create = lcb_create_select_io_opts; ours->v.v2.cookie = NULL; } } } return LCB_SUCCESS; } else { /** Not default, ignore environment */ plugin_info *pip = find_plugin_info(ours->v.v0.type); if (!pip) { return LCB_NOT_SUPPORTED; } options_from_info(ours, pip); if (type) { *type = pip->iotype; } return LCB_SUCCESS; } }
const char * adios_transform_plugin_desc(enum ADIOS_TRANSFORM_TYPE transform_type) { adios_transform_plugin_info_t *info = find_plugin_info(transform_type); if (info) return info->description; else return NULL; }