"=" pairs. If the "=" part is omitted, the value of 1 is assumed.
-Values may be nested lists, for example:
+To handle more complex configuration, such as specifying a schema, values may be nested lists using parentheses. For example:
schema=(keyfmt=S,valuefmt=S,columns=(name,notes))
@@ -24,22 +24,22 @@ Superfluous commas and whitespace in the configuration string are ignored (inclu
Keys are processed in order from left to right, with later settings overriding earlier ones unless multiple settings for a key are permitted.
-\section config_examples Code Samples
+@section config_examples Code Samples
-The code below is taken from the complete example program \ex_ref{ex_config.c}.
+The code below is taken from the complete example program @ex_ref{ex_config.c}.
-\dontinclude ex_config.c
+@dontinclude ex_config.c
-Open a connection to a database, creating it if it does not exist and set a cache size of 10MiB:
+Open a connection to a database, creating it if it does not exist and set a cache size of 10MB:
-\skip wiredtiger_open
-\until != 0
+@skip wiredtiger_open
+@until != 0
Create a table that uses C language strings for keys and values:
-\skipline create_table
+@skipline create_table
-Assign a priority to a transaction to reduce aborts and give it a name for debugging:
+Assign a priority to a transaction and give it a name for debugging:
-\skipline begin_transaction
+@skipline begin_transaction
*/
diff --git a/docs/src/cursors.dox b/docs/src/cursors.dox
index f9d7f7227c0..00dfb2f6453 100644
--- a/docs/src/cursors.dox
+++ b/docs/src/cursors.dox
@@ -1,6 +1,6 @@
/* vim: set filetype=c.doxygen : */
-/*! \page cursors Cursors
+/*! @page cursors Cursors
Most common operations in WiredTiger are performed using cursors. A cursor includes:
@@ -9,7 +9,26 @@ Most common operations in WiredTiger are performed using cursors. A cursor incl
- encoding of fields to store in the data source
- methods to navigate around and iterate through the data
-\section cursor_types Cursor Types
+@section cursor_ranges Positioning a Cursor
+
+- how to put a cursor where you want it
+- first, last, next, prev
+- position after an insert
+- position after errors
+
+@todo write text
+
+"On failure", cursor position is undetermined. Apps that care need to either dup the cursor, or we could offer a config string that dups on all ops for you...
+
+@section cursor_writes Inserting and Updating
+
+@todo describe insert, update, append, insert-overwrite
+
+@section cursor_dups Duplicate Data Items
+
+@todo describe duplicate data items: how to insert them, how to navigate around them, etc.
+
+@section cursor_types Cursor Types
The following are builtin cursor types:
| statistics:[table:\ | database or table statistics (key=(string)keyname, data=(string)value) |
uri parameter to WT_SESSION::open_cursor. Only the fields from the listed columns are returned by WT_CURSOR::get_key and WT_CURSOR::get_value.
This is particularly useful with index cursors, because if all columns in the projection are available in the index (including primary key columns, which are the values of the index), there is no need to access any column set.
-\section cursor_ranges Restricting the Range of a Scan
+@section cursor_ranges Restricting the Range of a Scan
-XXX
+@todo explain how to do a range scan
-\section cursor_examples Code Samples
+@section cursor_examples Code Samples
-The code below is taken from the complete example program \ex_ref{ex_cursor.c}.
+The code below is taken from the complete example program @ex_ref{ex_cursor.c}.
-\dontinclude ex_cursor.c
+@todo expand cursor example description
-\skipline open_cursor
+@dontinclude ex_cursor.c
-\skipline open_cursor
+@skipline open_cursor
-\skipline open_cursor
+@skipline open_cursor
-\skipline open_cursor
+@skipline open_cursor
+
+@skipline open_cursor
*/
diff --git a/docs/src/design.dox b/docs/src/design.dox
index 2c48ebdfda3..be3b1d6156f 100644
--- a/docs/src/design.dox
+++ b/docs/src/design.dox
@@ -1,10 +1,12 @@
/* vim: set filetype=c.doxygen : */
-/*! \page design WiredTiger Design
+/*! @page design WiredTiger Design
+
+@todo rewrite this to describe the WiredTiger architecture with minimal discussion of Berkeley DB.
There are a number of page formats used in WiredTiger, each with a unique page type. However, all of the pages store data in some specific order, and it's simplest to think of all of the formats as sets of key/data pairs. -
Keys are either record numbers or variable-length byte strings. -
Data items are either fixed-length byte strings, variable-length byte strings or off-page references (pointers to other pages in the file). -
WiredTiger page types are presented in the API as "row" or "column" stores. -
A "row" store is a Berkeley DB style key/data store, where both keys and data are variable-length byte strings. A "column" store is one where the key is a record number and the data item is either a variable- or fixed-length byte @@ -29,7 +26,6 @@ faster for queries where only a few of the columns are required for any lookup stores also offer significant compression advantages when there is minimal difference between adjacent column values. -
To restate, there are 2 different types of keys in WiredTiger:
@@ -37,11 +33,9 @@ Recno : 64-bit record number Variable-Length : byte string + length-
The record-number isn't stored explicitly in the page, it's implicitly stored as part of the Btree. -
And there are 3 different types of data items in WiredTiger:
@@ -50,14 +44,12 @@ Variable-Length : byte string + length Off-page Ref: : off-page reference (a ref to another page in the file)-
A row store is one where there's a variable-length key associated with one or more variable-length data items. Because record numbers are an implicit part of the Btree, it's possible to retrieve records from a row store using record numbers, where that's useful. In a row store, a key may reference multiple data items (that is, duplicate data items). -
Here's the most complex possible row store layout:
@@ -80,34 +72,27 @@ Key: IP Internal page DLP Duplicate leaf page-
This is a standard B+tree layout. One or more levels of internal pages, then one level of leaf pages. -
A row store's internal page keys are variable-length byte strings. The internal page data items are references to other pages (the off-page reference type). -
A row store's leaf page key and data items are both variable-length byte strings. -
As mentioned above, it's possible to store multiple data items with a single key. In this case, the key is only stored a single time. If there are enough duplicate data items, the duplicate data items are moved into their own, separate Btree, referenced from the leaf page. These are the "duplicate internal" and "duplicate leaf" pages in the above diagram. -
Duplicate internal page keys are record numbers, and the duplicate internal page data items are references to other pages (the off-page reference type). -
Duplicate leaf page keys are record numbers, and the duplicate leaf page data items are variable-length strings. -
Row store notes:
This concludes the discussion of a row store. -
A column store is one where there's a single key, that references a single data item, and that data item may be fixed- or variable-length. -
Here's the most complex possible row store layout:
@@ -151,22 +133,18 @@ Key: IP Internal page LP Leaf page-
A column store's internal page keys are record numbers. The internal page data items are references to other pages (the off-page reference type). -
A column store's leaf page keys are record numbers. The leaf page data items are fixed- or variable-length byte strings. -
Because column store keys do not disappear on delete, there needs to be an on-page, permanent "deleted" data value; for variable-length byte strings, this is a specific item type. For fixed-length byte strings, the top bit of the field is the deleted flag (which means that the user-specified data length is off by a single bit). -
Column store notes:
Q&A:
"sharing=on" to ::wiredtiger_open. Note that in this case, when your application exits, all client connections are forcibly closed.
+The server can be embedded in an application or run from the command line. To embed the RPC server in your application, pass "multiprocess" in the configuration string to ::wiredtiger_open. Note that in this case, when your application exits, all client connections are forcibly closed.
-For details on running a standalone RPC server, see \ref command_line.
+For details on running a standalone RPC server, see @ref command_line.
-\section processes_sharing Opening Connections from Multiple Processes
+@section processes_sharing Opening Connections from Multiple Processes
When ::wiredtiger_open is called for a database, one of the following occurs:
# no process has the database open, it was closed cleanly. In this case, the opening process becomes the primary process and the database is opened without recovery.
-# no process has the database open, but it was not closed cleanly. In this case, the process becomes the primary and recovery is run before the database is opened. See \ref transaction_recovery for details.
+# no process has the database open, but it was not closed cleanly. In this case, the process becomes the primary and recovery is run before the database is opened. See @ref transaction_recovery for details.
# another process has the database open and is running the RPC server, in which case the opening process becomes a client.
# another process has the database open but is not running the RPC server, in which case the open fails.
e
-\section processes_example Code Samples
+@section processes_example Code Samples
-The code below is taken from the complete example program \ex_ref{ex_process.c}.
+The code below is taken from the complete example program @ex_ref{ex_process.c}.
-\dontinclude ex_process.c
-\skipline wiredtiger_open
+@dontinclude ex_process.c
+@skipline wiredtiger_open
*/
diff --git a/docs/src/schema.dox b/docs/src/schema.dox
index c7f5efcbd3b..1b23f879914 100644
--- a/docs/src/schema.dox
+++ b/docs/src/schema.dox
@@ -1,10 +1,10 @@
/* vim: set filetype=c.doxygen : */
-/*! \page schema Schemas
+/*! @page schema Schemas
The tables we have seen so far have all had simple key/value pairs for records.
-\section schema_intro Tables, Rows and Columns
+@section schema_intro Tables, Rows and Columns
A table is a logical representation of data consisting of cells in rows and columns. For example, a database might have this table.
@@ -36,41 +36,45 @@ A column-oriented database stores all of the values of a column together, then t
WiredTiger supports both storage formats, and can mix and match the storage of columns within a logical table.
-Applications describe the format of their data by supplying a *schema* to WT_SESSION::create_table. This specifies how the application's data can be split into fields and mapped onto rows and columns.
+Applications describe the format of their data by supplying a schema to WT_SESSION::create_table. This specifies how the application's data can be split into fields and mapped onto rows and columns.
-\section schema_columns Describing Columns
+@section schema_columns Describing Columns
-XXX
+@todo describe how to add columns to a schema
-\section schema_indices Adding an Index
+@section schema_column_sets Storing Sets of Columns Together
-XXX
+@todo define and describe column sets
-\section schema_mapping Column Storage
+@section schema_indices Adding an Index
-XXX
+@todo describe how to add indices to a schema
-\section schema_examples Code Samples
+@section schema_mapping Column Storage
-The code below is taken from the complete example program \ex_ref{ex_schema.c}.
+@todo describe how to store some columns separately
-\dontinclude ex_schema.c
-\skip C struct
-\until POP_RECORD
+@section schema_examples Code Samples
-\skip open_session
-\until conn->close
+The code below is taken from the complete example program @ex_ref{ex_schema.c}.
-The code below is taken from the complete example program \ex_ref{ex_call_center.c}.
+@dontinclude ex_schema.c
+@skip C struct
+@until POP_RECORD
-\dontinclude ex_call_center.c
-\skip home
-\until CALL
+@skip open_session
+@until conn->close
-\skip create_table
-\until conn->close
+The code below is taken from the complete example program @ex_ref{ex_call_center.c}.
-\section schema_advanced Advanced Schemas
+@dontinclude ex_call_center.c
+@skip home
+@until CALL
+
+@skip create_table
+@until conn->close
+
+@section schema_advanced Advanced Schemas
- non-relational data such as multiple index keys per row
- application-supplied extractors and collators may need to be registered before recovery can run.
diff --git a/docs/src/sql-map.dox b/docs/src/sql-map.dox
index a1d603a1b1e..0bf0d5b28f6 100644
--- a/docs/src/sql-map.dox
+++ b/docs/src/sql-map.dox
@@ -7,12 +7,12 @@ sit on top of WiredTiger, as they would on top of any key-value store.
The difference with WiredTiger's API is that the query plan is going to be
based on fundamental operations including:
-"transactional" to ::wiredtiger_open when creating the database.
In WiredTiger, the transactional context is managed by the WT_SESSION class. Applications call WT_SESSION::begin_transaction to start a new transaction, which is only permitted when no cursors are open. Operations performed with that WT_SESSION handle are then part of the transaction, and their effects can be committed by calling WT_SESSION::commit_transaction or WT_SESSION::rollback_transaction, both of which implicitly close any open cursors.
-When transactions are used, operations may fail with additional errors, including ::WT_DEADLOCK, ::WT_UPDATE_CONFLICT, ... [XXX].
+When transactions are used, operations may fail with additional errors, including ::WT_DEADLOCK, ::WT_UPDATE_CONFLICT, ...
+\todo describe transaction error cases more fully
-\section transactions_cc Concurrency Control
+@section transactions_cc Concurrency Control
-WiredTiger uses a timestamp-based optimistic concurrency control algorithm. This avoids the bottleneck of a centralized lock manager and expensive graph searching to identify deadlock cycles. [XXX]
+WiredTiger uses a timestamp-based optimistic concurrency control algorithm. This avoids the bottleneck of a centralized lock manager and expensive graph searching to identify deadlock cycles.
+\todo write more about concurrency control
-\section transaction_isolation Isolation Levels
+@section transaction_isolation Isolation Levels
The default isolation level is serializable, which means that the concurrent execution of committed transactions is equivalent to executing the transactions in some serial order.
Weaker isolation levels are also provided, including repeatable read, which permits phantoms, snapshot isolation, which permits write skew, read committed, which permits lost updates and always returns the most recently committed changes, and read uncommitted, which always reads the most recent version of data, regardless of whether it is committed.
-\section transaction_recovery Recovery
+@section transaction_recovery Recovery
-Recovery is run automatically during ::wiredtiger_open when required. See \ref processes_sharing for details.
+Recovery is run automatically during ::wiredtiger_open when required. See @ref processes_sharing for details.
Recovery works by using a database log that contains a record of the actions of all transactions. Recovery first finds the last complete checkpoint, and then scans forward through the log from that point to determine which transactions committed after the checkpoint. All actions are rolled forward from the checkpoint so that the in-memory tree matches its state when the crash occurred. Then the "losing" transactions (those that did not commit) are rolled back to return the database to a consistent state.
This suggests the importance of regular checkpoints: they limit the amount of work required during recovery, which speeds up the ::wiredtiger_open call. See WT_SESSION::checkpoint for information about triggering checkpoints.
-\section transaction_example Code Samples
+@section transaction_example Code Samples
-The code below is taken from the complete example program \ex_ref{ex_transaction.c}.
+The code below is taken from the complete example program @ex_ref{ex_transaction.c}.
-\dontinclude ex_transaction.c
-\skip begin_transaction
-\until commit
+@dontinclude ex_transaction.c
+@skip begin_transaction
+@until commit
*/
diff --git a/docs/src/tuning.dox b/docs/src/tuning.dox
index 8caa7912645..da37517e730 100644
--- a/docs/src/tuning.dox
+++ b/docs/src/tuning.dox
@@ -1,9 +1,11 @@
/* vim: set filetype=c.doxygen : */
-/*! \page tuning Performance Tuning
+/*! @page tuning Performance Tuning
- Performance monitoring with statistics
- Cache size
- Page size ranges
- Log buffer sizing
+
+@todo write this page
*/
diff --git a/docs/src/using.dox b/docs/src/using.dox
index e2a2623c4ae..5fbb3d53e25 100644
--- a/docs/src/using.dox
+++ b/docs/src/using.dox
@@ -1,18 +1,18 @@
/* vim: set filetype=c.doxygen : */
-/*! \page using Using WiredTiger
+/*! @page using Using WiredTiger
This section explains how to use WiredTiger by developing a sequence of example programs:
-- \subpage basic_api
-- \subpage config_strings
-- \subpage packing
-- \subpage schema
-- \subpage cursors
-- \subpage threads
-- \subpage processes
-- \subpage transactions
-- \subpage tuning
-- \subpage command_line
-- \subpage extending
+- @subpage basic_api
+- @subpage config_strings
+- @subpage packing
+- @subpage schema
+- @subpage cursors
+- @subpage threads
+- @subpage processes
+- @subpage transactions
+- @subpage tuning
+- @subpage command_line
+- @subpage extending
*/
diff --git a/docs/style/wiredtiger.css b/docs/style/wiredtiger.css
index 5c778fdc969..5d6c2362307 100644
--- a/docs/style/wiredtiger.css
+++ b/docs/style/wiredtiger.css
@@ -58,7 +58,8 @@ span.legend {
}
h3.version {
- font-size: 90%;
+ background: none;
+ font-size: 110%;
text-align: center;
}
diff --git a/examples/c/Makefile b/examples/c/Makefile
index f3c0e7de817..51c625ebbfe 100644
--- a/examples/c/Makefile
+++ b/examples/c/Makefile
@@ -2,7 +2,7 @@ CC = gcc -W -Wall -I../../include # -Wno-unused -x c++
OBJS = \
ex_access.o ex_call_center.o ex_config.o ex_cursor.o ex_extending.o \
ex_hello.o ex_pack.o ex_process.o ex_schema.o ex_sequence.o ex_stat.o \
- ex_thread.o ex_transaction.o
+ ex_thread.o ex_tpcb.o ex_transaction.o
all: $(OBJS)
diff --git a/examples/c/ex_access.c b/examples/c/ex_access.c
index 63f09581b7e..02b40e42d8d 100644
--- a/examples/c/ex_access.c
+++ b/examples/c/ex_access.c
@@ -1,5 +1,6 @@
/*
- * ex_access.c Copyright (c) 2010 WiredTiger, Inc. All rights reserved.
+ * ex_access.c
+ * Copyright (c) 2010 WiredTiger, Inc. All rights reserved.
*
* This is an example demonstrating how to create and access a simple table.
*/
@@ -32,8 +33,8 @@ int main()
&cursor);
/* Insert a record. */
- ret = cursor->set_key(cursor, "key1");
- ret = cursor->set_value(cursor, "value1");
+ cursor->set_key(cursor, "key1");
+ cursor->set_value(cursor, "value1");
ret = cursor->insert(cursor);
/* Show all records. */
diff --git a/examples/c/ex_call_center.c b/examples/c/ex_call_center.c
index 79afa2c91e2..7cd95ce3ecb 100644
--- a/examples/c/ex_call_center.c
+++ b/examples/c/ex_call_center.c
@@ -1,5 +1,6 @@
/*
- * ex_call_center.c Copyright (c) 2010 WiredTiger, Inc. All rights reserved.
+ * ex_call_center.c
+ * Copyright (c) 2010 WiredTiger, Inc. All rights reserved.
*
* This is an example application that demonstrates how to map a moderately
* complex SQL application into WiredTiger.
@@ -93,10 +94,9 @@ int main()
*/
ret = session->open_cursor(session,
"index:cust_phone(id,name)", NULL, &cursor);
- ret = cursor->set_key(cursor, "212-555-1000");
- ret = cursor->search(cursor, &exact);
- if (exact == 0)
- ret = cursor->get_value(cursor, &cust.id, &cust.name);
+ cursor->set_key(cursor, "212-555-1000");
+ ret = cursor->search(cursor);
+ ret = cursor->get_value(cursor, &cust.id, &cust.name);
printf("Got customer record for %s\n", cust.name);
ret = cursor->close(cursor, NULL);
@@ -121,11 +121,11 @@ int main()
* call date for a given cust_id. Search for (cust_id+1,0), then work
* backwards.
*/
- ret = cursor->set_key(cursor, cust.id + 1, 0);
- ret = cursor->search(cursor, &exact);
+ cursor->set_key(cursor, cust.id + 1, 0);
+ ret = cursor->search_near(cursor, &exact);
/*
- * If the table is empty, the search will return WT_NOTFOUND.
+ * If the table is empty, search_near will return WT_NOTFOUND.
* Otherwise the cursor will on a matching key if one exists, or on an
* adjacent key. If the key we find is equal or larger than the search
* key, go back one.
diff --git a/examples/c/ex_config.c b/examples/c/ex_config.c
index 9c4481e9ff5..b20c2fbcc21 100644
--- a/examples/c/ex_config.c
+++ b/examples/c/ex_config.c
@@ -1,5 +1,6 @@
/*
- * ex_config.c Copyright (c) 2010 WiredTiger, Inc. All rights reserved.
+ * ex_config.c
+ * Copyright (c) 2010 WiredTiger, Inc. All rights reserved.
*
* This is an example demonstrating how to configure various database and table
* properties.
@@ -28,9 +29,10 @@ int main()
ret = conn->open_session(conn, NULL, NULL, &session);
- session->create_table(session, "access", "key_format=S,value_format=S");
+ ret = session->create_table(session, "access",
+ "key_format=S,value_format=S");
- session->begin_transaction(session, "priority=100,name=mytxn");
+ ret = session->begin_transaction(session, "priority=100,name=mytxn");
ret = session->open_cursor(session, "config:", NULL, &cursor);
diff --git a/examples/c/ex_cursor.c b/examples/c/ex_cursor.c
index 5f4862a70e8..fbec9753025 100644
--- a/examples/c/ex_cursor.c
+++ b/examples/c/ex_cursor.c
@@ -1,5 +1,6 @@
/*
- * ex_cursor.c Copyright (c) 2010 WiredTiger, Inc. All rights reserved.
+ * ex_cursor.c
+ * Copyright (c) 2010 WiredTiger, Inc. All rights reserved.
*
* This is an example demonstrating some cursor types and operations.
*/
diff --git a/examples/c/ex_extending.c b/examples/c/ex_extending.c
index 280ac44122f..57fccc95cef 100644
--- a/examples/c/ex_extending.c
+++ b/examples/c/ex_extending.c
@@ -1,5 +1,6 @@
/*
- * ex_extending.c Copyright (c) 2010 WiredTiger, Inc. All rights reserved.
+ * ex_extending.c
+ * Copyright (c) 2010 WiredTiger, Inc. All rights reserved.
*
* This is an example demonstrating ways to extend WiredTiger with extractors,
* collators and loadable modules.
diff --git a/examples/c/ex_hello.c b/examples/c/ex_hello.c
index 0f35e290a40..dd4360483c2 100644
--- a/examples/c/ex_hello.c
+++ b/examples/c/ex_hello.c
@@ -1,5 +1,6 @@
/*
- * ex_hello.c Copyright (c) 2010 WiredTiger, Inc. All rights reserved.
+ * ex_hello.c
+ * Copyright (c) 2010 WiredTiger, Inc. All rights reserved.
*
* This is an example demonstrating how to create and connect to a database.
*/
diff --git a/examples/c/ex_pack.c b/examples/c/ex_pack.c
index 69c34c9496b..0c39848a8a8 100644
--- a/examples/c/ex_pack.c
+++ b/examples/c/ex_pack.c
@@ -1,7 +1,8 @@
/*
- * ex_pack.c Copyright (c) 2010 WiredTiger, Inc. All rights reserved.
+ * ex_pack.c
+ * Copyright (c) 2010 WiredTiger, Inc. All rights reserved.
*
- * This is an example demonstrating some basic packing and unpacking.
+ * This is an example demonstrating basic packing and unpacking of fields.
*/
#include name(column[\,...])[\,...]. Each column set is stored
- * separately\, keyed by the primary key of the table. Any column that
- * does not appear in a column set is stored in an unnamed default
- * column set for the table.}
- * \config{index,(multiple),List of the indices.
- * Comma-separated list of the form
- * name(column[\,...])[\,...]. Each index is keyed by the
- * specified columns.}
- * \configend
- * \errors
+ * @config{column_set,,List of the column sets. Comma-separated list
+ * of the form name(column[\,...])[\,...]. Each
+ * column set is stored separately\, keyed by the primary key of
+ * the table. Any column that does not appear in a column set is
+ * stored in an unnamed default column set for the table.}
+ * @config{index,,List of the indices. Comma-separated list of the
+ * form name(column[\,...])[\,...]. Each index is
+ * keyed by the specified columns.}
+ * @configend
+ * @errors
*/
int __F(add_schema)(WT_SESSION *session, const char *name,
const char *config);
/*! Create a table.
*
- * \param session the session handle
- * \param name the name of the table
- * \configstart
- * \config{exclusive,[no],Fail if the table exists (if "no"\, the
- * default\, verifies that the table exists and has the specified
- * schema.}
- * \config{key_format,["u"],The format of the data packed into key
- * items. See ::wiredtiger_struct_pack for details. If not set\, a
- * default value of "u" is assumed\, and applications use the WT_ITEM
- * struct to manipulate raw byte arrays.}
- * \config{value_format,["u"],The format of the data packed into value
- * items. See ::wiredtiger_struct_pack for details. If not set\, a
- * default value of "u" is assumed\, and applications use the WT_ITEM
- * struct to manipulate raw byte arrays.}
- * \config{columns,,Names of the columns in the schema\, comma separated.
- * The number of entries must match the total number of values in
- * #key_format and #value_format.}
- * \config{column_set,(multiple),List of the column sets.
- * Comma-separated list of the form
- * name(column[\,...])[\,...]. Each column set is stored
- * separately\, keyed by the primary key of the table. Any column that
- * does not appear in a column set is stored in an unnamed default
- * column set for the table.}
- * \config{index,(multiple),List of the indices.
- * Comma-separated list of the form
- * name(column[\,...])[\,...]. Each index is keyed by the
- * specified columns.}
- * \configend
- * \errors
+ * @param session the session handle
+ * @param name the name of the table
+ * @configstart
+ * @config{columns,,List of the column names.
+ * Comma-separated list of the form (column[\,...]).
+ * The number of entries must match the total number of values in
+ * #key_format and #value_format.}
+ * @config{column_set,,Named set of columns to store together.
+ * Name and comma-separated list of the form
+ * name(column[\,...]). Multiple column sets can
+ * be specified by repeating the \c "column_set" key in the
+ * configuration string. Each column set is stored separately\,
+ * keyed by the primary key of the table. Any column that does
+ * not appear in a column set is stored in an unnamed default
+ * column set for the table.}
+ * @config{exclusive,,Fail if the table exists (if "no"\, the
+ * default\, verifies that the table exists and has the specified
+ * schema.}
+ * @config{index,,Named index on a set of columns. Name and
+ * comma-separated list of the form
+ * name(column[\,...]). Multiple indices can be
+ * specified by repeating the \c "index" key in the configuration
+ * string.}
+ * @config{key_format,,The format of the data packed into key items.
+ * See ::wiredtiger_struct_pack for details. If not set\, a
+ * default value of \c "u" is assumed\, and applications use the
+ * WT_ITEM struct to manipulate raw byte arrays.}
+ * @config{value_format,,The format of the data packed into value
+ * items. See ::wiredtiger_struct_pack for details. If not set\,
+ * a default value of \c "u" is assumed\, and applications use the
+ * WT_ITEM struct to manipulate raw byte arrays.}
+ * @configend
+ * @errors
*/
int __F(create_table)(WT_SESSION *session, const char *name,
const char *config);
/*! Rename a table.
*
- * \param session the session handle
- * \param oldname the current name of the table
- * \param newname the new name of the table
- * \configempty
- * \errors
+ * @param session the session handle
+ * @param oldname the current name of the table
+ * @param newname the new name of the table
+ * @configempty
+ * @errors
*/
int __F(rename_table)(WT_SESSION *session,
const char *oldname, const char *newname, const char *config);
/*! Drop (delete) a table.
*
- * \param session the session handle
- * \param name the name of the table
- * \configempty
- * \errors
+ * @param session the session handle
+ * @param name the name of the table
+ * @configempty
+ * @errors
*/
int __F(drop_table)(WT_SESSION *session,
const char *name, const char *config);
/*! Truncate a table.
*
- * \param session the session handle
- * \param name the name of the table
- * \param start optional cursor marking the start of the truncate
+ * @param session the session handle
+ * @param name the name of the table
+ * @param start optional cursor marking the start of the truncate
* operation. If NULL, the truncate starts from the
* beginning of the table
- * \param end optional cursor marking the end of the truncate
+ * @param end optional cursor marking the end of the truncate
* operation. If NULL, the truncate continues to the end
* of the table
- * \param name the name of the table
- * \configempty
- * \errors
+ * @param name the name of the table
+ * @configempty
+ * @errors
*/
int __F(truncate_table)(WT_SESSION *session, const char *name,
WT_CURSOR *start, WT_CURSOR *end, const char *config);
/*! Verify a table.
*
- * \param session the session handle
- * \param name the name of the table
- * \configempty
- * \errors
+ * @param session the session handle
+ * @param name the name of the table
+ * @configempty
+ * @errors
*/
int __F(verify_table)(WT_SESSION *session, const char *name,
const char *config);
/*! @} */
- /*! \name Transactions
+ /*! @name Transactions
* @{
*/
/*! Start a transaction in this session.
@@ -417,18 +441,18 @@ struct WT_SESSION {
*
* Ignored if a transaction is in progress.
*
- * \param session the session handle
- * \configstart
- * \config{isolation,"serializable" or ["snapshot"]
- * orNULL, the
+ * @param connection the connection handle
+ * @param errhandler An error handler. If NULL, the
* connection's error handler is used
- * \configempty
- * \param sessionp the new session handle
- * \errors
+ * @configempty
+ * @param sessionp the new session handle
+ * @errors
*/
int __F(open_session)(WT_CONNECTION *connection,
WT_ERROR_HANDLER *errhandler, const char *config,
@@ -582,21 +608,23 @@ struct WT_CONNECTION {
/*! Open a connection to a database.
*
- * \param home The path to the database home directory
- * \param errhandler An error handler. If NULL, a builtin error
+ * @param home The path to the database home directory
+ * @param errhandler An error handler. If NULL, a builtin error
* handler is installed that writes error messages to stderr
- * \configstart
- * \config{create,["0"] or "1",create the database if it does not exist}
- * \config{exclusive,["0"] or "1",fail if the database already exists}
- * \config{sharing,["0"] or "1",permit sharing between processes (will
+ * @configstart
+ * @config{create,,create the database if it does not exist}
+ * @config{exclusive,,fail if the database already exists}
+ * @config{error_prefix,,Prefix string for error messages}
+ * @config{multiprocess,,permit sharing between processes (will
* automatically start an RPC server for primary processes and use RPC for
* secondary processes)}
- * \config{cache_size,["1000000"],maximum heap memory to allocate for the cache}
- * \config{max_threads,["100"],maximum expected number of threads (including
- * RPC client threads)}
- * \configend
- * \param connectionp A pointer to the newly opened connection handle
- * \errors
+ * @config{cachesize,,maximum heap memory to allocate for the cache;
+ * default \c "10MB"}
+ * @config{max_threads,,maximum expected number of threads (including
+ * server threads)}
+ * @configend
+ * @param connectionp A pointer to the newly opened connection handle
+ * @errors
*/
int wiredtiger_open(const char *home,
WT_ERROR_HANDLER *errhandler, const char *config,
@@ -604,20 +632,11 @@ int wiredtiger_open(const char *home,
/*! Get information about an error as a string.
*
- * \param err a return value from a WiredTiger call
- * \returns a string representation of the error
+ * @param err a return value from a WiredTiger call
+ * @returns a string representation of the error
*/
const char *wiredtiger_strerror(int err);
-/*! Get version information.
- *
- * \param majorp a location where the major version number is returned
- * \param minorp a location where the minor version number is returned
- * \param patchp a location where the patch version number is returned
- * \returns a string representation of the version
- */
-const char *wiredtiger_version(int *majorp, int *minorp, int *patchp);
-
/*! Pack a structure into a buffer.
*
* Uses format strings mostly as specified in the Python struct module:
@@ -672,31 +691,31 @@ const char *wiredtiger_version(int *majorp, int *minorp, int *patchp);
* appears within a format string, the size is stored as a 32-bit integer in
* the same byte order as the rest of the format string, followed by the data.
*
- * \section pack_examples Packing Examples
+ * @section pack_examples Packing Examples
*
* For example, the string "iSh" will pack a 32-bit integer
* followed by a NUL-terminated string, followed by a 16-bit integer. The
* default, big-endian encoding will be used, with no alignment. This could
* be used in C as follows:
*
- * \code
+ * @code
* char buf[100];
* ret = wiredtiger_struct_pack(buf, sizeof (buf), "iSh", 42, "hello", -3);
- * \endcode
+ * @endcode
*
* Then later, the values can be unpacked as follows:
*
- * \code
+ * @code
* int i;
* char *s;
* short h;
* ret = wiredtiger_struct_unpack(buf, sizeof (buf), "iSh", &i, &s, &h);
- * \endcode
+ * @endcode
*
- * \param buffer a pointer to a packed byte array
- * \param size the number of valid bytes in the buffer
- * \param format the data format, see ::wiredtiger_struct_pack
- * \errors
+ * @param buffer a pointer to a packed byte array
+ * @param size the number of valid bytes in the buffer
+ * @param format the data format, see ::wiredtiger_struct_pack
+ * @errors
*/
int wiredtiger_struct_pack(void *buffer, size_t size, const char *format, ...);
@@ -704,11 +723,11 @@ int wiredtiger_struct_pack(void *buffer, size_t size, const char *format, ...);
*
* stdarg version of ::wiredtiger_struct_pack.
*
- * \param buffer a pointer to a packed byte array
- * \param size the number of valid bytes in the buffer
- * \param format the data format, see ::wiredtiger_struct_pack
- * \param ap the list of values to pack
- * \errors
+ * @param buffer a pointer to a packed byte array
+ * @param size the number of valid bytes in the buffer
+ * @param format the data format, see ::wiredtiger_struct_pack
+ * @param ap the list of values to pack
+ * @errors
*/
int wiredtiger_struct_packv(void *buffer, size_t size,
const char *format, va_list ap);
@@ -719,8 +738,8 @@ int wiredtiger_struct_packv(void *buffer, size_t size,
* integers, the calculated sized merely reflects the expected sizes specified
* in the format string itself.
*
- * \param format the data format, see ::wiredtiger_struct_pack
- * \returns the number of bytes needed for the matching call to
+ * @param format the data format, see ::wiredtiger_struct_pack
+ * @returns the number of bytes needed for the matching call to
* ::wiredtiger_struct_pack
*/
size_t wiredtiger_struct_size(const char *format, ...);
@@ -729,9 +748,9 @@ size_t wiredtiger_struct_size(const char *format, ...);
*
* stdarg version of ::wiredtiger_struct_size.
*
- * \param format the data format, see ::wiredtiger_struct_pack
- * \param ap the list of values to be packed
- * \returns the number of bytes needed for the matching call to
+ * @param format the data format, see ::wiredtiger_struct_pack
+ * @param ap the list of values to be packed
+ * @returns the number of bytes needed for the matching call to
* ::wiredtiger_struct_pack
*/
size_t wiredtiger_struct_sizev(const char *format, va_list ap);
@@ -740,10 +759,10 @@ size_t wiredtiger_struct_sizev(const char *format, va_list ap);
*
* Reverse of ::wiredtiger_struct_pack: gets values out of a packed byte string.
*
- * \param buffer a pointer to a packed byte array
- * \param size the number of valid bytes in the buffer
- * \param format the data format, see ::wiredtiger_struct_pack
- * \errors
+ * @param buffer a pointer to a packed byte array
+ * @param size the number of valid bytes in the buffer
+ * @param format the data format, see ::wiredtiger_struct_pack
+ * @errors
*/
int wiredtiger_struct_unpack(const void *buffer, size_t size,
const char *format, ...);
@@ -752,23 +771,23 @@ int wiredtiger_struct_unpack(const void *buffer, size_t size,
*
* stdarg version of ::wiredtiger_struct_unpack.
*
- * \param buffer a pointer to a packed byte array
- * \param size the number of valid bytes in the buffer
- * \param format the data format, see ::wiredtiger_struct_pack
- * \param ap the list of locations where values are unpacked
- * \errors
+ * @param buffer a pointer to a packed byte array
+ * @param size the number of valid bytes in the buffer
+ * @param format the data format, see ::wiredtiger_struct_pack
+ * @param ap the list of locations where values are unpacked
+ * @errors
*/
int wiredtiger_struct_unpackv(const void *buffer, size_t size,
const char *format, va_list ap);
-/*! Entry point to an extension, implemented by loadable modules.
+/*! Get version information.
*
- * \param connection the connection handle
- * \configempty
- * \errors
+ * @param majorp a location where the major version number is returned
+ * @param minorp a location where the minor version number is returned
+ * @param patchp a location where the patch version number is returned
+ * @returns a string representation of the version
*/
-extern int wiredtiger_extension_init(WT_CONNECTION *connection,
- const char *config);
+const char *wiredtiger_version(int *majorp, int *minorp, int *patchp);
/*! Concurrent operations caused a deadlock, a transaction must rollback. */
#define WT_DEADLOCK (-10000)
@@ -781,83 +800,6 @@ extern int wiredtiger_extension_init(WT_CONNECTION *connection,
/*! Concurrent operations caused a conflict, a transaction must rollback. */
#define WT_UPDATE_CONFLICT (-10002)
-/*!
- * Applications can extend WiredTiger by providing new implementation of the
- * WT_CURSOR interface. This is done by implementing the WT_CURSOR_FACTORY
- * interface, then calling WT_CONNECTION#add_cursor_factory.
- *
- * Thread safety: WiredTiger may invoke methods on the WT_CURSOR_FACTORY
- * interface from multiple threads concurrently. It is the responsibility of
- * the implementation to protect any shared data.
- */
-struct WT_CURSOR_FACTORY {
- /*! Callback to determine how much space to allocate for a cursor.
- *
- * If the callback is NULL, no additional space is allocated in the
- * WT_CURSOR implementation.
- *
- * \errors
- */
- int (*cursor_size)(WT_CURSOR_FACTORY *factory,
- const char *obj, size_t *sizep);
-
- /*! Callback to initialize a cursor. */
- int (*init_cursor)(WT_CURSOR_FACTORY *factory,
- WT_SESSION *session, const char *obj, WT_CURSOR *cursor);
-
- /*! Callback to duplicate a cursor.
- *
- * \errors
- */
- int (*dup_cursor)(WT_CURSOR_FACTORY *factory,
- WT_SESSION *session, WT_CURSOR *old_cursor, WT_CURSOR *new_cursor);
-};
-
-/*!
- * The interface implemented by applications to provide custom ordering of
- * records.
- */
-struct WT_COLLATOR {
- /*! Callback to compare keys or order duplicate values.
- *
- * \returns -1 if value1 < value2,
- * 0 if value1 == value2,
- * 1 if value1 > value2.
- */
- int (*compare)(WT_SESSION *session, WT_COLLATOR *collator,
- const WT_ITEM *value1, const WT_ITEM *value2);
-};
-
-/*!
- * The interface implemented by applications in order to handle errors.
- */
-struct WT_ERROR_HANDLER {
- /*! Callback to handle errors within the session. */
- int (*handle_error)(WT_ERROR_HANDLER *handler,
- int err, const char *errmsg);
-
- /*! Optional callback to retrieve buffered messages. */
- int (*get_messages)(WT_ERROR_HANDLER *handler, const char **errmsgp);
-
- /*! Optional callback to clear buffered messages. */
- int (*clear_messages)(WT_ERROR_HANDLER *handler);
-};
-
-/*!
- * The interface implemented by applications to provide custom extraction of
- * index keys or column set values.
- */
-struct WT_EXTRACTOR {
- /*! Callback to extract a value for an index or column set.
- *
- * \errors
- */
- int (*extract)(WT_SESSION *session, WT_EXTRACTOR *extractor,
- const WT_ITEM *key, const WT_ITEM *value, WT_ITEM *result);
-};
-
-/*! @} */
-
#ifdef __cplusplus
}
#endif
diff --git a/include/wiredtiger_ext.h b/include/wiredtiger_ext.h
new file mode 100644
index 00000000000..33acaec0164
--- /dev/null
+++ b/include/wiredtiger_ext.h
@@ -0,0 +1,106 @@
+/* Copyright (c) 2010 WiredTiger, Inc. All rights reserved. */
+
+/* vim: set filetype=c.doxygen : */
+
+#ifndef _WIREDTIGER_EXT_H_
+#define _WIREDTIGER_EXT_H_
+
+/*! @file wiredtiger_ext.h
+ * Interfaces applications use to extend WiredTiger.
+ */
+
+#include "wiredtiger.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+ * The interface implemented by applications to provide custom ordering of
+ * records.
+ */
+struct WT_COLLATOR {
+ /*! Callback to compare keys or order duplicate values.
+ *
+ * @returns -1 if value1 < value2,
+ * 0 if value1 == value2,
+ * 1 if value1 > value2.
+ */
+ int (*compare)(WT_SESSION *session, WT_COLLATOR *collator,
+ const WT_ITEM *value1, const WT_ITEM *value2);
+};
+
+/*!
+ * Applications can extend WiredTiger by providing new implementation of the
+ * WT_CURSOR class. This is done by implementing the WT_CURSOR_FACTORY
+ * interface, then calling WT_CONNECTION#add_cursor_factory.
+ *
+ * Thread safety: WiredTiger may invoke methods on the WT_CURSOR_FACTORY
+ * interface from multiple threads concurrently. It is the responsibility of
+ * the implementation to protect any shared data.
+ */
+struct WT_CURSOR_FACTORY {
+ /*! Callback to determine how much space to allocate for a cursor.
+ *
+ * If the callback is NULL, no additional space is allocated in the
+ * WT_CURSOR implementation.
+ *
+ * @errors
+ */
+ int (*cursor_size)(WT_CURSOR_FACTORY *factory,
+ const char *obj, size_t *sizep);
+
+ /*! Callback to initialize a cursor. */
+ int (*init_cursor)(WT_CURSOR_FACTORY *factory,
+ WT_SESSION *session, const char *obj, WT_CURSOR *cursor);
+
+ /*! Callback to duplicate a cursor.
+ *
+ * @errors
+ */
+ int (*dup_cursor)(WT_CURSOR_FACTORY *factory,
+ WT_SESSION *session, WT_CURSOR *old_cursor, WT_CURSOR *new_cursor);
+};
+
+/*!
+ * The interface implemented by applications in order to handle errors.
+ */
+struct WT_ERROR_HANDLER {
+ /*! Callback to handle errors within the session. */
+ int (*handle_error)(WT_ERROR_HANDLER *handler,
+ int err, const char *errmsg);
+
+ /*! Optional callback to retrieve buffered messages. */
+ int (*get_messages)(WT_ERROR_HANDLER *handler, const char **errmsgp);
+
+ /*! Optional callback to clear buffered messages. */
+ int (*clear_messages)(WT_ERROR_HANDLER *handler);
+};
+
+/*!
+ * The interface implemented by applications to provide custom extraction of
+ * index keys or column set values.
+ */
+struct WT_EXTRACTOR {
+ /*! Callback to extract a value for an index or column set.
+ *
+ * @errors
+ */
+ int (*extract)(WT_SESSION *session, WT_EXTRACTOR *extractor,
+ const WT_ITEM *key, const WT_ITEM *value, WT_ITEM *result);
+};
+
+/*! Entry point to an extension, implemented by loadable modules.
+ *
+ * @param connection the connection handle
+ * @configempty
+ * @errors
+ */
+extern int wiredtiger_extension_init(WT_CONNECTION *connection,
+ const char *config);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WIREDTIGER_EXT_H_ */
diff --git a/lang/python/src/wiredtiger/service/WiredTiger-remote b/lang/python/src/wiredtiger/service/WiredTiger-remote
index 89abfd6f709..0885c3f4c3e 100755
--- a/lang/python/src/wiredtiger/service/WiredTiger-remote
+++ b/lang/python/src/wiredtiger/service/WiredTiger-remote
@@ -44,10 +44,12 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':
print ' WT_MOVE_RESULT move_next(WT_HANDLE cursor)'
print ' WT_MOVE_RESULT move_prev(WT_HANDLE cursor)'
print ' WT_MOVE_RESULT search(WT_HANDLE cursor, WT_RECORD record)'
+ print ' WT_MOVE_RESULT search_near(WT_HANDLE cursor, WT_RECORD record)'
print ' string insert_record(WT_HANDLE cursor, WT_RECORD record)'
print ' void update_record(WT_HANDLE cursor, string value)'
print ' void delete_record(WT_HANDLE cursor)'
print ' void close_cursor(WT_HANDLE cursor, string config)'
+ print ' void configure_cursor(WT_HANDLE cursor, string config)'
print ''
sys.exit(0)
@@ -236,6 +238,12 @@ elif cmd == 'search':
sys.exit(1)
pp.pprint(client.search(eval(args[0]),eval(args[1]),))
+elif cmd == 'search_near':
+ if len(args) != 2:
+ print 'search_near requires 2 args'
+ sys.exit(1)
+ pp.pprint(client.search_near(eval(args[0]),eval(args[1]),))
+
elif cmd == 'insert_record':
if len(args) != 2:
print 'insert_record requires 2 args'
@@ -260,6 +268,12 @@ elif cmd == 'close_cursor':
sys.exit(1)
pp.pprint(client.close_cursor(eval(args[0]),args[1],))
+elif cmd == 'configure_cursor':
+ if len(args) != 2:
+ print 'configure_cursor requires 2 args'
+ sys.exit(1)
+ pp.pprint(client.configure_cursor(eval(args[0]),args[1],))
+
else:
print 'Unrecognized method %s' % cmd
sys.exit(1)
diff --git a/lang/python/src/wiredtiger/service/WiredTiger.py b/lang/python/src/wiredtiger/service/WiredTiger.py
index c275b69123b..26984ab1178 100644
--- a/lang/python/src/wiredtiger/service/WiredTiger.py
+++ b/lang/python/src/wiredtiger/service/WiredTiger.py
@@ -197,6 +197,14 @@ class Iface:
"""
pass
+ def search_near(self, cursor, record):
+ """
+ Parameters:
+ - cursor
+ - record
+ """
+ pass
+
def insert_record(self, cursor, record):
"""
Parameters:
@@ -228,6 +236,14 @@ class Iface:
"""
pass
+ def configure_cursor(self, cursor, config):
+ """
+ Parameters:
+ - cursor
+ - config
+ """
+ pass
+
class Client(Iface):
def __init__(self, iprot, oprot=None):
@@ -987,6 +1003,40 @@ class Client(Iface):
raise result.err
raise TApplicationException(TApplicationException.MISSING_RESULT, "search failed: unknown result");
+ def search_near(self, cursor, record):
+ """
+ Parameters:
+ - cursor
+ - record
+ """
+ self.send_search_near(cursor, record)
+ return self.recv_search_near()
+
+ def send_search_near(self, cursor, record):
+ self._oprot.writeMessageBegin('search_near', TMessageType.CALL, self._seqid)
+ args = search_near_args()
+ args.cursor = cursor
+ args.record = record
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_search_near(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = search_near_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.success != None:
+ return result.success
+ if result.err != None:
+ raise result.err
+ raise TApplicationException(TApplicationException.MISSING_RESULT, "search_near failed: unknown result");
+
def insert_record(self, cursor, record):
"""
Parameters:
@@ -1115,6 +1165,38 @@ class Client(Iface):
raise result.err
return
+ def configure_cursor(self, cursor, config):
+ """
+ Parameters:
+ - cursor
+ - config
+ """
+ self.send_configure_cursor(cursor, config)
+ self.recv_configure_cursor()
+
+ def send_configure_cursor(self, cursor, config):
+ self._oprot.writeMessageBegin('configure_cursor', TMessageType.CALL, self._seqid)
+ args = configure_cursor_args()
+ args.cursor = cursor
+ args.config = config
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_configure_cursor(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = configure_cursor_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.err != None:
+ raise result.err
+ return
+
class Processor(Iface, TProcessor):
def __init__(self, handler):
@@ -1143,10 +1225,12 @@ class Processor(Iface, TProcessor):
self._processMap["move_next"] = Processor.process_move_next
self._processMap["move_prev"] = Processor.process_move_prev
self._processMap["search"] = Processor.process_search
+ self._processMap["search_near"] = Processor.process_search_near
self._processMap["insert_record"] = Processor.process_insert_record
self._processMap["update_record"] = Processor.process_update_record
self._processMap["delete_record"] = Processor.process_delete_record
self._processMap["close_cursor"] = Processor.process_close_cursor
+ self._processMap["configure_cursor"] = Processor.process_configure_cursor
def process(self, iprot, oprot):
(name, type, seqid) = iprot.readMessageBegin()
@@ -1476,6 +1560,20 @@ class Processor(Iface, TProcessor):
oprot.writeMessageEnd()
oprot.trans.flush()
+ def process_search_near(self, seqid, iprot, oprot):
+ args = search_near_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = search_near_result()
+ try:
+ result.success = self._handler.search_near(args.cursor, args.record)
+ except WT_ERROR, err:
+ result.err = err
+ oprot.writeMessageBegin("search_near", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
def process_insert_record(self, seqid, iprot, oprot):
args = insert_record_args()
args.read(iprot)
@@ -1532,6 +1630,20 @@ class Processor(Iface, TProcessor):
oprot.writeMessageEnd()
oprot.trans.flush()
+ def process_configure_cursor(self, seqid, iprot, oprot):
+ args = configure_cursor_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = configure_cursor_result()
+ try:
+ self._handler.configure_cursor(args.cursor, args.config)
+ except WT_ERROR, err:
+ result.err = err
+ oprot.writeMessageBegin("configure_cursor", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
# HELPER FUNCTIONS AND STRUCTURES
@@ -4644,6 +4756,150 @@ class search_result:
def __ne__(self, other):
return not (self == other)
+class search_near_args:
+ """
+ Attributes:
+ - cursor
+ - record
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.I32, 'cursor', None, None, ), # 1
+ (2, TType.STRUCT, 'record', (WT_RECORD, WT_RECORD.thrift_spec), None, ), # 2
+ )
+
+ def __init__(self, cursor=None, record=None,):
+ self.cursor = cursor
+ self.record = record
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.I32:
+ self.cursor = iprot.readI32();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRUCT:
+ self.record = WT_RECORD()
+ self.record.read(iprot)
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('search_near_args')
+ if self.cursor != None:
+ oprot.writeFieldBegin('cursor', TType.I32, 1)
+ oprot.writeI32(self.cursor)
+ oprot.writeFieldEnd()
+ if self.record != None:
+ oprot.writeFieldBegin('record', TType.STRUCT, 2)
+ self.record.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+ def validate(self):
+ return
+
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class search_near_result:
+ """
+ Attributes:
+ - success
+ - err
+ """
+
+ thrift_spec = (
+ (0, TType.STRUCT, 'success', (WT_MOVE_RESULT, WT_MOVE_RESULT.thrift_spec), None, ), # 0
+ (1, TType.STRUCT, 'err', (WT_ERROR, WT_ERROR.thrift_spec), None, ), # 1
+ )
+
+ def __init__(self, success=None, err=None,):
+ self.success = success
+ self.err = err
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 0:
+ if ftype == TType.STRUCT:
+ self.success = WT_MOVE_RESULT()
+ self.success.read(iprot)
+ else:
+ iprot.skip(ftype)
+ elif fid == 1:
+ if ftype == TType.STRUCT:
+ self.err = WT_ERROR()
+ self.err.read(iprot)
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('search_near_result')
+ if self.success != None:
+ oprot.writeFieldBegin('success', TType.STRUCT, 0)
+ self.success.write(oprot)
+ oprot.writeFieldEnd()
+ if self.err != None:
+ oprot.writeFieldBegin('err', TType.STRUCT, 1)
+ self.err.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+ def validate(self):
+ return
+
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
class insert_record_args:
"""
Attributes:
@@ -5157,6 +5413,137 @@ class close_cursor_result:
return
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class configure_cursor_args:
+ """
+ Attributes:
+ - cursor
+ - config
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.I32, 'cursor', None, None, ), # 1
+ (2, TType.STRING, 'config', None, None, ), # 2
+ )
+
+ def __init__(self, cursor=None, config=None,):
+ self.cursor = cursor
+ self.config = config
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.I32:
+ self.cursor = iprot.readI32();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.config = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('configure_cursor_args')
+ if self.cursor != None:
+ oprot.writeFieldBegin('cursor', TType.I32, 1)
+ oprot.writeI32(self.cursor)
+ oprot.writeFieldEnd()
+ if self.config != None:
+ oprot.writeFieldBegin('config', TType.STRING, 2)
+ oprot.writeString(self.config)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+ def validate(self):
+ return
+
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class configure_cursor_result:
+ """
+ Attributes:
+ - err
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRUCT, 'err', (WT_ERROR, WT_ERROR.thrift_spec), None, ), # 1
+ )
+
+ def __init__(self, err=None,):
+ self.err = err
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRUCT:
+ self.err = WT_ERROR()
+ self.err.read(iprot)
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('configure_cursor_result')
+ if self.err != None:
+ oprot.writeFieldBegin('err', TType.STRUCT, 1)
+ self.err.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+ def validate(self):
+ return
+
+
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
diff --git a/src/api/api.c b/src/api/api.c
index 1c405726738..6eae2e8c61d 100644
--- a/src/api/api.c
+++ b/src/api/api.c
@@ -32,7 +32,15 @@ __cursor_prev(WT_CURSOR *cursor)
}
static int
-__cursor_search(WT_CURSOR *cursor, int *exact)
+__cursor_search(WT_CURSOR *cursor)
+{
+ int exact;
+ return (cursor->search_near(cursor, &exact) ||
+ (exact != 0 ? WT_NOTFOUND : 0));
+}
+
+static int
+__cursor_search_near(WT_CURSOR *cursor, int *exact)
{
return (ENOTSUP);
}
@@ -64,6 +72,12 @@ __cursor_close(WT_CURSOR *cursor, const char *config)
return (0);
}
+static int
+__cursor_configure(WT_CURSOR *cursor, const char *config)
+{
+ return (ENOTSUP);
+}
+
static int
__session_close(WT_SESSION *session, const char *config)
{
@@ -88,10 +102,12 @@ __session_open_cursor(WT_SESSION *session, const char *uri, const char *config,
__cursor_next,
__cursor_prev,
__cursor_search,
+ __cursor_search_near,
__cursor_insert,
__cursor_update,
__cursor_del,
__cursor_close,
+ __cursor_configure,
};
WT_CURSOR_STD *cstd = (WT_CURSOR_STD *)malloc(sizeof(WT_CURSOR_STD));
WT_CURSOR *c = &cstd->interface;
diff --git a/src/api/cur_std.c b/src/api/cur_std.c
index e8339d3eeb1..2800843bab6 100644
--- a/src/api/cur_std.c
+++ b/src/api/cur_std.c
@@ -33,13 +33,13 @@ __curstd_get_value(WT_CURSOR *cursor, ...)
F_ISSET(stdc, WT_CURSTD_RAW) ? "u" : cursor->value_format, ap);
}
-static int
+static void
__curstd_set_key(WT_CURSOR *cursor, ...)
{
WT_CURSOR_STD *stdc = (WT_CURSOR_STD *)cursor;
+ va_list ap;
const char *fmt;
size_t sz;
- va_list ap;
va_start(ap, cursor);
fmt = F_ISSET(stdc, WT_CURSTD_RAW) ? "u" : cursor->key_format;
@@ -52,10 +52,11 @@ __curstd_set_key(WT_CURSOR *cursor, ...)
}
stdc->key.data = stdc->keybuf;
stdc->key.size = sz;
- return wiredtiger_struct_packv(stdc->keybuf, sz, fmt, ap);
+ if (wiredtiger_struct_packv(stdc->keybuf, sz, fmt, ap) == 0)
+ stdc->flags &= ~WT_CURSTD_BADKEY;
}
-static int
+static void
__curstd_set_value(WT_CURSOR *cursor, ...)
{
WT_CURSOR_STD *stdc = (WT_CURSOR_STD *)cursor;
@@ -74,7 +75,8 @@ __curstd_set_value(WT_CURSOR *cursor, ...)
}
stdc->value.data = stdc->valuebuf;
stdc->value.size = sz;
- return wiredtiger_struct_packv(stdc->valuebuf, sz, fmt, ap);
+ if (wiredtiger_struct_packv(stdc->valuebuf, sz, fmt, ap) == 0)
+ stdc->flags &= ~WT_CURSTD_BADVALUE;
}
void
@@ -91,6 +93,8 @@ __wt_curstd_init(WT_CURSOR_STD *stdc)
stdc->keybufsz = 0;
stdc->value.data = stdc->valuebuf = NULL;
stdc->valuebufsz = 0;
+
+ stdc->flags = WT_CURSTD_BADKEY | WT_CURSTD_BADVALUE;
}
void
diff --git a/src/bdb/bdb.cpp b/src/bdb/bdb.cpp
index 8175c48e92d..3e480c2d080 100644
--- a/src/bdb/bdb.cpp
+++ b/src/bdb/bdb.cpp
@@ -36,7 +36,15 @@ __cursor_prev(WT_CURSOR *cursor)
}
static int
-__cursor_search(WT_CURSOR *cursor, int *exact)
+__cursor_search(WT_CURSOR *cursor)
+{
+ int exact;
+ return (cursor->search_near(cursor, &exact) ||
+ (exact != 0 ? WT_NOTFOUND : 0));
+}
+
+static int
+__cursor_search_near(WT_CURSOR *cursor, int *exact)
{
return ENOTSUP;
}
@@ -66,6 +74,12 @@ __cursor_close(WT_CURSOR *cursor, const char *config)
return 0;
}
+static int
+__cursor_configure(WT_CURSOR *cursor, const char *config)
+{
+ return ENOTSUP;
+}
+
static int
__session_close(WT_SESSION *session, const char *config)
{
@@ -90,10 +104,12 @@ __session_open_cursor(WT_SESSION *session, const char *uri, const char *config,
__cursor_next,
__cursor_prev,
__cursor_search,
+ __cursor_search_near,
__cursor_insert,
__cursor_update,
__cursor_del,
__cursor_close,
+ __cursor_configure,
};
WT_CURSOR_STD *cstd = (WT_CURSOR_STD *)malloc(sizeof(WT_CURSOR_STD));
WT_CURSOR *c = &cstd->interface;