1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
/*-
* Copyright (c) 2014-2018 MongoDB, Inc.
* Copyright (c) 2008-2014 WiredTiger, Inc.
* All rights reserved.
*
* See the file LICENSE for redistribution information.
*/
#include "wt_internal.h"
/*
* __wt_ext_config_get --
* Given a NULL-terminated list of configuration strings, find the final
* value for a given string key (external API version).
*/
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)
{
WT_CONNECTION_IMPL *conn;
WT_SESSION_IMPL *session;
const char **cfg;
conn = (WT_CONNECTION_IMPL *)wt_api->conn;
if ((session = (WT_SESSION_IMPL *)wt_session) == NULL)
session = conn->default_session;
if ((cfg = (const char **)cfg_arg) == NULL)
return (WT_NOTFOUND);
return (__wt_config_gets(session, cfg, key, cval));
}
/*
* __wt_ext_config_get_string --
* Given a configuration string, find the value for a given string key
* (external API version).
*/
int
__wt_ext_config_get_string(WT_EXTENSION_API *wt_api,
WT_SESSION *wt_session, const char *config, const char *key,
WT_CONFIG_ITEM *cval)
{
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;
return (__wt_config_getones(session, config, key, cval));
}
/*
* __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_parser_open_arg --
* WT_EXTENSION_API->config_parser_open_arg implementation
*/
int
__wt_ext_config_parser_open_arg(WT_EXTENSION_API *wt_ext,
WT_SESSION *wt_session, WT_CONFIG_ARG *cfg_arg,
WT_CONFIG_PARSER **config_parserp)
{
size_t len;
const char **cfg, *p;
WT_UNUSED(wt_ext);
/* Find the last non-NULL entry in the configuration stack. */
if ((cfg = (const char **)cfg_arg) == NULL || *cfg == NULL) {
p = NULL;
len = 0;
} else {
while (cfg[1] != NULL)
++cfg;
p = *cfg;
len = strlen(p);
}
return (wiredtiger_config_parser_open(
wt_session, p, len, config_parserp));
}
|