/* * __create_data_source -- * Create a custom data source. */ static int __create_data_source(WT_SESSION_IMPL *session, const char *uri, const char *config, WT_DATA_SOURCE *dsrc) { WT_CONFIG_ITEM cval; const char *cfg[] = { WT_CONFIG_BASE(session, session_create), config, NULL }; /* * Check to be sure the key/value formats are legal: the underlying * data source doesn't have access to the functions that check. */ WT_RET(__wt_config_gets(session, cfg, "key_format", &cval)); WT_RET(__wt_struct_check(session, cval.str, cval.len, NULL, NULL)); WT_RET(__wt_config_gets(session, cfg, "value_format", &cval)); WT_RET(__wt_struct_check(session, cval.str, cval.len, NULL, NULL)); /* * User-specified collators aren't supported for data-source objects. */ if (__wt_config_getones( session, config, "collator", &cval) != WT_NOTFOUND) WT_RET_MSG(session, EINVAL, "WT_DATA_SOURCE objects do not support WT_COLLATOR " "ordering"); return (dsrc->create(dsrc, &session->iface, uri, (WT_CONFIG_ARG *)cfg)); }
/* * __wt_struct_confchk -- * Check that the specified packing format is valid, configuration version. */ int __wt_struct_confchk(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *v) { return (__wt_struct_check(session, v->str, v->len, NULL, NULL)); }