summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2014-02-26 20:45:51 +1100
committerMichael Cahill <michael.cahill@wiredtiger.com>2014-02-26 20:45:51 +1100
commit6565f622fe9acdfa80471264b1013665b5f54641 (patch)
tree29ce6ae2f171a569f4cb97576c23531bead82cb5 /src
parent30b1a822b26ff0531a0d31aa2895bc98b6f53d88 (diff)
parent71cc17adc3bc8a99f1ae38bc52c2e8d4c678218b (diff)
downloadmongo-6565f622fe9acdfa80471264b1013665b5f54641.tar.gz
Merge branch 'develop' into lsm-fixes
Diffstat (limited to 'src')
-rw-r--r--src/config/config.c6
-rw-r--r--src/config/config_api.c105
-rw-r--r--src/config/config_ext.c91
-rw-r--r--src/conn/conn_api.c6
-rw-r--r--src/docs/Doxyfile1
-rw-r--r--src/docs/command-line.dox3
-rw-r--r--src/docs/custom_data.dox5
-rw-r--r--src/docs/spell.ok1
-rw-r--r--src/docs/upgrading.dox14
-rw-r--r--src/include/config.h8
-rw-r--r--src/include/extern.h21
-rw-r--r--src/include/wiredtiger.in154
-rw-r--r--src/include/wiredtiger_ext.h137
-rw-r--r--src/include/wt_internal.h2
14 files changed, 316 insertions, 238 deletions
diff --git a/src/config/config.c b/src/config/config.c
index c30c816de85..c0eb672015f 100644
--- a/src/config/config.c
+++ b/src/config/config.c
@@ -738,10 +738,8 @@ __wt_config_subgetraw(WT_SESSION_IMPL *session,
__wt_config_subgets(WT_SESSION_IMPL *session,
WT_CONFIG_ITEM *cfg, const char *key, WT_CONFIG_ITEM *value)
{
- WT_CONFIG_ITEM key_item;
-
- key_item.str = key;
- key_item.len = strlen(key);
+ WT_CONFIG_ITEM key_item =
+ { key, strlen(key), 0, WT_CONFIG_ITEM_STRING };
return (__wt_config_subgetraw(session, cfg, &key_item, value));
}
diff --git a/src/config/config_api.c b/src/config/config_api.c
new file mode 100644
index 00000000000..42f4c117b81
--- /dev/null
+++ b/src/config/config_api.c
@@ -0,0 +1,105 @@
+/*-
+ * Copyright (c) 2008-2014 WiredTiger, Inc.
+ * All rights reserved.
+ *
+ * See the file LICENSE for redistribution information.
+ */
+
+#include "wt_internal.h"
+
+/*
+ * __config_parser_close --
+ * WT_CONFIG_PARSER->close method.
+ */
+static int
+__config_parser_close(WT_CONFIG_PARSER *wt_config_parser)
+{
+ WT_CONFIG_PARSER_IMPL *config_parser;
+
+ config_parser = (WT_CONFIG_PARSER_IMPL *)wt_config_parser;
+
+ if (config_parser == NULL)
+ return (EINVAL);
+
+ __wt_free(config_parser->session, config_parser);
+ return (0);
+}
+
+/*
+ * __config_parser_get --
+ * WT_CONFIG_PARSER->search method.
+ */
+static int
+__config_parser_get(WT_CONFIG_PARSER *wt_config_parser,
+ const char *key, WT_CONFIG_ITEM *cval)
+{
+ WT_CONFIG_PARSER_IMPL *config_parser;
+
+ config_parser = (WT_CONFIG_PARSER_IMPL *)wt_config_parser;
+
+ if (config_parser == NULL)
+ return (EINVAL);
+
+ return (__wt_config_subgets(config_parser->session,
+ &config_parser->config_item, key, cval));
+}
+
+/*
+ * __config_parser_next --
+ * WT_CONFIG_PARSER->next method.
+ */
+static int
+__config_parser_next(WT_CONFIG_PARSER *wt_config_parser,
+ WT_CONFIG_ITEM *key, WT_CONFIG_ITEM *cval)
+{
+ WT_CONFIG_PARSER_IMPL *config_parser;
+
+ config_parser = (WT_CONFIG_PARSER_IMPL *)wt_config_parser;
+
+ if (config_parser == NULL)
+ return (EINVAL);
+
+ return (__wt_config_next(&config_parser->config, key, cval));
+}
+
+/*
+ * wiredtiger_config_parser_open --
+ * Create a configuration parser.
+ */
+int
+wiredtiger_config_parser_open(WT_SESSION *wt_session,
+ const char *config, size_t len, WT_CONFIG_PARSER **config_parserp)
+{
+ static const WT_CONFIG_PARSER stds = {
+ __config_parser_close,
+ __config_parser_next,
+ __config_parser_get
+ };
+ WT_CONFIG_ITEM config_item =
+ { config, len, 0, WT_CONFIG_ITEM_STRING };
+ WT_CONFIG_PARSER_IMPL *config_parser;
+ WT_DECL_RET;
+ WT_SESSION_IMPL *session;
+
+ *config_parserp = NULL;
+ session = (WT_SESSION_IMPL *)wt_session;
+
+ WT_RET(__wt_calloc_def(session, 1, &config_parser));
+ config_parser->iface = stds;
+ config_parser->session = session;
+
+ /*
+ * Setup a WT_CONFIG_ITEM to be used for get calls and a WT_CONFIG
+ * structure for iterations through the configuration string.
+ */
+ memcpy(&config_parser->config_item, &config_item, sizeof(config_item));
+ WT_ERR(__wt_config_initn(
+ session, &config_parser->config, config, len));
+
+ if (ret == 0)
+ *config_parserp = (WT_CONFIG_PARSER *)config_parser;
+ else
+err: __wt_free(session, config_parser);
+
+ return (ret);
+}
diff --git a/src/config/config_ext.c b/src/config/config_ext.c
index 7dd5445cc3c..26b3799d61c 100644
--- a/src/config/config_ext.c
+++ b/src/config/config_ext.c
@@ -8,6 +8,19 @@
#include "wt_internal.h"
/*
+ * __wt_ext_config_parser_open --
+ * WT_EXTENSION_API->config_parser_open implementation
+ */
+int
+__wt_ext_config_parser_open(WT_EXTENSION_API *wt_ext, WT_SESSION *wt_session,
+ const char *config, size_t len, WT_CONFIG_PARSER **config_parserp)
+{
+ WT_UNUSED(wt_ext);
+ return (wiredtiger_config_parser_open(
+ wt_session, config, len, config_parserp));
+}
+
+/*
* __wt_ext_config_get --
* Given a NULL-terminated list of configuration strings, find the final
* value for a given string key (external API version).
@@ -29,81 +42,3 @@ __wt_ext_config_get(WT_EXTENSION_API *wt_api,
return (WT_NOTFOUND);
return (__wt_config_gets(session, cfg, key, cval));
}
-
-/*
- * __wt_ext_config_strget --
- * Given a single configuration string, find the final value for a given
- * string key (external API version).
- */
-int
-__wt_ext_config_strget(WT_EXTENSION_API *wt_api,
- WT_SESSION *wt_session, const char *config, const char *key,
- WT_CONFIG_ITEM *cval)
-{
- const char *cfg_arg[] = { config, NULL };
-
- return (__wt_ext_config_get(
- wt_api, wt_session, (WT_CONFIG_ARG *)cfg_arg, key, cval));
-}
-
-/*
- * __wt_ext_config_scan_begin --
- * Start a scan of a config string.
- * (external API only).
- */
-int
-__wt_ext_config_scan_begin(
- WT_EXTENSION_API *wt_api, WT_SESSION *wt_session,
- const char *str, size_t len, WT_CONFIG_SCAN **scanp)
-{
- WT_CONFIG config, *scan;
- WT_CONNECTION_IMPL *conn;
- WT_SESSION_IMPL *session;
-
- conn = (WT_CONNECTION_IMPL *)wt_api->conn;
- if ((session = (WT_SESSION_IMPL *)wt_session) == NULL)
- session = conn->default_session;
-
- /* Note: allocate memory last to avoid cleanup. */
- WT_CLEAR(config);
- WT_RET(__wt_config_initn(session, &config, str, len));
- WT_RET(__wt_calloc_def(session, 1, &scan));
- *scan = config;
- *scanp = (WT_CONFIG_SCAN *)scan;
- return (0);
-}
-
-/*
- * __wt_ext_config_scan_end --
- * End a scan of a config string.
- * (external API only).
- */
-int
-__wt_ext_config_scan_end(WT_EXTENSION_API *wt_api, WT_CONFIG_SCAN *scan)
-{
- WT_CONFIG *conf;
-
- WT_UNUSED(wt_api);
-
- conf = (WT_CONFIG *)scan;
- __wt_free(conf->session, scan);
- return (0);
-}
-
-/*
- * __wt_ext_config_scan_next --
- * Get the next key/value pair from a config scan.
- * (external API only).
- */
-int
-__wt_ext_config_scan_next(
- WT_EXTENSION_API *wt_api, WT_CONFIG_SCAN *scan,
- WT_CONFIG_ITEM *key, WT_CONFIG_ITEM *value)
-{
- WT_CONFIG *conf;
-
- WT_UNUSED(wt_api);
-
- conf = (WT_CONFIG *)scan;
- return (__wt_config_next(conf, key, value));
-}
diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c
index b8546558026..bcbb8e3ceb8 100644
--- a/src/conn/conn_api.c
+++ b/src/conn/conn_api.c
@@ -105,11 +105,8 @@ __conn_get_extension_api(WT_CONNECTION *wt_conn)
conn->extension_api.scr_free = __wt_ext_scr_free;
conn->extension_api.collator_config = ext_collator_config;
conn->extension_api.collate = ext_collate;
+ conn->extension_api.config_parser_open = __wt_ext_config_parser_open;
conn->extension_api.config_get = __wt_ext_config_get;
- conn->extension_api.config_strget = __wt_ext_config_strget;
- conn->extension_api.config_scan_begin = __wt_ext_config_scan_begin;
- conn->extension_api.config_scan_end = __wt_ext_config_scan_end;
- conn->extension_api.config_scan_next = __wt_ext_config_scan_next;
conn->extension_api.metadata_insert = __wt_ext_metadata_insert;
conn->extension_api.metadata_remove = __wt_ext_metadata_remove;
conn->extension_api.metadata_search = __wt_ext_metadata_search;
@@ -123,6 +120,7 @@ __conn_get_extension_api(WT_CONNECTION *wt_conn)
conn->extension_api.transaction_notify = __wt_ext_transaction_notify;
conn->extension_api.transaction_oldest = __wt_ext_transaction_oldest;
conn->extension_api.transaction_visible = __wt_ext_transaction_visible;
+ conn->extension_api.version = wiredtiger_version;
return (&conn->extension_api);
}
diff --git a/src/docs/Doxyfile b/src/docs/Doxyfile
index 5f7e5016892..d8f753b269b 100644
--- a/src/docs/Doxyfile
+++ b/src/docs/Doxyfile
@@ -1576,6 +1576,7 @@ PREDEFINED = DOXYGEN \
__wt_compressor:=WT_COMPRESSOR \
__wt_config_arg:=WT_CONFIG_ARG \
__wt_config_item:=WT_CONFIG_ITEM \
+ __wt_config_parser:=WT_CONFIG_PARSER \
__wt_config_scan:=WT_CONFIG_SCAN \
__wt_connection:=WT_CONNECTION \
__wt_cursor:=WT_CURSOR \
diff --git a/src/docs/command-line.dox b/src/docs/command-line.dox
index 52be68a1074..04daa4050cd 100644
--- a/src/docs/command-line.dox
+++ b/src/docs/command-line.dox
@@ -291,9 +291,6 @@ engine, or, if specified, for the URI on the command-line.
<code>wt [-Vv] [-C config] [-h directory] stat [-a] [uri]</code>
@subsection util_stat_options Options
-The \c stat command has no command-specific options.
-
-@subsection util_stat_options Options
The following are command-specific options for the \c stat command:
@par <code>-a</code>
diff --git a/src/docs/custom_data.dox b/src/docs/custom_data.dox
index b1ee8dfbd9e..22dd75dcc26 100644
--- a/src/docs/custom_data.dox
+++ b/src/docs/custom_data.dox
@@ -165,11 +165,6 @@ of a configuration string as follows:
@snippet ex_data_source.c WT_EXTENSION config_get
-The WT_DATA_SOURCE::open_cursor method might retrieve the list value
-of a configuration string as follows:
-
-@snippet ex_data_source.c WT_EXTENSION config scan
-
@subsection custom_ds_config_add Creating data-specific configuration strings
Applications can add their own configuration strings to WiredTiger
diff --git a/src/docs/spell.ok b/src/docs/spell.ok
index 6d24c474e19..58701aaa5bf 100644
--- a/src/docs/spell.ok
+++ b/src/docs/spell.ok
@@ -313,6 +313,7 @@ statlog
str
strerror
strftime
+strget
struct
structs
subdatabases
diff --git a/src/docs/upgrading.dox b/src/docs/upgrading.dox
index e59b031a1ff..e67d3298d88 100644
--- a/src/docs/upgrading.dox
+++ b/src/docs/upgrading.dox
@@ -1,5 +1,19 @@
/*! @page upgrading Upgrading WiredTiger applications
+@section version_22 Upgrading to Version 2.2
+<dl>
+
+<dt>WT_EXTENSION_API::config methods</dt>
+<dd>
+In the 2.2 release of WiredTiger the configuration string parsing API has been
+changed and added to a new public handle. The WT_EXTENSION_API::config_strget,
+WT_EXTENSION_API::config_scan_begin, WT_EXTENSION_API::config_scan_next and
+WT_EXTENSION_API::config_scan_end have been removed. They have been replaced
+by a WT_EXTENSION_API::config_parser_open method, which can be used to
+parse configuration strings. See the WT_CONFIG_PARSER documentation for
+examples on how to use the updated API.
+</dd>
+
@section version_21 Upgrading to Version 2.1
<dl>
diff --git a/src/include/config.h b/src/include/config.h
index d8837f0f368..c83d96c8a5e 100644
--- a/src/include/config.h
+++ b/src/include/config.h
@@ -33,6 +33,14 @@ struct __wt_config_entry {
const WT_CONFIG_CHECK *checks; /* check array */
};
+struct __wt_config_parser_impl {
+ WT_CONFIG_PARSER iface;
+
+ WT_SESSION_IMPL *session;
+ WT_CONFIG config;
+ WT_CONFIG_ITEM config_item;
+};
+
/*
* DO NOT EDIT: automatically built by dist/api_config.py.
* configuration section: BEGIN
diff --git a/src/include/extern.h b/src/include/extern.h
index d1662717345..bd24cb02d61 100644
--- a/src/include/extern.h
+++ b/src/include/extern.h
@@ -529,27 +529,16 @@ extern int __wt_config_concat( WT_SESSION_IMPL *session,
const char **config_ret);
extern int __wt_conn_config_init(WT_SESSION_IMPL *session);
extern void __wt_conn_config_discard(WT_SESSION_IMPL *session);
+extern int __wt_ext_config_parser_open(WT_EXTENSION_API *wt_ext,
+ WT_SESSION *wt_session,
+ const char *config,
+ size_t len,
+ WT_CONFIG_PARSER **config_parserp);
extern int __wt_ext_config_get(WT_EXTENSION_API *wt_api,
WT_SESSION *wt_session,
WT_CONFIG_ARG *cfg_arg,
const char *key,
WT_CONFIG_ITEM *cval);
-extern int __wt_ext_config_strget(WT_EXTENSION_API *wt_api,
- WT_SESSION *wt_session,
- const char *config,
- const char *key,
- WT_CONFIG_ITEM *cval);
-extern int __wt_ext_config_scan_begin( WT_EXTENSION_API *wt_api,
- WT_SESSION *wt_session,
- const char *str,
- size_t len,
- WT_CONFIG_SCAN **scanp);
-extern int __wt_ext_config_scan_end(WT_EXTENSION_API *wt_api,
- WT_CONFIG_SCAN *scan);
-extern int __wt_ext_config_scan_next( WT_EXTENSION_API *wt_api,
- WT_CONFIG_SCAN *scan,
- WT_CONFIG_ITEM *key,
- WT_CONFIG_ITEM *value);
extern int __wt_collator_config( WT_SESSION_IMPL *session,
const char **cfg,
WT_COLLATOR **collatorp);
diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in
index 48dd7dc9bbd..8bcdc431bd9 100644
--- a/src/include/wiredtiger.in
+++ b/src/include/wiredtiger.in
@@ -71,6 +71,9 @@ extern "C" {
*******************************************/
struct __wt_collator; typedef struct __wt_collator WT_COLLATOR;
struct __wt_compressor; typedef struct __wt_compressor WT_COMPRESSOR;
+struct __wt_config_item; typedef struct __wt_config_item WT_CONFIG_ITEM;
+struct __wt_config_parser;
+ typedef struct __wt_config_parser WT_CONFIG_PARSER;
struct __wt_connection; typedef struct __wt_connection WT_CONNECTION;
struct __wt_cursor; typedef struct __wt_cursor WT_CURSOR;
struct __wt_data_source; typedef struct __wt_data_source WT_DATA_SOURCE;
@@ -1890,6 +1893,153 @@ int wiredtiger_unpack_str(WT_PACK_STREAM *ps, const char **sp);
*/
int wiredtiger_unpack_uint(WT_PACK_STREAM *ps, uint64_t *up);
+/*!
+ * @name Configuration string parsing
+ * @{
+ */
+
+/*!
+ * The configuration information returned by the WiredTiger configuration
+ * parsing functions in the WT_EXTENSION_API and the public API.
+ */
+struct __wt_config_item {
+ /*!
+ * The value of a configuration string.
+ *
+ * Regardless of the type of the configuration string (boolean, int,
+ * list or string), the \c str field will reference the value of the
+ * configuration string.
+ *
+ * The bytes referenced by \c str are <b>not</b> nul-terminated,
+ * use the \c len field instead of a terminating nul byte.
+ */
+ const char *str;
+
+ /*! The number of bytes in the value referenced by \c str. */
+ size_t len;
+
+ /*!
+ * The value of a configuration boolean or integer.
+ *
+ * If the configuration string's value is "true" or "false", the
+ * \c val field will be set to 1 (true), or 0 (false).
+ *
+ * If the configuration string can be legally interpreted as an integer,
+ * using the strtoll function rules as specified in ISO/IEC 9899:1990
+ * ("ISO C90"), that integer will be stored in the \c val field.
+ */
+ int64_t val;
+
+ /*! Permitted values of the \c type field. */
+ enum {
+ /*! A string value with quotes stripped. */
+ WT_CONFIG_ITEM_STRING,
+ /*! A boolean literal ("true" or "false"). */
+ WT_CONFIG_ITEM_BOOL,
+ /*! An unquoted identifier: a string value without quotes. */
+ WT_CONFIG_ITEM_ID,
+ /*! A numeric value. */
+ WT_CONFIG_ITEM_NUM,
+ /*! A nested structure or list, including brackets. */
+ WT_CONFIG_ITEM_STRUCT
+ }
+ /*!
+ * The type of value determined by the parser. In all cases,
+ * the \c str and \c len fields are set.
+ */
+ type;
+};
+
+/*!
+ * Create a handle that can be used to parse or create configuration strings
+ * compatible with WiredTiger APIs.
+ * This API is outside the scope of a WiredTiger connection handle, since
+ * applications may need to generate configuration strings prior to calling
+ * ::wiredtiger_open.
+ * @param session the session handle to be used for error reporting. If NULL
+ * error messages will be written to stdout.
+ * @param config the configuration string being parsed. The string must
+ * remain valid for the lifetime of the parser handle.
+ * @param len the number of valid bytes in \c config
+ * @param[out] config_parserp A pointer to the newly opened handle
+ * @errors
+ */
+int wiredtiger_config_parser_open(WT_SESSION *session,
+ const char *config, size_t len, WT_CONFIG_PARSER **config_parserp);
+
+/*!
+ * A handle that can be used to search and traverse configuration strings
+ * compatible with WiredTiger APIs.
+ * To parse the contents of a list or nested configuration string use a new
+ * configuration parser handle based on the content of the ::WT_CONFIG_ITEM
+ * retrieved from the parent configuration string.
+ *
+ * @section config_parse_examples Configuration String Parsing examples
+ *
+ * This could be used in C to create a configuration parser as follows:
+ *
+ * @snippet ex_config_parse.c Create a configuration parser
+ *
+ * Once the parser has been created the content can be queried directly:
+ *
+ * @snippet ex_config_parse.c get
+ *
+ * Or the content can be traversed linearly:
+ *
+ * @snippet ex_config_parse.c next
+ *
+ * Nested configuration values can be queried using a shorthand notation:
+ *
+ * @snippet ex_config_parse.c nested get
+ *
+ * Nested configuration values can be traversed using multiple
+ * ::WT_CONFIG_PARSER handles:
+ *
+ * @snippet ex_config_parse.c nested traverse
+ */
+struct __wt_config_parser {
+
+ /*!
+ * Close the configuration scanner releasing any resources.
+ *
+ * @param config_parser the configuration parser handle
+ * @errors
+ *
+ */
+ int __F(close)(WT_CONFIG_PARSER *config_parser);
+
+ /*!
+ * Return the next key/value pair.
+ *
+ * When iteration would pass the end of the configuration string
+ * ::WT_NOTFOUND will be returned.
+ *
+ * If an item has no explicitly assigned value, the item will be
+ * returned in \c key and the \c value will be set to the boolean
+ * \c "true" value.
+ *
+ * @param config_parser the configuration parser handle
+ * @param key the returned key
+ * @param value the returned value
+ * @errors
+ *
+ */
+ int __F(next)(WT_CONFIG_PARSER *config_parser,
+ WT_CONFIG_ITEM *key, WT_CONFIG_ITEM *value);
+
+ /*!
+ * Return the value of an item in the configuration string.
+ *
+ * @param config_parser the configuration parser handle
+ * @param key configuration key string
+ * @param value the returned value
+ * @errors
+ *
+ */
+ int __F(get)(WT_CONFIG_PARSER *config_parser,
+ const char *key, WT_CONFIG_ITEM *value);
+};
+
#endif /* !defined(SWIG) */
/*!
* @}
@@ -1985,9 +2135,7 @@ const char *wiredtiger_version(int *majorp, int *minorp, int *patchp);
/*******************************************
* Forward structure declarations for the extension API
*******************************************/
-struct __wt_config_arg; typedef struct __wt_config_arg WT_CONFIG_ARG;
-struct __wt_config_item; typedef struct __wt_config_item WT_CONFIG_ITEM;
-struct __wt_config_scan; typedef struct __wt_config_scan WT_CONFIG_SCAN;
+struct __wt_config_arg; typedef struct __wt_config_arg WT_CONFIG_ARG;
/*!
* The interface implemented by applications to provide custom ordering of
diff --git a/src/include/wiredtiger_ext.h b/src/include/wiredtiger_ext.h
index 88ddecdade1..acf7efad3d9 100644
--- a/src/include/wiredtiger_ext.h
+++ b/src/include/wiredtiger_ext.h
@@ -184,6 +184,12 @@ struct __wt_extension_api {
WT_ITEM *first, WT_ITEM *second, int *cmp);
/*!
+ * @copydoc wiredtiger_config_parser_open
+ */
+ int (*config_parser_open)(WT_EXTENSION_API *wt_api, WT_SESSION *session,
+ const char *config, size_t len, WT_CONFIG_PARSER **config_parserp);
+
+ /*!
* Return the value of a configuration string.
*
* @param wt_api the extension handle
@@ -199,69 +205,6 @@ struct __wt_extension_api {
WT_CONFIG_ARG *config, const char *key, WT_CONFIG_ITEM *value);
/*!
- * Return the value of a configuration string.
- *
- * @param wt_api the extension handle
- * @param session the session handle (or NULL if none available)
- * @param config a configuration string
- * @param key configuration key string
- * @param value the returned value
- * @errors
- *
- * @snippet ex_data_source.c WT_EXTENSION config_strget
- */
- int (*config_strget)(WT_EXTENSION_API *wt_api, WT_SESSION *session,
- const char *config, const char *key, WT_CONFIG_ITEM *value);
-
- /*!
- * Return the list entries of a configuration string value.
- * This method steps through the entries found in the last returned
- * value from WT_EXTENSION_API::config_get. The last returned value
- * should be of type "list".
- *
- * @param wt_api the extension handle
- * @param session the session handle (or NULL if none available)
- * @param str the configuration string to scan
- * @param len the number of valid bytes in \c str
- * @param[out] scanp a handle used to scan the config string
- * @errors
- *
- * @snippet ex_data_source.c WT_EXTENSION config scan
- */
- int (*config_scan_begin)(WT_EXTENSION_API *wt_api, WT_SESSION *session,
- const char *str, size_t len, WT_CONFIG_SCAN **scanp);
-
- /*!
- * Release any resources allocated by
- * WT_EXTENSION_API::config_scan_begin.
- *
- * @param wt_api the extension handle
- * @param scan the configuration scanner, invalid after this call
- * @errors
- *
- * @snippet ex_data_source.c WT_EXTENSION config scan
- */
- int (*config_scan_end)(WT_EXTENSION_API *wt_api, WT_CONFIG_SCAN *scan);
-
- /*!
- * Return the next key/value pair from a config string scan.
- *
- * If the string contains a list of items with no assigned value, the
- * items will be returned in \c key and the \c value will be set to the
- * boolean \c "true" value.
- *
- * @param wt_api the extension handle
- * @param scan the configuration scanner
- * @param key the returned key
- * @param value the returned value
- * @errors
- *
- * @snippet ex_data_source.c WT_EXTENSION config scan
- */
- int (*config_scan_next)(WT_EXTENSION_API *wt_api,
- WT_CONFIG_SCAN *scan, WT_CONFIG_ITEM *key, WT_CONFIG_ITEM *value);
-
- /*!
* Insert a row into the metadata if it does not already exist.
*
* @param wt_api the extension handle
@@ -428,75 +371,19 @@ struct __wt_extension_api {
*/
int (*transaction_visible)(WT_EXTENSION_API *wt_api,
WT_SESSION *session, uint64_t transaction_id);
-};
-
-/*!
- * @typedef WT_CONFIG_ARG
- *
- * A configuration object passed to some extension interfaces. This is an
- * opaque type: configuration values can be queried using
- * WT_EXTENSION_API::config_get.
- */
-/*!
- * The configuration information returned by the WiredTiger extension function
- * WT_EXTENSION_API::config_get.
- */
-struct __wt_config_item {
/*!
- * The value of a configuration string.
- *
- * Regardless of the type of the configuration string (boolean, int,
- * list or string), the \c str field will reference the value of the
- * configuration string.
- *
- * The bytes referenced by \c str are <b>not</b> be nul-terminated,
- * use the \c len field instead of a terminating nul byte.
+ * @copydoc wiredtiger_version
*/
- const char *str;
-
- /*! The number of bytes in the value referenced by \c str. */
- size_t len;
-
- /*!
- * The value of a configuration boolean or integer.
- *
- * If the configuration string's value is "true" or "false", the
- * \c val field will be set to 1 (true), or 0 (false).
- *
- * If the configuration string can be legally interpreted as an integer,
- * using the strtoll function rules as specified in ISO/IEC 9899:1990
- * ("ISO C90"), that integer will be stored in the \c val field.
- */
- int64_t val;
-
- /*! Permitted values of the \c type field. */
- enum {
- /*! A string value with quotes stripped. */
- WT_CONFIG_ITEM_STRING,
- /*! A boolean literal ("true" or "false"). */
- WT_CONFIG_ITEM_BOOL,
- /*! An unquoted identifier: a string value without quotes. */
- WT_CONFIG_ITEM_ID,
- /*! A numeric value. */
- WT_CONFIG_ITEM_NUM,
- /*! A nested structure or list, including brackets. */
- WT_CONFIG_ITEM_STRUCT
- }
- /*!
- * The type of value determined by the parser. In all cases,
- * the \c str and \c len fields are set.
- */
- type;
+ const char *(*version)(int *majorp, int *minorp, int *patchp);
};
/*!
- * @typedef WT_CONFIG_SCAN
+ * @typedef WT_CONFIG_ARG
*
- * A handle for a scan through a configuration string.
- * This is an opaque type returned by WT_EXTENSION_API::config_scan_begin.
- * Configuration values can be queried using WT_EXTENSION_API::config_scan_next.
- * Call WT_EXTENSION_API::config_scan_end when finished to release resources.
+ * A configuration object passed to some extension interfaces. This is an
+ * opaque type: configuration values can be queried using
+ * WT_EXTENSION_API::config_get
*/
/*! @} */
diff --git a/src/include/wt_internal.h b/src/include/wt_internal.h
index 3ae89fc211e..19a805aa25f 100644
--- a/src/include/wt_internal.h
+++ b/src/include/wt_internal.h
@@ -93,6 +93,8 @@ struct __wt_config_check;
typedef struct __wt_config_check WT_CONFIG_CHECK;
struct __wt_config_entry;
typedef struct __wt_config_entry WT_CONFIG_ENTRY;
+struct __wt_config_parser_impl;
+ typedef struct __wt_config_parser_impl WT_CONFIG_PARSER_IMPL;
struct __wt_connection_impl;
typedef struct __wt_connection_impl WT_CONNECTION_IMPL;
struct __wt_connection_stats;