summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2014-10-09 23:57:24 +1100
committerMichael Cahill <michael.cahill@wiredtiger.com>2014-10-09 23:57:24 +1100
commit0437d9a966b43e80f083fff36bad348bbe9e0b3a (patch)
tree5519c5f51a763bc48734d88df1ba261ad89710d7 /src/include
parent69a8b72f72eb8aa9af5b99cbe47feccdb83a0847 (diff)
downloadmongo-0437d9a966b43e80f083fff36bad348bbe9e0b3a.tar.gz
More implementation of the custom extractor API. Still working on generating plans and key formats between index creation and open.
refs #1199
Diffstat (limited to 'src/include')
-rw-r--r--src/include/connection.h13
-rw-r--r--src/include/extern.h4
-rw-r--r--src/include/schema.h1
-rw-r--r--src/include/wiredtiger.in8
-rw-r--r--src/include/wt_internal.h2
5 files changed, 27 insertions, 1 deletions
diff --git a/src/include/connection.h b/src/include/connection.h
index 79e8e460858..4c05c8ba84b 100644
--- a/src/include/connection.h
+++ b/src/include/connection.h
@@ -54,6 +54,16 @@ struct __wt_named_data_source {
};
/*
+ * WT_NAMED_EXTRACTOR --
+ * A extractor list entry
+ */
+struct __wt_named_extractor {
+ const char *name; /* Name of extractor */
+ WT_EXTRACTOR *extractor; /* User supplied object */
+ TAILQ_ENTRY(__wt_named_extractor) q; /* Linked list of extractors */
+};
+
+/*
* Allocate some additional slots for internal sessions. There is a default
* session for each connection, plus a session for each server thread.
*/
@@ -252,6 +262,9 @@ struct __wt_connection_impl {
/* Locked: data source list */
TAILQ_HEAD(__wt_dsrc_qh, __wt_named_data_source) dsrcqh;
+ /* Locked: extractor list */
+ TAILQ_HEAD(__wt_extractor_qh, __wt_named_extractor) extractorqh;
+
void *lang_private; /* Language specific private storage */
/* If non-zero, all buffers used for I/O will be aligned to this. */
diff --git a/src/include/extern.h b/src/include/extern.h
index 24212bcb7be..e7cb446498d 100644
--- a/src/include/extern.h
+++ b/src/include/extern.h
@@ -223,6 +223,8 @@ extern int __wt_collator_config(WT_SESSION_IMPL *session, const char **cfg, WT_C
extern int __wt_conn_remove_collator(WT_SESSION_IMPL *session);
extern int __wt_conn_remove_compressor(WT_SESSION_IMPL *session);
extern int __wt_conn_remove_data_source(WT_SESSION_IMPL *session);
+extern int __wt_extractor_config(WT_SESSION_IMPL *session, const char *config, WT_EXTRACTOR **extractorp, int *ownp);
+extern int __wt_conn_remove_extractor(WT_SESSION_IMPL *session);
extern int __wt_verbose_config(WT_SESSION_IMPL *session, const char *cfg[]);
extern int __wt_cache_config(WT_SESSION_IMPL *session, const char *cfg[]);
extern int __wt_cache_create(WT_SESSION_IMPL *session, const char *cfg[]);
@@ -484,7 +486,7 @@ extern int __wt_schema_drop(WT_SESSION_IMPL *session, const char *uri, const cha
extern int __wt_schema_get_table(WT_SESSION_IMPL *session, const char *name, size_t namelen, int ok_incomplete, WT_TABLE **tablep);
extern void __wt_schema_release_table(WT_SESSION_IMPL *session, WT_TABLE *table);
extern void __wt_schema_destroy_colgroup(WT_SESSION_IMPL *session, WT_COLGROUP *colgroup);
-extern void __wt_schema_destroy_index(WT_SESSION_IMPL *session, WT_INDEX *idx);
+extern int __wt_schema_destroy_index(WT_SESSION_IMPL *session, WT_INDEX *idx);
extern void __wt_schema_destroy_table(WT_SESSION_IMPL *session, WT_TABLE *table);
extern void __wt_schema_remove_table( WT_SESSION_IMPL *session, WT_TABLE *table);
extern void __wt_schema_close_tables(WT_SESSION_IMPL *session);
diff --git a/src/include/schema.h b/src/include/schema.h
index 74ba1733092..535a5a03dbc 100644
--- a/src/include/schema.h
+++ b/src/include/schema.h
@@ -28,6 +28,7 @@ struct __wt_index {
WT_CONFIG_ITEM colconf; /* List of columns from config */
WT_EXTRACTOR *extractor; /* Custom key extractor */
+ int extractor_owned; /* Extractor is owned by this index */
const char *idxkey_format; /* Index key format (hides primary) */
const char *key_format; /* Key format */
diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in
index 0c09de9eab1..c9e47ea13e7 100644
--- a/src/include/wiredtiger.in
+++ b/src/include/wiredtiger.in
@@ -2966,6 +2966,14 @@ struct __wt_extractor {
WT_CURSOR *result_cursor);
/*!
+ * If non-NULL, this callback is called to customize the extractor for
+ * each index. If the callback returns a non-NULL extractor, that
+ * instance is used instead of this one for all comparisons.
+ */
+ int (*customize)(WT_EXTRACTOR *extractor, WT_SESSION *session,
+ const char *uri, WT_CONFIG_ITEM *appcfg, WT_EXTRACTOR **customp);
+
+ /*!
* If non-NULL, a callback performed when the database is closed.
*
* The WT_EXTRACTOR::terminate callback is intended to allow cleanup,
diff --git a/src/include/wt_internal.h b/src/include/wt_internal.h
index 08e8db83d68..2a3279037c6 100644
--- a/src/include/wt_internal.h
+++ b/src/include/wt_internal.h
@@ -193,6 +193,8 @@ struct __wt_named_compressor;
typedef struct __wt_named_compressor WT_NAMED_COMPRESSOR;
struct __wt_named_data_source;
typedef struct __wt_named_data_source WT_NAMED_DATA_SOURCE;
+struct __wt_named_extractor;
+ typedef struct __wt_named_extractor WT_NAMED_EXTRACTOR;
struct __wt_ovfl_reuse;
typedef struct __wt_ovfl_reuse WT_OVFL_REUSE;
struct __wt_ovfl_track;