diff --git a/docs/Doxyfile b/docs/Doxyfile index 689cc51ec70..39d520aeeae 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -25,13 +25,13 @@ DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. -PROJECT_NAME = "WiredTiger Data Store API" +PROJECT_NAME = WiredTiger # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 1.0 +PROJECT_NUMBER = "Version 1.0" # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. @@ -139,7 +139,7 @@ STRIP_FROM_INC_PATH = ../include/ # (but less readable) file names. This can be useful if your file system # doesn't support long names like on DOS, Mac, or CD-ROM. -SHORT_NAMES = YES +SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style @@ -201,14 +201,14 @@ ALIASES = configend= \ # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. -OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. -OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_OUTPUT_JAVA = YES # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for @@ -508,7 +508,7 @@ SHOW_DIRECTORIES = NO # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. -SHOW_FILES = NO +SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. This will remove the Namespaces entry from the Quick Index @@ -596,6 +596,7 @@ WARN_LOGFILE = doxygen.log # with spaces. INPUT = ../include/wiredtiger.h \ + ../include/wiredtiger_ext.h \ src # This tag can be used to specify the character encoding of the source files @@ -770,7 +771,7 @@ REFERENCES_RELATION = NO # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. Otherwise they will link to the documentation. -REFERENCES_LINK_SOURCE = YES +REFERENCES_LINK_SOURCE = NO # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen @@ -1226,7 +1227,7 @@ LATEX_HIDE_INDICES = YES # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. -LATEX_SOURCE_CODE = NO +LATEX_SOURCE_CODE = YES #--------------------------------------------------------------------------- # configuration options related to the RTF output diff --git a/docs/images/architecture.pdf b/docs/images/architecture.pdf index b69f2118e45..ff97ddff2b4 100644 Binary files a/docs/images/architecture.pdf and b/docs/images/architecture.pdf differ diff --git a/docs/images/architecture.png b/docs/images/architecture.png index 28ee8633c05..c5b72bc05e0 100644 Binary files a/docs/images/architecture.png and b/docs/images/architecture.png differ diff --git a/docs/src/architecture.dox b/docs/src/architecture.dox index 35b3c7e6003..3c65a818952 100644 --- a/docs/src/architecture.dox +++ b/docs/src/architecture.dox @@ -1,11 +1,12 @@ /* vim: set filetype=c.doxygen : */ -/*! \page architecture WiredTiger Architecture -\image html architecture.png -\image latex architecture.pdf "WiredTiger Architecture" height=12cm +/*! @page architecture WiredTiger Architecture + +@image html architecture.png +@image latex architecture.pdf "WiredTiger Architecture" height=12cm For more details about the WiredTiger architecture, see: -- \subpage design -- \subpage layout +- @subpage design +- @subpage filetypes */ diff --git a/docs/src/basic-api.dox b/docs/src/basic-api.dox index 15930f0e11a..6fb2b949df9 100644 --- a/docs/src/basic-api.dox +++ b/docs/src/basic-api.dox @@ -1,62 +1,81 @@ /* vim: set filetype=c.doxygen : */ -/*! \page basic_api Getting Started with the API +/*! @page basic_api Getting Started with the API -\dontinclude ex_access.c +WiredTiger applications will generally use the following classes to access and manage data: -All applications that use WiredTiger will be structured roughly as follows. The code below is taken from the complete example program \ex_ref{ex_access.c}. + - a WT_CONNECTION represents a connection to a database. Most applications + will only open one connection to a database for each process. The first + process to open a connection to a database will access the database in its + own address space. Subsequent connections (if allowed) will communicate + with the first process over a socket connection to perform their + operations. -\section basic_connection Connecting to a database + - a WT_SESSION represents a context in which database operations are + performed. Sessions are opened on a specified connection, and applications + must open a single session for each thread accessing the database. + + - a WT_CURSOR represents a cursor over a collection of data. Cursors are + opened in the context of a session (which may have an associated + transaction), and can query and update records. In the common case, a + cursor is used to access records in a table. However, cursors can be used + on subsets of tables (such as a single column or a projection of multiple + columns), as an interface to statistics, configuration data or + application-specific data sources. + +Handles and operations are configured using strings, which keeps the set of methods in the API relatively small and makes the interface very similar regardless of the programming language used in the application. WiredTiger supports the C, C++, Java and Python programming languages (among others). + +@dontinclude ex_access.c + +All applications that use WiredTiger will be structured roughly as follows. The code below is taken from the complete example program @ex_ref{ex_access.c}. + +@section basic_connection Connecting to a database To access a database, first open a connection with the following code: -\skip main -\until wiredtiger_open +@skip main +@until Note -Here the configuration string \c "create" is passed to ::wiredtiger_open to indicate that the database should be created if it does not exist when the program starts running. +Here the configuration string @c "create" is passed to ::wiredtiger_open to indicate that the database should be created if it does not already exist. -\section basic_session Opening a Session +Next we open a session handle for the single thread accessing the database. -Next we open a session handle for the single thread accessing the database: +The code block above also shows simple error handling with wiredtiger_strerror (a function that returns a string describing an error code passed as its argument). More complex error handling can be configured by passing an implementation of WT_ERROR_HANDLER to wiredtiger_open or WT_CONNECTION::open_session. -\until Note - -The code block above also shows simple error handling with ::wiredtiger_strerror. The default behavior for more detailed errors is to write them to \c stderr. That can be overridden by passing an implementation of WT_ERROR_HANDLER to ::wiredtiger_open or WT_CONNECTION::open_session. - -\section basic_create_table Creating a Table +@section basic_create_table Creating a Table If the database was created by the ::wiredtiger_open call above, it will be empty. We now create a table that we can use to store data: -\until ; +@until ; -This call creates a table called \c "access", configured to use strings for its key and value columns. We go into more details about what is possible later in the section on \ref schema. +This call creates a table called @c "access", configured to use strings for its key and value columns. We go into more details about what is possible later in the section on @ref schema. -\section basic_cursors Accessing Data With Cursors +@section basic_cursors Accessing Data With Cursors Now that we're sure we have a table, we open a cursor to perform some operations on it: -\until insert +@until insert -Here, the string \c "table:access" specifies that we are opening the cursor on the table named \c "access" that we created above. +Here, the string @c "table:access" specifies that we are opening the cursor on the table named @c "access" that we created above. -The WT_CURSOR::set_key and WT_CURSOR::set_value calls marshal the application's data into the cursor. The WT_CURSOR::insert call then creates a record containing that data and inserts it into the table. +The WT_CURSOR::set_key and WT_CURSOR::set_value calls put the application's data into the cursor. The WT_CURSOR::insert call creates a record containing that data and inserts it into the table. Now we iterate through all of the records in the table, printing them out as we go: -\until } +@until } Note that the key and value parts of the records are returned as C strings because the table was created that way (even if it was created by a previous run of the example). No extracting or converting of needs to be done in the application. -If we weren't using the cursor for the call to WT_CURSOR::insert above, this loop would simplify to: +Because the cursor was positioned in the table after the WT_CURSOR::insert call, we had to re-position it using the WT_CURSOR::first call; if we weren't using the cursor for the call to WT_CURSOR::insert above, this loop would simplify to: -\code +@code while ((ret = cursor->next(cursor)) == 0) { ... } -\endcode +@endcode -\section basic_close Closing Handles +@section basic_close Closing Handles Lastly, we close the connection, which implicitly closes the cursor and session handles: -\skipline close +@skipline close */ diff --git a/docs/src/bdb-map.dox b/docs/src/bdb-map.dox index 189011ad28e..8badc062c28 100644 --- a/docs/src/bdb-map.dox +++ b/docs/src/bdb-map.dox @@ -1,7 +1,7 @@ /* vim: set filetype=c.doxygen : */ /*! - * \defgroup bdbmap WiredTiger for Berkeley DB developers + * @defgroup bdbmap WiredTiger for Berkeley DB developers * * The section explains how to map Oracle Berkeley DB operations onto the * WiredTiger API. @@ -338,7 +338,7 @@ struct DB_LOGC { /*! Log statistics structure. * - * Accessed via WT_SESSION::open_cursor with the URI \p "statistics:" + * Accessed via WT_SESSION::open_cursor with the URI @p "statistics:" */ struct DB_LOG_STAT { u_int32_t st_magic; /*!< Log file magic number. */ @@ -407,7 +407,7 @@ typedef const struct __log_rec_spec { *******************************************************/ /*! Priority values for DB_MPOOLFILE::put, DB_MPOOLFILE::set_priority. * - * Not part of the public WiredTiger API, may be supported via \p config parameter to WT_SESSION::open_cursor. + * Not part of the public WiredTiger API, may be supported via @p config parameter to WT_SESSION::open_cursor. */ typedef enum { DB_PRIORITY_UNCHANGED=0, @@ -468,7 +468,7 @@ struct DB_MPOOLFILE { /*! Mpool statistics structure. * - * Accessed via WT_SESSION::open_cursor with the URI \p "statistics:" + * Accessed via WT_SESSION::open_cursor with the URI @p "statistics:" */ struct DB_MPOOL_STAT { u_int32_t st_gbytes; /*!< Total cache size: GB. */ @@ -520,7 +520,7 @@ struct DB_MPOOL_STAT { /*! Mpool file statistics structure. * - * Accessed via WT_SESSION::open_cursor with the URI \p "statistics:" + * Accessed via WT_SESSION::open_cursor with the URI @p "statistics:" */ struct DB_MPOOL_FSTAT { char *file_name; /*!< File name. */ @@ -567,9 +567,9 @@ struct DB_TXN { u_int32_t id(DB_TXN *); /*!< Not implemented. */ int prepare(DB_TXN *, u_int8_t *); /*!< Not required (XA) */ int set_commit_token(DB_TXN *, DB_TXN_TOKEN *); /*!< Not required (replication) */ - int set_name(DB_TXN *, const char *); /*!< \p config parameter "name=\" to WT_SESSION::begin_transaction */ - int set_priority(DB_TXN *, u_int32_t); /*!< \p config parameter "priority=\" to WT_SESSION::begin_transaction */ - int set_timeout(DB_TXN *, db_timeout_t, u_int32_t); /*!< \p config parameter "timeout=\" to WT_SESSION::begin_transaction */ + int set_name(DB_TXN *, const char *); /*!< @p config parameter "name=\" to WT_SESSION::begin_transaction */ + int set_priority(DB_TXN *, u_int32_t); /*!< @p config parameter "priority=\" to WT_SESSION::begin_transaction */ + int set_timeout(DB_TXN *, db_timeout_t, u_int32_t); /*!< @p config parameter "timeout=\" to WT_SESSION::begin_transaction */ /* DB_TXN PUBLIC HANDLE LIST END */ #define TXN_CHILDCOMMIT 0x00001 /*!< Txn has committed. */ @@ -609,7 +609,7 @@ struct DB_PREPLIST { /*! Statistics for an active transaction. * - * Accessed via WT_SESSION::open_cursor with the URI \p "statistics:" + * Accessed via WT_SESSION::open_cursor with the URI @p "statistics:" */ struct DB_TXN_ACTIVE { u_int32_t txnid; /*!< Transaction ID */ @@ -636,7 +636,7 @@ struct DB_TXN_ACTIVE { /*! Transaction manager statistics structure. * - * Accessed via WT_SESSION::open_cursor with the URI \p "statistics:" + * Accessed via WT_SESSION::open_cursor with the URI @p "statistics:" */ struct DB_TXN_STAT { u_int32_t st_nrestores; /*!< number of restored transactions @@ -861,7 +861,7 @@ struct DB_REPMGR_STAT { */ struct DB_SEQ_RECORD { u_int32_t seq_version; /*!< Version size/number. */ - u_int32_t flags; /*!< DB_SEQ_XXX Flags. */ + u_int32_t flags; /*!< DB_SEQ_* Flags. */ db_seq_t seq_value; /*!< Current value. */ db_seq_t seq_max; /*!< Max permitted. */ db_seq_t seq_min; /*!< Min permitted. */ @@ -870,7 +870,7 @@ struct DB_SEQ_RECORD { /*! * Handle for a sequence object. * - * Accessed via WT_SESSION::open_cursor with the URI \p "sequence:" + * Accessed via WT_SESSION::open_cursor with the URI @p "sequence:" */ struct DB_SEQUENCE { /* DB_SEQUENCE PUBLIC HANDLE LIST BEGIN */ @@ -881,20 +881,20 @@ struct DB_SEQUENCE { int get_flags(DB_SEQUENCE *, u_int32_t *); /*!< Not implemented (getter). */ int get_key(DB_SEQUENCE *, DBT *); /*!< Not implemented (getter) */ int get_range(DB_SEQUENCE *, db_seq_t *, db_seq_t *); /*!< Not implemented (getter). */ - int initial_value(DB_SEQUENCE *, db_seq_t); /*!< Set via \p config parameter of WT_SESSION::open_cursor: "initial_value=\" */ + int initial_value(DB_SEQUENCE *, db_seq_t); /*!< Set via @p config parameter of WT_SESSION::open_cursor: "initial_value=\" */ int open(DB_SEQUENCE *, DB_TXN *, DBT *, u_int32_t); /*!< WT_SESSION::open_cursor */ int remove(DB_SEQUENCE *, DB_TXN *, u_int32_t); /*!< WT_CURSOR::del on the sequences cursor */ - int set_cachesize(DB_SEQUENCE *, int32_t); /*!< Set via the \p config parameter of WT_SESSION::open_cursor: "cachesize=\" */ - int set_flags(DB_SEQUENCE *, u_int32_t); /*!< Set via the \p config parameter of WT_SESSION::open_cursor */ + int set_cachesize(DB_SEQUENCE *, int32_t); /*!< Set via the @p config parameter of WT_SESSION::open_cursor: "cachesize=\" */ + int set_flags(DB_SEQUENCE *, u_int32_t); /*!< Set via the @p config parameter of WT_SESSION::open_cursor */ int set_range(DB_SEQUENCE *, db_seq_t, db_seq_t); /*!< WT_CURSOR::close */ - int stat(DB_SEQUENCE *, DB_SEQUENCE_STAT **, u_int32_t); /*!< WT_SESSION::open_cursor with the URI \p "statistics:sequence:" */ + int stat(DB_SEQUENCE *, DB_SEQUENCE_STAT **, u_int32_t); /*!< WT_SESSION::open_cursor with the URI @p "statistics:sequence:" */ int stat_print(DB_SEQUENCE *, u_int32_t); /*!< Not implemented (easy with cursor interface) */ /* DB_SEQUENCE PUBLIC HANDLE LIST END */ }; /*! Sequence statistics. * - * Accessed via WT_SESSION::open_cursor with the URI \p "statistics:sequence:" + * Accessed via WT_SESSION::open_cursor with the URI @p "statistics:sequence:" */ struct DB_SEQUENCE_STAT { uintmax_t st_wait; /*!< Sequence lock granted w/o wait. */ @@ -913,7 +913,7 @@ struct DB_SEQUENCE_STAT { *******************************************************/ /*! Database types * - * Passed in \p config parameter to WT_SESSION::create_table. + * Passed in @p config parameter to WT_SESSION::create_table. */ typedef enum { DB_BTREE=1, @@ -935,9 +935,9 @@ enum { DB_CONSUME_WAIT, /*!< DB::get, not needed in WiredTiger: no queue. */ DB_CURRENT, /*!< DBC::get, DBC::put, DB_LOGC::get WT_CURRENT */ DB_FIRST, /*!< DBC::get, DB_LOGC::get WT_FIRST */ - DB_GET_BOTH, /*!< DB::get, DBC::get WT_CURSOR::search with non-NULL \p value parameter */ + DB_GET_BOTH, /*!< DB::get, DBC::get WT_CURSOR::search with non-NULL @p value parameter */ DB_GET_BOTHC, /*!< DBC::get (internal) N/A */ - DB_GET_BOTH_RANGE, /*!< DB::get, DBC::get WT_CURSOR::search with non-NULL \p value parameter, returned as result != WT_CURRENT. */ + DB_GET_BOTH_RANGE, /*!< DB::get, DBC::get WT_CURSOR::search with non-NULL @p value parameter, returned as result != WT_CURRENT. */ DB_GET_RECNO, /*!< DBC::get N/A for WiredTiger: no DB_RECNUM equivalent. */ DB_JOIN_ITEM, /*!< DBC::get; don't do primary lookup Special join cursor */ DB_KEYFIRST, /*!< DBC::put not needed in WiredTiger: no unsorted dups. */ @@ -945,14 +945,14 @@ enum { DB_LAST, /*!< DBC::get, DB_LOGC::get, WT_LAST */ DB_NEXT, /*!< DBC::get, DB_LOGC::get, WT_NEXT */ DB_NEXT_DUP, /*!< DBC::get, default behavior or WT_NEXT */ - DB_NEXT_NODUP, /*!< DBC::get, WT_NEXT with \p "nodup" config to WT_SESSION::open_cursor. */ - DB_NODUPDATA, /*!< DB::put, DBC::put, WT_CURSOR::insert with \p "nodup" config to WT_SESSION::open_cursor */ + DB_NEXT_NODUP, /*!< DBC::get, WT_NEXT with @p "nodup" config to WT_SESSION::open_cursor. */ + DB_NODUPDATA, /*!< DB::put, DBC::put, WT_CURSOR::insert with @p "nodup" config to WT_SESSION::open_cursor */ DB_NOOVERWRITE, /*!< DB::put default behavior of WT_CURSOR::insert */ DB_OVERWRITE_DUP, /*!< DBC::put, DB::put; no DB_KEYEXIST WT_CURSOR::update */ DB_POSITION, /*!< DBC::dup default behavior of WT_SESSION::dup_cursor. */ DB_PREV, /*!< DBC::get, DB_LOGC::get WT_PREV */ DB_PREV_DUP, /*!< DBC::get default behavior of WT_PREV */ - DB_PREV_NODUP, /*!< DBC::get WT_PREV with \p "nodup" config to WT_SESSION::open_cursor */ + DB_PREV_NODUP, /*!< DBC::get WT_PREV with @p "nodup" config to WT_SESSION::open_cursor */ DB_SET, /*!< DBC::get, DB_LOGC::get WT_CURSOR::search default */ DB_SET_RANGE, /*!< DBC::get WT_CURSOR::search returns result != DB_CURRENT */ DB_SET_RECNO, /*!< DB::get, DBC::get N/A for WiredTiger: no DB_RECNUM equivalent. */ @@ -1087,15 +1087,15 @@ struct DB { int set_bt_compress(DB *, int (DB *, const DBT *, const DBT *, const DBT *, const DBT *, DBT *), int (DB *, const DBT *, const DBT *, DBT *, DBT *, DBT *)); /*!< Special cursor type */ int set_bt_minkey(DB *, u_int32_t); /*!< Not implemented? */ int set_bt_prefix(DB *, size_t (DB *, const DBT *, const DBT *)); /*!< Not implemented? */ - int set_cachesize(DB *, u_int32_t, u_int32_t, int); /*!< \p config parameter to ::wt_open */ - int set_create_dir(DB *, const char *); /*!< \p config parameter to WT_SESSION::create_table */ + int set_cachesize(DB *, u_int32_t, u_int32_t, int); /*!< @p config parameter to ::wt_open */ + int set_create_dir(DB *, const char *); /*!< @p config parameter to WT_SESSION::create_table */ int set_dup_compare(DB *, int (DB *, const DBT *, const DBT *)); /*!< WT_SCHEMA::dup_cmp */ int set_encrypt(DB *, const char *, u_int32_t); /*!< Not implemented. */ void set_errcall(DB *, void (const DB_ENV *, const char *, const char *)); /*!< set WT_SESSION::handle_error */ void set_errfile(DB *, FILE *); /*!< Not implemented. */ void set_errpfx(DB *, const char *); /*!< Not implemented. */ int set_feedback(DB *, void (DB *, int, int)); /*!< Not implemented. */ - int set_flags(DB *, u_int32_t); /*!< \p config parameter to WT_SESSION::create_table */ + int set_flags(DB *, u_int32_t); /*!< @p config parameter to WT_SESSION::create_table */ int set_h_compare(DB *, int (DB *, const DBT *, const DBT *)); /*!< Not implemented (hash). */ int set_h_ffactor(DB *, u_int32_t); /*!< Not implemented (hash). */ int set_h_hash(DB *, u_int32_t (DB *, const void *, u_int32_t)); /*!< Not implemented (hash). */ @@ -1103,18 +1103,18 @@ struct DB { int set_lorder(DB *, int); /*!< Not implemented (fixed byte order). */ void set_msgcall(DB *, void (const DB_ENV *, const char *)); /*!< Not implemented. */ void set_msgfile(DB *, FILE *); /*!< Not implemented. */ - int set_pagesize(DB *, u_int32_t); /*!< \p config parameter to WT_SESSION::create_table */ + int set_pagesize(DB *, u_int32_t); /*!< @p config parameter to WT_SESSION::create_table */ int set_paniccall(DB *, void (DB_ENV *, int)); /*!< Not implemented? */ int set_partition(DB *, u_int32_t, DBT *, u_int32_t (DB *, DBT *key)); /*!< Special cursor type */ int set_partition_dirs(DB *, const char **); /*!< Special cursor type */ - int set_priority(DB *, DB_CACHE_PRIORITY); /*!< \p config parameter to WT_SESSION::open_cursor */ + int set_priority(DB *, DB_CACHE_PRIORITY); /*!< @p config parameter to WT_SESSION::open_cursor */ int set_q_extentsize(DB *, u_int32_t); /*!< Not implemented (queue). */ int set_re_delim(DB *, int); /*!< Not implemented (recno). */ - int set_re_len(DB *, u_int32_t); /*!< \p config parameter to WT_SESSION::create_table */ - int set_re_pad(DB *, int); /*!< \p config parameter to WT_SESSION::create_table */ + int set_re_len(DB *, u_int32_t); /*!< @p config parameter to WT_SESSION::create_table */ + int set_re_pad(DB *, int); /*!< @p config parameter to WT_SESSION::create_table */ int set_re_source(DB *, const char *); /*!< Not implemented (recno). */ int sort_multiple(DB *, DBT *, DBT *, u_int32_t); /*!< Not implemented directly, could be via a bulk cursor. */ - int stat(DB *, DB_TXN *, void *, u_int32_t); /*!< Accessed via WT_SESSION::open_cursor with the URI \p "statistics:table:" */ + int stat(DB *, DB_TXN *, void *, u_int32_t); /*!< Accessed via WT_SESSION::open_cursor with the URI @p "statistics:table:" */ int stat_print(DB *, u_int32_t); /*!< Not implemented (easy with cursor interface) */ int sync(DB *, u_int32_t); /*!< Not implemented. Could be WT_SESSION::sync if needed later. */ int truncate(DB *, DB_TXN *, u_int32_t *, u_int32_t); /*!< WT_SESSION::truncate_table */ @@ -1359,9 +1359,9 @@ struct DBC { int dup(DBC *, DBC **, u_int32_t); /*!< WT_SESSION::dup_cursor */ int get(DBC *, DBT *, DBT *, u_int32_t); /*!< WT_CURSOR::get and WT_CURSOR::search */ int get_priority(DBC *, DB_CACHE_PRIORITY *); /*!< Not implemented. */ - int pget(DBC *, DBT *, DBT *, DBT *, u_int32_t); /*!< WT_CURSOR::get with \p config parameter to WT_SESSION::open_cursor */ + int pget(DBC *, DBT *, DBT *, DBT *, u_int32_t); /*!< WT_CURSOR::get with @p config parameter to WT_SESSION::open_cursor */ int put(DBC *, DBT *, DBT *, u_int32_t); /*!< WT_CURSOR::insert and WT_CURSOR::update */ - int set_priority(DBC *, DB_CACHE_PRIORITY); /*!< \p config parameter to WT_SESSION::open_cursor */ + int set_priority(DBC *, DB_CACHE_PRIORITY); /*!< @p config parameter to WT_SESSION::open_cursor */ /* DBC PUBLIC HANDLE LIST END */ /* @@ -1405,7 +1405,7 @@ struct DB_KEY_RANGE { /*! Btree/Recno statistics structure. * - * Accessed via WT_SESSION::open_cursor with the URI \p "statistics:table:" + * Accessed via WT_SESSION::open_cursor with the URI @p "statistics:table:" */ struct DB_BTREE_STAT { u_int32_t bt_magic; /*!< Magic number. */ @@ -1536,7 +1536,7 @@ struct DB_ENV { u_int32_t flags; /* DB_ENV PUBLIC HANDLE LIST BEGIN */ - int add_data_dir(DB_ENV *, const char *); /*!< \p "config:" cursor */ + int add_data_dir(DB_ENV *, const char *); /*!< @p "config:" cursor */ int cdsgroup_begin(DB_ENV *, DB_TXN **); /*!< Not implemented (CDS). */ int close(DB_ENV *, u_int32_t); int dbremove(DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t); @@ -1548,23 +1548,23 @@ struct DB_ENV { int get_alloc(DB_ENV *, void **(size_t, void **(void *, size_t), void *(void *))); /*!< Not implemented (getter). */ int get_app_dispatch(DB_ENV *, int *(DB_ENV *, DBT *, DB_LSN *, db_recops)); /*!< Not implemented (getter). */ int get_cache_max(DB_ENV *, u_int32_t *, u_int32_t *); /*!< Not required. */ - int get_cachesize(DB_ENV *, u_int32_t *, u_int32_t *, int *); /*!< \p "config:" cursor */ - int get_create_dir(DB_ENV *, const char **); /*!< \p "config:" cursor */ - int get_data_dirs(DB_ENV *, const char ***); /*!< \p "config:" cursor */ + int get_cachesize(DB_ENV *, u_int32_t *, u_int32_t *, int *); /*!< @p "config:" cursor */ + int get_create_dir(DB_ENV *, const char **); /*!< @p "config:" cursor */ + int get_data_dirs(DB_ENV *, const char ***); /*!< @p "config:" cursor */ int get_data_len(DB_ENV *, u_int32_t *); /*!< Not implemented. */ int get_encrypt_flags(DB_ENV *, u_int32_t *); /*!< Not implemented. */ void get_errcall(DB_ENV *, void *(const DB_ENV *, const char *, const char *)); /*!< Not implemented. */ void get_errfile(DB_ENV *, FILE **); /*!< Not implemented. */ void get_errpfx(DB_ENV *, const char **); /*!< Not implemented. */ - int get_flags(DB_ENV *, u_int32_t *); /*!< \p "config:" cursor */ + int get_flags(DB_ENV *, u_int32_t *); /*!< @p "config:" cursor */ int get_feedback(DB_ENV *, void *(DB_ENV *, int, int)); /*!< Not implemented. */ int get_home(DB_ENV *, const char **); /*!< WT_CONNECTION::home */ int get_intermediate_dir_mode(DB_ENV *, const char **); /*!< Not implemented. */ int get_isalive(DB_ENV *, int *(DB_ENV *, pid_t, db_threadid_t, u_int32_t)); /*!< Not implemented. */ - int get_lg_bsize(DB_ENV *, u_int32_t *); /*!< \p "config:" cursor */ - int get_lg_dir(DB_ENV *, const char **); /*!< \p "config:" cursor */ + int get_lg_bsize(DB_ENV *, u_int32_t *); /*!< @p "config:" cursor */ + int get_lg_dir(DB_ENV *, const char **); /*!< @p "config:" cursor */ int get_lg_filemode(DB_ENV *, int *); /*!< Not implemented. */ - int get_lg_max(DB_ENV *, u_int32_t *) /*!< \p "config:" cursor */; + int get_lg_max(DB_ENV *, u_int32_t *) /*!< @p "config:" cursor */; int get_lg_regionmax(DB_ENV *, u_int32_t *); /*!< Not implemented. */ int get_lk_conflicts(DB_ENV *, const u_int8_t **, int *); /*!< Not implemented. */ int get_lk_detect(DB_ENV *, u_int32_t *); /*!< Not implemented. */ @@ -1574,50 +1574,50 @@ struct DB_ENV { int get_lk_partitions(DB_ENV *, u_int32_t *); /*!< Not implemented. */ int get_lk_priority(DB_ENV *, u_int32_t, u_int32_t *); /*!< Not implemented. */ int get_mp_max_openfd(DB_ENV *, int *); /*!< Not implemented. */ - int get_mp_max_write(DB_ENV *, int *, db_timeout_t *); /*!< \p "config:" cursor */ + int get_mp_max_write(DB_ENV *, int *, db_timeout_t *); /*!< @p "config:" cursor */ int get_mp_mmapsize(DB_ENV *, size_t *); /*!< Not implemented. */ int get_mp_mtxcount(DB_ENV *, u_int32_t *); /*!< Not implemented. */ int get_mp_pagesize(DB_ENV *, u_int32_t *); /*!< Not implemented. */ int get_mp_tablesize(DB_ENV *, u_int32_t *); /*!< Not implemented. */ void get_msgcall(DB_ENV *, void *(const DB_ENV *, const char *)); /*!< Not implemented. */ void get_msgfile(DB_ENV *, FILE **); /*!< Not implemented. */ - int get_open_flags(DB_ENV *, u_int32_t *); /*!< \p "config:" cursor */ + int get_open_flags(DB_ENV *, u_int32_t *); /*!< @p "config:" cursor */ int get_shm_key(DB_ENV *, long *); /*!< Not implemented. */ - int get_thread_count(DB_ENV *, u_int32_t *); /*!< \p "config:" cursor */ + int get_thread_count(DB_ENV *, u_int32_t *); /*!< @p "config:" cursor */ int get_thread_id_fn(DB_ENV *, void *(DB_ENV *, pid_t *, db_threadid_t *)); /*!< Not implemented. */ int get_thread_id_string_fn(DB_ENV *, char **(DB_ENV *, pid_t, db_threadid_t, char *)); /*!< Not implemented. */ - int get_timeout(DB_ENV *, db_timeout_t *, u_int32_t); /*!< \p "config:" cursor */ - int get_tmp_dir(DB_ENV *, const char **); /*!< \p "config:" cursor */ - int get_tx_max(DB_ENV *, u_int32_t *); /*!< \p "config:" cursor */ - int get_tx_timestamp(DB_ENV *, time_t *); /*!< \p "config:" cursor */ - int get_verbose(DB_ENV *, u_int32_t, int *); /*!< \p "config:" cursor */ + int get_timeout(DB_ENV *, db_timeout_t *, u_int32_t); /*!< @p "config:" cursor */ + int get_tmp_dir(DB_ENV *, const char **); /*!< @p "config:" cursor */ + int get_tx_max(DB_ENV *, u_int32_t *); /*!< @p "config:" cursor */ + int get_tx_timestamp(DB_ENV *, time_t *); /*!< @p "config:" cursor */ + int get_verbose(DB_ENV *, u_int32_t, int *); /*!< @p "config:" cursor */ int is_bigendian(void); /*!< Not implemented. */ int lock_detect(DB_ENV *, u_int32_t, u_int32_t, int *); /*!< Not implemented. */ int lock_get(DB_ENV *, u_int32_t, u_int32_t, DBT *, db_lockmode_t, DB_LOCK *); /*!< Not implemented. */ int lock_id(DB_ENV *, u_int32_t *); /*!< Not implemented. */ int lock_id_free(DB_ENV *, u_int32_t); /*!< Not implemented. */ int lock_put(DB_ENV *, DB_LOCK *); /*!< Not implemented. */ - int lock_stat(DB_ENV *, DB_LOCK_STAT **, u_int32_t); /*!< Accessed via WT_SESSION::open_cursor with the URI \p "statistics:" */ + int lock_stat(DB_ENV *, DB_LOCK_STAT **, u_int32_t); /*!< Accessed via WT_SESSION::open_cursor with the URI @p "statistics:" */ int lock_stat_print(DB_ENV *, u_int32_t); /*!< Not implemented (easy with cursor interface) */ int lock_vec(DB_ENV *, u_int32_t, u_int32_t, DB_LOCKREQ *, int, DB_LOCKREQ **); /*!< Not implemented. */ int log_archive(DB_ENV *, char **[], u_int32_t); /*!< WT_SESSION::checkpoint */ int log_cursor(DB_ENV *, DB_LOGC **, u_int32_t); /*!< Not implemented, but could be a special cursor type. */ int log_file(DB_ENV *, const DB_LSN *, char *, size_t); /*!< Not implemented. */ int log_flush(DB_ENV *, const DB_LSN *); /*!< WT_SESSION::checkpoint */ - int log_get_config(DB_ENV *, u_int32_t, int *); /*!< \p "config:" cursor */ + int log_get_config(DB_ENV *, u_int32_t, int *); /*!< @p "config:" cursor */ int log_printf(DB_ENV *, DB_TXN *, const char *, ...); /*!< Not implemented, but could be a log cursor insert. */ int log_put(DB_ENV *, DB_LSN *, const DBT *, u_int32_t); /*!< Not implemented, but could be a log cursor insert. */ int log_put_record(DB_ENV *, DB *, DB_TXN *, DB_LSN *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, DB_LOG_RECSPEC *, ...); /*!< Not implemented. */ int log_read_record(DB_ENV *, DB **, void *, void *, DB_LOG_RECSPEC *, u_int32_t, void **); /*!< Not implemented. */ - int log_set_config(DB_ENV *, u_int32_t, int); /*!< \p config parameter to ::wt_open */ - int log_stat(DB_ENV *, DB_LOG_STAT **, u_int32_t); /*!< Accessed via WT_SESSION::open_cursor with the URI \p "statistics:" */ + int log_set_config(DB_ENV *, u_int32_t, int); /*!< @p config parameter to ::wt_open */ + int log_stat(DB_ENV *, DB_LOG_STAT **, u_int32_t); /*!< Accessed via WT_SESSION::open_cursor with the URI @p "statistics:" */ int log_stat_print(DB_ENV *, u_int32_t); /*!< Not implemented (easy with cursor interface) */ int log_verify(DB_ENV *, const DB_LOG_VERIFY_CONFIG *); int lsn_reset(DB_ENV *, const char *, u_int32_t); int memp_fcreate(DB_ENV *, DB_MPOOLFILE **, u_int32_t); int memp_register(DB_ENV *, int, int (*(DB_ENV *, db_pgno_t, void *, DBT *), int (DB_ENV *, db_pgno_t, void *, DBT *))); - int memp_stat(DB_ENV *, DB_MPOOL_STAT **, DB_MPOOL_FSTAT ***, u_int32_t); /*!< Accessed via WT_SESSION::open_cursor with the URI \p "statistics:" */ + int memp_stat(DB_ENV *, DB_MPOOL_STAT **, DB_MPOOL_FSTAT ***, u_int32_t); /*!< Accessed via WT_SESSION::open_cursor with the URI @p "statistics:" */ int memp_stat_print(DB_ENV *, u_int32_t); /*!< Not implemented (easy with cursor interface) */ int memp_sync(DB_ENV *, DB_LSN *); /*!< WT_SESSION::checkpoint */ int memp_trickle(DB_ENV *, int, int *); @@ -1632,7 +1632,7 @@ struct DB_ENV { int mutex_set_increment(DB_ENV *, u_int32_t); int mutex_set_max(DB_ENV *, u_int32_t); int mutex_set_tas_spins(DB_ENV *, u_int32_t); - int mutex_stat(DB_ENV *, DB_MUTEX_STAT **, u_int32_t); /*!< Accessed via WT_SESSION::open_cursor with the URI \p "statistics:" */ + int mutex_stat(DB_ENV *, DB_MUTEX_STAT **, u_int32_t); /*!< Accessed via WT_SESSION::open_cursor with the URI @p "statistics:" */ int mutex_stat_print(DB_ENV *, u_int32_t); /*!< Not implemented (easy with cursor interface) */ int mutex_unlock(DB_ENV *, db_mutex_t); int open(DB_ENV *, const char *, u_int32_t, int); @@ -1671,9 +1671,9 @@ struct DB_ENV { int set_alloc(DB_ENV *, void *(size_t, void *(void *, size_t), void (void *))); /*!< Not implemented (OS interface) */ int set_app_dispatch(DB_ENV *, int (DB_ENV *, DBT *, DB_LSN *, db_recops)); /*!< Not implemented (application-level logging) */ int set_cache_max(DB_ENV *, u_int32_t, u_int32_t); /*!< Not required. */ - int set_cachesize(DB_ENV *, u_int32_t, u_int32_t, int); /*!< \p config parameter to ::wt_open */ - int set_create_dir(DB_ENV *, const char *); /*!< \p config parameter to WT_SESSION::create_table */ - int set_data_dir(DB_ENV *, const char *); /*!< \p config parameter to WT_SESSION::create_table */ + int set_cachesize(DB_ENV *, u_int32_t, u_int32_t, int); /*!< @p config parameter to ::wt_open */ + int set_create_dir(DB_ENV *, const char *); /*!< @p config parameter to WT_SESSION::create_table */ + int set_data_dir(DB_ENV *, const char *); /*!< @p config parameter to WT_SESSION::create_table */ int set_data_len(DB_ENV *, u_int32_t); /*!< Not implemented. */ int set_encrypt(DB_ENV *, const char *, u_int32_t); /*!< Not implemented (encryption). */ void set_errcall(DB_ENV *, void (const DB_ENV *, const char *, const char *)); /*!< set WT_SESSION::handle_error */ @@ -1681,21 +1681,21 @@ struct DB_ENV { void set_errpfx(DB_ENV *, const char *); /*!< Not implemented. */ int set_event_notify(DB_ENV *, void (DB_ENV *, u_int32_t, void *)); /*!< Not implemented. */ int set_feedback(DB_ENV *, void (DB_ENV *, int, int)); /*!< Not implemented. */ - int set_flags(DB_ENV *, u_int32_t, int); /*!< \p config parameter to ::wt_open */ + int set_flags(DB_ENV *, u_int32_t, int); /*!< @p config parameter to ::wt_open */ int set_intermediate_dir_mode(DB_ENV *, const char *); /*!< Not implemented. */ int set_isalive(DB_ENV *, int (DB_ENV *, pid_t, db_threadid_t, u_int32_t)); /*!< Not implemented. */ - int set_lg_bsize(DB_ENV *, u_int32_t); /*!< \p config parameter to ::wt_open */ - int set_lg_dir(DB_ENV *, const char *); /*!< \p config parameter to ::wt_open */ - int set_lg_filemode(DB_ENV *, int); /*!< \p config parameter to ::wt_open */ - int set_lg_max(DB_ENV *, u_int32_t); /*!< \p config parameter to ::wt_open */ + int set_lg_bsize(DB_ENV *, u_int32_t); /*!< @p config parameter to ::wt_open */ + int set_lg_dir(DB_ENV *, const char *); /*!< @p config parameter to ::wt_open */ + int set_lg_filemode(DB_ENV *, int); /*!< @p config parameter to ::wt_open */ + int set_lg_max(DB_ENV *, u_int32_t); /*!< @p config parameter to ::wt_open */ int set_lg_regionmax(DB_ENV *, u_int32_t); /*!< Not implemented. */ int set_lk_conflicts(DB_ENV *, u_int8_t *, int); /*!< Not implemented. */ - int set_lk_detect(DB_ENV *, u_int32_t); /*!< If needed, \p config parameter to ::wt_open */ + int set_lk_detect(DB_ENV *, u_int32_t); /*!< If needed, @p config parameter to ::wt_open */ int set_lk_max_lockers(DB_ENV *, u_int32_t); /*!< Not implemented. */ int set_lk_max_locks(DB_ENV *, u_int32_t); /*!< Not implemented. */ int set_lk_max_objects(DB_ENV *, u_int32_t); /*!< Not implemented. */ int set_lk_partitions(DB_ENV *, u_int32_t); /*!< Not implemented. */ - int set_lk_priority(DB_ENV *, u_int32_t, u_int32_t); /*!< \p config parameter to WT_SESSION::begin_transaction. */ + int set_lk_priority(DB_ENV *, u_int32_t, u_int32_t); /*!< @p config parameter to WT_SESSION::begin_transaction. */ int set_mp_max_openfd(DB_ENV *, int); /*!< Not implemented. */ int set_mp_max_write(DB_ENV *, int, db_timeout_t); /*!< Not implemented. */ int set_mp_mmapsize(DB_ENV *, size_t); /*!< Not implemented. */ @@ -1706,11 +1706,11 @@ struct DB_ENV { void set_msgfile(DB_ENV *, FILE *); /*!< Not implemented. */ int set_paniccall(DB_ENV *, void (DB_ENV *, int)); /*!< Not implemented. */ int set_shm_key(DB_ENV *, long); /*!< Not implemented. */ - int set_thread_count(DB_ENV *, u_int32_t); /*!< \p config parameter to ::wt_open */ + int set_thread_count(DB_ENV *, u_int32_t); /*!< @p config parameter to ::wt_open */ int set_thread_id(DB_ENV *, void (DB_ENV *, pid_t *, db_threadid_t *)); /*!< Not implemented. */ int set_thread_id_string(DB_ENV *, char *(DB_ENV *, pid_t, db_threadid_t, char *)); /*!< Not implemented. */ - int set_timeout(DB_ENV *, db_timeout_t, u_int32_t); /*!< \p config parameter to ::wt_open */ - int set_tmp_dir(DB_ENV *, const char *); /*!< \p config parameter to ::wt_open */ + int set_timeout(DB_ENV *, db_timeout_t, u_int32_t); /*!< @p config parameter to ::wt_open */ + int set_tmp_dir(DB_ENV *, const char *); /*!< @p config parameter to ::wt_open */ int set_tx_max(DB_ENV *, u_int32_t); /*!< Not implemented: equivalent to thread count */ int set_tx_timestamp(DB_ENV *, time_t *); /*!< Not implemented. */ int set_verbose(DB_ENV *, u_int32_t, int); /*!< Not implemented. */ @@ -1719,7 +1719,7 @@ struct DB_ENV { int txn_begin(DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t); /*!< WT_SESSION::begin_transaction */ int txn_checkpoint(DB_ENV *, u_int32_t, u_int32_t, u_int32_t); /*!< WT_SESSION::checkpoint */ int txn_recover(DB_ENV *, DB_PREPLIST *, u_int32_t, u_int32_t *, u_int32_t); /*!< Not implemented */ - int txn_stat(DB_ENV *, DB_TXN_STAT **, u_int32_t); /*!< Accessed via WT_SESSION::open_cursor with the URI \p "statistics:" */ + int txn_stat(DB_ENV *, DB_TXN_STAT **, u_int32_t); /*!< Accessed via WT_SESSION::open_cursor with the URI @p "statistics:" */ int txn_stat_print(DB_ENV *, u_int32_t); /*!< Not implemented (easy with cursor interface) */ /* DB_ENV PUBLIC HANDLE LIST END */ }; diff --git a/docs/src/command-line.dox b/docs/src/command-line.dox index c32bbc792f0..9a557f577a1 100644 --- a/docs/src/command-line.dox +++ b/docs/src/command-line.dox @@ -1,4 +1,6 @@ /* vim: set filetype=c.doxygen : */ -/*! \page command_line Command Line Interface +/*! @page command_line Command Line Interface + +@todo write text */ diff --git a/docs/src/config-strings.dox b/docs/src/config-strings.dox index b0cc31852d2..e30525d4e05 100644 --- a/docs/src/config-strings.dox +++ b/docs/src/config-strings.dox @@ -1,8 +1,8 @@ /* vim: set filetype=c.doxygen : */ -/*! \page config_strings Configuration Strings +/*! @page config_strings Configuration Strings -\section config_intro Introduction +@section config_intro Introduction Many operations in WiredTiger accept a string to configure options. These strings all have the same format: @@ -12,7 +12,7 @@ Many operations in WiredTiger accept a string to configure options. These strin That is, they are simple comma-separated lists of "=" 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:
 
@@ -25,28 +44,30 @@ The following are builtin cursor types:
 
statistics:[table:\]database or table statistics (key=(string)keyname, data=(string)value)
-\section cursor_projections Projections +@section cursor_projections Projections Cursors on tables, column sets and indices can return a subset of columns. This is done by listing the column names in parantheses in the 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.

Major architectural differences from Berkeley DB:

-
    +
    1. Support for multi-core architectures: architectures have 10's or 100's of cores, with multiple threads per core, and touching shared memory kills performance. Berkeley DB's diff --git a/docs/src/examples.dox b/docs/src/examples.dox index 45ed1cd84e1..4f0dc8778b9 100644 --- a/docs/src/examples.dox +++ b/docs/src/examples.dox @@ -1,36 +1,43 @@ /* vim: set filetype=c.doxygen : */ /*! -\example ex_hello.c +@example ex_hello.c This is an example of how to create and open a database. -\example ex_access.c +@example ex_access.c Create, insert and access a simple table. -\example ex_config.c -Demonstrate how to configure some properties of the database and tables. +@example ex_config.c +Shows how to configure some properties of the database and tables. -\example ex_cursor.c +@example ex_cursor.c +Shows some common cursor types and operations. -\example ex_pack.c +@example ex_pack.c +Shows basic packing and unpacking of fields. -\example ex_process.c +@example ex_process.c +Shows how to connect to a database from multiple processes. -\example ex_stat.c +@example ex_stat.c Shows how to access database and table statistics. -\example ex_schema.c +@example ex_schema.c Shows how to create column-oriented data and access individual columns. -\example ex_thread.c +@example ex_thread.c Shows how to access a database with multiple threads. -\example ex_transaction.c +@example ex_transaction.c +Shows how to use transactions. -\example ex_call_center.c +@example ex_call_center.c A more complex schema based on a call center example, showing how to map some SQL constructs onto the WiredTiger API. -\example ex_extending.c +@example ex_tpcb.c +Translates the Berkeley DB TPC-B example program onto the WiredTiger API. + +@example ex_extending.c Shows how to extend WiredTiger with application-specific collations, extractors and cursor types. */ diff --git a/docs/src/extending.dox b/docs/src/extending.dox index 44f69e5f524..4ede0c5cf60 100644 --- a/docs/src/extending.dox +++ b/docs/src/extending.dox @@ -1,30 +1,30 @@ /* vim: set filetype=c.doxygen : */ -/*! \page extending Extending WiredTiger +/*! @page extending Extending WiredTiger - must be in C/C++ -\section modules Loadable Modules +@section modules Loadable Modules -XXX +@todo describe loadable modules -\section cursor_factory Adding Cursor Types +@section cursor_factory Adding Cursor Types -XXX +@todo explain how to add cursor types -\section collations Custom Collators +@section collations Custom Collators -XXX +@todo explain custom collators -\section extractors Custom Field Extractors +@section extractors Custom Field Extractors -XXX +@todo explain custom extractors -\section extending_example Code Samples +@section extending_example Code Samples -The code below is taken from the complete example program \ex_ref{ex_extending.c}. +The code below is taken from the complete example program @ex_ref{ex_extending.c}. -\dontinclude ex_extending.c -\skip main -\until ->close +@dontinclude ex_extending.c +@skip main +@until ->close */ diff --git a/docs/src/layout.dox b/docs/src/filetypes.dox similarity index 96% rename from docs/src/layout.dox rename to docs/src/filetypes.dox index 5150216634c..00e7323cd50 100644 --- a/docs/src/layout.dox +++ b/docs/src/filetypes.dox @@ -1,23 +1,20 @@ /* vim: set filetype=c.doxygen : */ -/*! \page layout Table File Formats +/*! @page filetypes Table File Formats + +\todo rewrite this to describe the WiredTiger row- and column-store features in detail, including page sizing calculations for given key/value sizes -

      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:

        @@ -130,14 +115,11 @@ a key or data item, and not a fundamental layout structure issue.
      -

      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:

        @@ -181,7 +159,6 @@ or repeat count.
      -

      Q&A:

        diff --git a/docs/src/introduction.dox b/docs/src/introduction.dox new file mode 100644 index 00000000000..d1ae60ff6a2 --- /dev/null +++ b/docs/src/introduction.dox @@ -0,0 +1,21 @@ +/* vim: set filetype=c.doxygen : */ + +/*! @mainpage Introduction + +The WiredTiger Data Store is an extensible platform for data management. This documentation describes the programming interface to WiredTiger used by developers to construct applications. + +We follow SQL terminology: a database is set of tables managed together. Tables consist of rows, where each row is a key and its associated value. Tables may optionally have an associated schema, splitting the value into a set of columns. Tables may also have associated indices, each of which is ordered by one or more columns. + +In addition to the traditional row-oriented storage where all columns of a row are stored together, WiredTiger supports column-oriented storage, where one or more columns can be stored individually, allowing more efficient access and storage. + +@section intro_details Programmer's Reference + +For full details about using WiredTiger, see: + +- @subpage architecture\n + describes the architecture of the WiredTiger engine. +- @subpage using\n + explains how to write applications that use WiredTiger. +- @ref wiredtiger.h "The WiredTiger API"\n + the complete reference manual for the WiredTiger API. +- @subpage sql_mapping diff --git a/docs/src/overview.dox b/docs/src/overview.dox deleted file mode 100644 index 583690120db..00000000000 --- a/docs/src/overview.dox +++ /dev/null @@ -1,50 +0,0 @@ -/* vim: set filetype=c.doxygen : */ - -/*! \mainpage WiredTiger Overview - -\section overview_intro Introduction - -The WiredTiger Data Store is an extensible platform for data management. This documentation describes the public interface to WiredTiger used by developers to construct applications. - -We follow SQL terminology: a database is set of tables that are managed together. Tables logically consist of rows, each row has a key and a value. Tables may optionally have an associated schema, which splits the key/value pair into a set of columns. Tables may also have associated indices, each of which is ordered by some set of columns. - -WiredTiger supports column-oriented storage in addition to traditional row-oriented storage. Instead of storing all fields from a row together, WiredTiger can efficiently store and access sets of columns (including single columns) separately. The same programming interface is used to access row- and column-oriented data, making it possible to change the data layout to improve throughput without rewriting applications. - -Applications will generally use the following classes to access and manage data: - - - a WT_CONNECTION represents a connection to a database. Most applications - will only open one connection to a database for each process. The first - process to open a connection to a database will access the database in its - own address space. Subsequent connections (if allowed) will communicate - with the first process over a socket connection to perform their - operations. - - - a WT_SESSION represents a context in which database operations are - performed. Sessions are opened on a specified connection, and applications - must open a single session for each thread accessing the database. - - - a WT_CURSOR represents a cursor over a collection of data. Cursors are - opened in the context of a session (which may have an associated - transaction), and can query and update records. In the common case, a - cursor is used to access records in a table. However, cursors can be used - on subsets of tables (such as a single column or a projection of multiple - columns), as an interface to statistics, configuration data or - application-specific data sources. - -Handles and operations are configured using strings, which keeps the set of methods in the API relatively small and makes the interface very similar regardless of the programming language used in the application. WiredTiger supports the C, C++, Java and Python programming languages (among others). - -\section overview_details Programmer's Reference - -For full details about using WiredTiger, see: - -- \subpage architecture -- \ref using -- \ref wt "API Reference" -- \subpage sql_mapping - -\section overview_examples Examples - -The Examples Page introduces the API and shows -how to use it to achieve a variety of tasks. - - */ diff --git a/docs/src/packing.dox b/docs/src/packing.dox index 3283757bad0..bf8a60bb70c 100644 --- a/docs/src/packing.dox +++ b/docs/src/packing.dox @@ -1,17 +1,17 @@ /* vim: set filetype=c.doxygen : */ -/*! \page packing Packing and Unpacking Data +/*! @page packing Packing and Unpacking Data -XXX What are WT_CURSOR::get_key, WT_CURSOR::get_value, WT_CURSOR::set_key and WT_CURSOR::set_value all about? +@todo Describe what WT_CURSOR::get_key, WT_CURSOR::get_value, WT_CURSOR::set_key and WT_CURSOR::set_value are all about. - native C structs - portability between programming languages -\section config_examples Code Samples +@section config_examples Code Samples -The code below is taken from the complete example program \ex_ref{ex_pack.c}. +The code below is taken from the complete example program @ex_ref{ex_pack.c}. -\dontinclude ex_pack.c -\skip struct_size -\until unpack +@dontinclude ex_pack.c +@skip struct_size +@until unpack */ diff --git a/docs/src/processes.dox b/docs/src/processes.dox index 0a9c068008c..cbf2fc37302 100644 --- a/docs/src/processes.dox +++ b/docs/src/processes.dox @@ -1,29 +1,29 @@ /* vim: set filetype=c.doxygen : */ -/*! \page processes Sharing Between Processes +/*! @page processes Sharing Between Processes WiredTiger includes a server that provides remote access to databases. The primary process to open a database can optionally start a server that handles requests from other processes. The remote interface is the way languages other than C/C++ are supported, and the interface for client processes in multiprocess C/C++ applications. -The server can be embedded in an application or run from the command line. To embed the RPC server in your application, pass "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: -
          -
        1. sequential scan through a range;
        2. -
        3. join (various flavors);
        4. -
        5. sort (group by);
        6. -
        7. projection, and so on.
        8. -
        + +# sequential scan through a range; +# join (various flavors); +# sort (group by); +# projection, and so on. + Those operations would be implemented as different WiredTiger cursor types, using WT_CONNECTION::add_cursor_factory. diff --git a/docs/src/threads.dox b/docs/src/threads.dox index aaa7b035453..a06a2b63c32 100644 --- a/docs/src/threads.dox +++ b/docs/src/threads.dox @@ -1,15 +1,15 @@ /* vim: set filetype=c.doxygen : */ -/*! \page threads Multithreading +/*! @page threads Multithreading WT_CONNECTION handles can be shared between threads, and applications should generally only open one connection per process. WT_SESSION and WT_CURSOR handles cannot be shared between threads: applications should open one WT_SESSION for each thread that accesses a database. -\section threads_example Code Samples +@section threads_example Code Samples -The code below is taken from the complete example program \ex_ref{ex_thread.c}. +The code below is taken from the complete example program @ex_ref{ex_thread.c}. -\dontinclude ex_thread.c -\skip { -\until conn->close +@dontinclude ex_thread.c +@skip { +@until conn->close */ diff --git a/docs/src/transactions.dox b/docs/src/transactions.dox index b38feb6b413..fe1447c104b 100644 --- a/docs/src/transactions.dox +++ b/docs/src/transactions.dox @@ -1,10 +1,10 @@ /* vim: set filetype=c.doxygen : */ -/*! \page transactions Transactions +/*! @page transactions Transactions Note: the initial release of WiredTiger does not include support for transactions. This page describes the behavior of a future release. -\section transactions_acid The ACID properties. +@section transactions_acid The ACID properties. Transactions provide a powerful abstraction for multiple threads to operate on data concurrently because they have the following properties: @@ -13,37 +13,39 @@ Transactions provide a powerful abstraction for multiple threads to operate on d - Isolation: developers can reason about transactions independently. - Durability: once a transaction commits, its updates are saved. -\section transactions_api The Transaction API +@section transactions_api The Transaction API To configure for transactions, the database must be created with transaction support enabled. This is done by passing the configuration string "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 diff --git a/examples/c/ex_process.c b/examples/c/ex_process.c index ae69ad4a792..b29054b651f 100644 --- a/examples/c/ex_process.c +++ b/examples/c/ex_process.c @@ -1,5 +1,6 @@ /* - * ex_process.c Copyright (c) 2010 WiredTiger, Inc. All rights reserved. + * ex_process.c + * Copyright (c) 2010 WiredTiger, Inc. All rights reserved. * * This is an example demonstrating how to connect to a database from multiple * processes. diff --git a/examples/c/ex_schema.c b/examples/c/ex_schema.c index 00b721aa09f..87e17cc99b6 100644 --- a/examples/c/ex_schema.c +++ b/examples/c/ex_schema.c @@ -1,5 +1,6 @@ /* - * ex_column.c Copyright (c) 2010 WiredTiger, Inc. All rights reserved. + * ex_schema.c + * Copyright (c) 2010 WiredTiger, Inc. All rights reserved. * * This is an example application demonstrating how to create and access * tables using a schema. diff --git a/examples/c/ex_sequence.c b/examples/c/ex_sequence.c index 904efb2d5d8..670c7c46720 100644 --- a/examples/c/ex_sequence.c +++ b/examples/c/ex_sequence.c @@ -1,5 +1,6 @@ /* - * ex_sequence.c Copyright (c) 2010 WiredTiger, Inc. All rights reserved. + * ex_sequence.c + * Copyright (c) 2010 WiredTiger, Inc. All rights reserved. * * This is an example demonstrating how to create and access a sequence. */ diff --git a/examples/c/ex_stat.c b/examples/c/ex_stat.c index 980dad036ff..d6983c04f5e 100644 --- a/examples/c/ex_stat.c +++ b/examples/c/ex_stat.c @@ -1,5 +1,6 @@ /* - * ex_stat.c Copyright (c) 2010 WiredTiger, Inc. All rights reserved. + * ex_stat.c + * Copyright (c) 2010 WiredTiger, Inc. All rights reserved. * * This is an example demonstrating how to query a database's statistics. */ diff --git a/examples/c/ex_thread.c b/examples/c/ex_thread.c index 0e1e277a114..ed49c604837 100644 --- a/examples/c/ex_thread.c +++ b/examples/c/ex_thread.c @@ -1,5 +1,6 @@ /* - * ex_access.c Copyright (c) 2010 WiredTiger, Inc. All rights reserved. + * ex_thread.c + * Copyright (c) 2010 WiredTiger, Inc. All rights reserved. * * This is an example demonstrating how to create and access a simple table. */ @@ -52,8 +53,8 @@ int main() "key_format=S,value_format=S"); ret = session->open_cursor(session, "table:access", "overwrite", &cursor); - 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); ret = session->close(session, NULL); diff --git a/examples/c/ex_transaction.c b/examples/c/ex_transaction.c index 5aa51abb7a6..7403fe22194 100644 --- a/examples/c/ex_transaction.c +++ b/examples/c/ex_transaction.c @@ -1,7 +1,8 @@ /* - * ex_hello.c Copyright (c) 2010 WiredTiger, Inc. All rights reserved. + * ex_transaction.c + * Copyright (c) 2010 WiredTiger, Inc. All rights reserved. * - * This is an example demonstrating how to create and connect to a database. + * This is an example demonstrating how to use transactions. */ #include @@ -18,7 +19,7 @@ int main() WT_SESSION *session; /* Open a connection to the database, creating it if necessary. */ - if ((ret = wiredtiger_open(home, NULL, "create", &conn)) != 0) + if ((ret = wiredtiger_open(home, NULL, "create,transactional", &conn)) != 0) fprintf(stderr, "Error connecting to %s: %s\n", home, wiredtiger_strerror(ret)); @@ -28,6 +29,7 @@ int main() home, wiredtiger_strerror(ret)); session->begin_transaction(session, NULL); + /* ... */ session->commit_transaction(session); /* Note: closing the connection implicitly closes open session(s). */ diff --git a/include/cur_std.h b/include/cur_std.h index bc2ed32c866..0aec7b32deb 100644 --- a/include/cur_std.h +++ b/include/cur_std.h @@ -12,6 +12,8 @@ struct WT_CURSOR_STD { void *valuebuf; size_t valuebufsz; -#define WT_CURSTD_RAW 0x1 +#define WT_CURSTD_BADKEY 0x1 +#define WT_CURSTD_BADVALUE 0x2 +#define WT_CURSTD_RAW 0x4 uint32_t flags; }; diff --git a/include/wiredtiger.h b/include/wiredtiger.h index f4a89ce6eba..26b5c7da95c 100644 --- a/include/wiredtiger.h +++ b/include/wiredtiger.h @@ -2,13 +2,13 @@ /* vim: set filetype=c.doxygen : */ -/*! \defgroup wt WiredTiger API - * @{ - */ - #ifndef _WIREDTIGER_H_ #define _WIREDTIGER_H_ +/*! @file wiredtiger.h + * The complete reference manual for the WiredTiger API. + */ + #include #include #include @@ -57,8 +57,7 @@ struct WT_ITEM { }; /*! - * - * The WT_CURSOR struct is the interface to a cursor. + * The WT_CURSOR class is the interface to a cursor. * * Cursors allow data to be searched, stepped through and updated: the * so-called CRUD operations (create, read, update and delete). Data is @@ -81,126 +80,158 @@ struct WT_CURSOR { /*! * 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. + * of "u" is assumed, and applications use WT_ITEM to manipulate raw + * byte arrays. */ const char *key_format; /*! * 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. + * of "u" is assumed, and applications use WT_ITEM to manipulate raw + * byte arrays. */ const char *value_format; - /*! \name Data access + /*! @name Data access * @{ */ /*! Get the key for the current record. * - * \param cursor the cursor handle - * \errors + * @param cursor the cursor handle + * @errors */ int __F(get_key)(WT_CURSOR *cursor, ...); /*! Get the value for the current record. * - * \param cursor the cursor handle - * \errors + * @param cursor the cursor handle + * @errors */ int __F(get_value)(WT_CURSOR *cursor, ...); /*! Set the key for the next operation. * - * \param cursor the cursor handle - * \errors + * @param cursor the cursor handle + * + * If an error occurs during this operation, a flag will be set in the + * cursor, and the next operation to access the key will fail. This + * simplifies error handling in applications. */ - int __F(set_key)(WT_CURSOR *cursor, ...); + void __F(set_key)(WT_CURSOR *cursor, ...); /*! Set the data for the next operation. * - * \param cursor the cursor handle - * \errors + * @param cursor the cursor handle + * + * If an error occurs during this operation, a flag will be set in the + * cursor, and the next operation to access the value will fail. This + * simplifies error handling in applications. */ - int __F(set_value)(WT_CURSOR *cursor, ...); + void __F(set_value)(WT_CURSOR *cursor, ...); /*! @} */ - /*! \name Cursor positioning + /*! @name Cursor positioning * @{ */ /*! Move to the first record. * - * \param cursor the cursor handle - * \errors + * @param cursor the cursor handle + * @errors */ int __F(first)(WT_CURSOR *cursor); /*! Move to the last record. * - * \param cursor the cursor handle - * \errors + * @param cursor the cursor handle + * @errors */ int __F(last)(WT_CURSOR *cursor); /*! Move to the next record. * - * \param cursor the cursor handle - * \errors + * @param cursor the cursor handle + * @errors */ int __F(next)(WT_CURSOR *cursor); /*! Move to the previous record. * - * \param cursor the cursor handle - * \errors + * @param cursor the cursor handle + * @errors */ int __F(prev)(WT_CURSOR *cursor); /*! Search for a record. * - * \param cursor the cursor handle - * \param exactp the status of the search: 0 if an exact match is - * found, -1 if a smaller key is found, +1 if a larger key is found - * \errors + * @param cursor the cursor handle + * @errors */ - int __F(search)(WT_CURSOR *cursor, int *exactp); + int __F(search)(WT_CURSOR *cursor); + + /*! Search for a record. + * + * @param cursor the cursor handle + * @param exactp the status of the search: 0 if an exact match is + * found, -1 if a smaller key is found, +1 if a larger key is found + * @errors + */ + int __F(search_near)(WT_CURSOR *cursor, int *exactp); /*! @} */ - /*! \name Data modification + /*! @name Data modification * @{ */ /*! Insert a record. * - * \param cursor the cursor handle - * \errors + * @todo describe append + * @todo describe how to unconditionally overwrite + * + * @param cursor the cursor handle + * @errors */ int __F(insert)(WT_CURSOR *cursor); - /*! Update the current record. + /*! Update the current record. The cursor must be positioned on a + * record and the value of the record will be updated. If the record + * is part of a sorted duplicate set, its position must not change as + * a result of the update. * - * \param cursor the cursor handle - * \errors + * @param cursor the cursor handle + * @errors */ int __F(update)(WT_CURSOR *cursor); /*! Delete the current record. * - * \param cursor the cursor handle - * \errors + * @param cursor the cursor handle + * @errors */ int __F(del)(WT_CURSOR *cursor); /*! @} */ /*! Close the cursor. * - * \param cursor the cursor handle - * \configempty - * \errors + * @param cursor the cursor handle + * @configempty + * @errors */ int __F(close)(WT_CURSOR *cursor, const char *config); + + /*! Change configuration options for the cursor + * + * @param cursor the cursor handle + * @configstart + * @config{dup,,duplicate handling\, one of "all" or "first" or "last"; + * default "all"} + * @config{overwrite,,if an existing key is inserted\, + * overwrite the existing value} + * @configend + * @errors + */ + int __F(configure)(WT_CURSOR *cursor, const char *config); }; /*! @@ -217,13 +248,13 @@ struct WT_SESSION { /*! Close the session. * - * \param session the session handle - * \configempty - * \errors + * @param session the session handle + * @configempty + * @errors */ int __F(close)(WT_SESSION *session, const char *config); - /*! \name Cursor handles + /*! @name Cursor handles * @{ */ @@ -247,165 +278,158 @@ struct WT_SESSION { * statistics:[table:\]database or table statistics (key=(string)keyname, data=(int64_t)value) * * - * See \ref cursor_types for more information. + * See @ref cursor_types for more information. * - * \param session the session handle - * \param uri the data source on which the cursor operates - * \param session the session handle - * \configstart - * \config{dup,["all"] or "first" or "last",duplicate handling} - * \config{isolation,"snapshot" or ["read-committed"] or - * "read-uncommitted",the isolation level for this cursor. Ignored for - * transactional cursors} - * \config{overwrite,["0"] or "1",if an existing key is inserted\, - * overwrite the existing value} - * \config{raw,["0"] or "1",ignore the encodings for the key and - * value\, return data as if the formats were 'u'} - * \configend - * \param cursorp a pointer to the newly opened cursor - * \errors + * @param session the session handle + * @param uri the data source on which the cursor operates + * @param session the session handle + * @configstart + * @config{isolation,,the isolation level for this cursor\, one of + * "snapshot" or "read-committed" or "read-uncommitted"; default + * "read-committed". Ignored for transactional cursors} + * @config{raw,,ignore the encodings for the key and + * value\, manage data as if the formats were \c "u"} + * @configend + * @param cursorp a pointer to the newly opened cursor + * @errors */ int __F(open_cursor)(WT_SESSION *session, const char *uri, const char *config, WT_CURSOR **cursorp); /*! Duplicate a cursor. * - * \param session the session handle - * \param cursor the cursor handle to duplicate - * \configstart - * \config{dup,["all"] or "first" or "last",duplicate handling} - * \config{overwrite,["0"] or "1",if an existing key is inserted\, - * overwrite the existing value} - * \config{raw,["0"] or "1",ignore the encodings for the key and - * value\, return data as if the formats were 'u'} - * \configend - * \param dupp a pointer to the new cursor - * \errors + * @param session the session handle + * @param cursor the cursor handle to duplicate + * @configempty + * @param dupp a pointer to the new cursor + * @errors */ int __F(dup_cursor)(WT_SESSION *session, WT_CURSOR *cursor, const char *config, WT_CURSOR **dupp); /*! @} */ - /*! \name Table operations + /*! @name Table operations * @{ */ /*! Add a new schema. * - * \param session the session handle - * \param name the name of the new schema - * \configstart - * \config{key_format,,The format of the data packed into key items. + * @param session the session handle + * @param name the name of the new schema + * @configstart + * @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 "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. + * value of "u" is assumed\, and applications use WT_ITEM 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 "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. + * value of "u" is assumed\, and applications use WT_ITEM 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 + * @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"] - * or
        "read-committed" or "read-uncommitted",the isolation level for - * this transaction} - * \config{name,[none],name of the transaction for tracing and debugging} - * \config{sync,["full"] or "flush" or "write" or "none",how to sync - * log records when the transaction commits} - * \config{priority,integer between -100 and 100 ["0"],priority of the - * transaction for resolving conflicts} - * \configend - * \errors + * @param session the session handle + * @configstart + * @config{isolation,,the isolation level for this transaction\, one of + * "serializable"\, "snapshot"\, "read-committed" or + * "read-uncommitted"; default "serializable"} + * @config{name,,name of the transaction for tracing and debugging} + * @config{sync,,how to sync log records when the transaction commits\, + * one of "full"\, "flush"\, "write" or "none"; default "full"} + * @config{priority,,priority of the transaction for resolving + * conflicts\, an integer between -100 and 100; default 0} + * @configend + * @errors */ int __F(begin_transaction)(WT_SESSION *session, const char *config); @@ -439,8 +463,8 @@ struct WT_SESSION { * * Ignored if no transaction is in progress. * - * \param session the session handle - * \errors + * @param session the session handle + * @errors */ int __F(commit_transaction)(WT_SESSION *session); @@ -451,26 +475,28 @@ struct WT_SESSION { * * Ignored if no transaction is in progress. * - * \param session the session handle - * \errors + * @param session the session handle + * @errors */ int __F(rollback_transaction)(WT_SESSION *session); /*! Flush the cache and/or the log and optionally archive log files. * - * \param session the session handle - * \configstart - * \config{archive,["0"] or "1",remove old log files} - * \config{force,["0"] or "1",write a new checkpoint even if nothing - * has changed since the last one} - * \config{flush_cache,"0" or ["1"],flush the cache} - * \config{flush_log,"0" or ["1"],flush the log} - * \config{log_size,[none],only proceed if more than the specified - * amount of log records have been written since the last checkpoint} - * \config{timeout,[none],only proceed if more than the specified - * number of milliseconds have elapsed since the last checkpoint} - * \configend - * \errors + * @param session the session handle + * @configstart + * @config{archive,,remove log files no longer required for + * transactional durabilty} + * @config{force,,write a new checkpoint even if nothing + * has changed since the last one} + * @config{flush_cache,,flush the cache; default on} + * @config{flush_log,,flush the log; default on} + * @config{log_size,,only proceed if more than the specified + * amount of log records have been written since the last + * checkpoint} + * @config{timeout,,only proceed if more than the specified + * number of milliseconds have elapsed since the last checkpoint} + * @configend + * @errors */ int __F(checkpoint)(WT_SESSION *session, const char *config); /*! @} */ @@ -489,52 +515,52 @@ struct WT_SESSION { struct WT_CONNECTION { /*! Load an extension. * - * \param connection the connection handle - * \param path the filename of the extension module - * \configstart - * \config{entry,["wiredtiger_extension_init"],the entry point of the - * extension} - * \config{prefix,[none],a prefix for all names registered by this + * @param connection the connection handle + * @param path the filename of the extension module + * @configstart + * @config{entry,,the entry point of the + * extension; default \c "wiredtiger_extension_init"} + * @config{prefix,,a prefix for all names registered by this * extension (e.g.\, to make namespaces distinct or during upgrades} - * \configend - * \errors + * @configend + * @errors */ int __F(load_extension)(WT_CONNECTION *connection, const char *path, const char *config); /*! Add a new type of cursor. * - * \param connection the connection handle - * \param prefix the prefix for location strings passed to + * @param connection the connection handle + * @param prefix the prefix for location strings passed to * WT_SESSION::open_cursor - * \param factory the application-supplied code to manage cursors of + * @param factory the application-supplied code to manage cursors of * this type - * \configempty - * \errors + * @configempty + * @errors */ int __F(add_cursor_factory)(WT_CONNECTION *connection, const char *prefix, WT_CURSOR_FACTORY *factory, const char *config); /*! Add a custom collation function. * - * \param connection the connection handle - * \param name the name of the collation to be used in calls to + * @param connection the connection handle + * @param name the name of the collation to be used in calls to * WT_SESSION::add_schema - * \param collator the application-supplied collation handler - * \configempty - * \errors + * @param collator the application-supplied collation handler + * @configempty + * @errors */ int __F(add_collation)(WT_CONNECTION *connection, const char *name, WT_COLLATOR *collator, const char *config); /*! Add a custom extractor for index keys or column sets. * - * \param connection the connection handle - * \param name the name of the extractor to be used in calls to + * @param connection the connection handle + * @param name the name of the extractor to be used in calls to * WT_SESSION::add_schema - * \param extractor the application-supplied extractor - * \configempty - * \errors + * @param extractor the application-supplied extractor + * @configempty + * @errors */ int __F(add_extractor)(WT_CONNECTION *connection, const char *name, WT_EXTRACTOR *extractor, const char *config); @@ -544,23 +570,23 @@ struct WT_CONNECTION { * * Any open sessions will be closed. * - * \param connection the connection handle - * \configempty - * \errors + * @param connection the connection handle + * @configempty + * @errors */ int __F(close)(WT_CONNECTION *connection, const char *config); /*! The home directory of the connection. * - * \param connection the connection handle - * \returns a pointer to a string naming the home directory + * @param connection the connection handle + * @returns a pointer to a string naming the home directory */ const char *__F(get_home)(WT_CONNECTION *connection); /*! Did opening this handle create the database? * - * \param connection the connection handle - * \returns false (zero) if the connection existed before the call to + * @param connection the connection handle + * @returns false (zero) if the connection existed before the call to * ::wiredtiger_open, true (non-zero) if it was created by opening * this handle. */ @@ -568,12 +594,12 @@ struct WT_CONNECTION { /*! Open a session. * - * \param connection the connection handle - * \param errhandler An error handler. If NULL, 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;