diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2015-05-18 15:10:02 +1000 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2015-05-18 15:10:02 +1000 |
commit | 4f0e70b66182cbb872c4e5eefda23f1c58bdaab7 (patch) | |
tree | a32874e94f24d545e205e05d71916877525f85a7 /src/third_party/wiredtiger/src/include/wiredtiger.in | |
parent | 727c1dc8ce2df4e44516e1527d917294f7c45558 (diff) | |
download | mongo-4f0e70b66182cbb872c4e5eefda23f1c58bdaab7.tar.gz |
Import wiredtiger-wiredtiger-2.6.0-19-g35cc116.tar.gz from wiredtiger branch mongodb-3.2
Diffstat (limited to 'src/third_party/wiredtiger/src/include/wiredtiger.in')
-rw-r--r-- | src/third_party/wiredtiger/src/include/wiredtiger.in | 326 |
1 files changed, 265 insertions, 61 deletions
diff --git a/src/third_party/wiredtiger/src/include/wiredtiger.in b/src/third_party/wiredtiger/src/include/wiredtiger.in index 6037cdeee96..a6f80039c10 100644 --- a/src/third_party/wiredtiger/src/include/wiredtiger.in +++ b/src/third_party/wiredtiger/src/include/wiredtiger.in @@ -67,6 +67,7 @@ struct __wt_config_parser; struct __wt_connection; typedef struct __wt_connection WT_CONNECTION; struct __wt_cursor; typedef struct __wt_cursor WT_CURSOR; struct __wt_data_source; typedef struct __wt_data_source WT_DATA_SOURCE; +struct __wt_encryptor; typedef struct __wt_encryptor WT_ENCRYPTOR; struct __wt_event_handler; typedef struct __wt_event_handler WT_EVENT_HANDLER; struct __wt_extension_api; typedef struct __wt_extension_api WT_EXTENSION_API; struct __wt_extractor; typedef struct __wt_extractor WT_EXTRACTOR; @@ -1027,6 +1028,21 @@ struct __wt_session { * the Btree row-store leaf page value dictionary; see @ref * file_formats_compression for more information., an integer greater * than or equal to 0; default \c 0.} + * @config{encryption = (, configure an encryptor for file blocks. When + * a table is created\, its encryptor is not implicitly used for any + * related indices or column groups., a set of related configuration + * options defined below.} + * @config{ keyid, An + * identifier that identifies a unique instance of the encryptor. It is + * stored in clear text\, and thus is available when the wiredtiger + * database is reopened. On the first use of a (name\, keyid) + * combination\, the WT_ENCRYPTOR::customize function is called with the + * keyid as an argument., a string; default empty.} + * @config{ name, Permitted values are \c "none" + * or custom encryption engine name created with + * WT_CONNECTION::add_encryptor. See @ref encryption for more + * information., a string; default \c none.} + * @config{ ),,} * @config{exclusive, fail if the object exists. When false (the * default)\, if the object exists\, check that its settings match the * specified configuration., a boolean flag; default \c false.} @@ -1864,6 +1880,26 @@ struct __wt_connection { const char *name, WT_COMPRESSOR *compressor, const char *config); /*! + * Add an encryption function. + * + * The application must first implement the WT_ENCRYPTOR interface + * and then register the implementation with WiredTiger: + * + * @snippet nop_encrypt.c WT_ENCRYPTOR initialization structure + * + * @snippet nop_encrypt.c WT_ENCRYPTOR initialization function + * + * @param connection the connection handle + * @param name the name of the encryption function to be used in calls + * to WT_SESSION::create, may not be \c "none" + * @param encryptor the application-supplied encryption handler + * @configempty{WT_CONNECTION.add_encryptor, see dist/api_data.py} + * @errors + */ + int __F(add_encryptor)(WT_CONNECTION *connection, + const char *name, WT_ENCRYPTOR *encryptor, const char *config); + + /*! * Add a custom extractor for index keys or column groups. * * The application must first implement the WT_EXTRACTOR interface and @@ -1960,6 +1996,27 @@ struct __wt_connection { * opened at a checkpoint (i.e: read only) to use \c O_DIRECT., a list\, with * values chosen from the following options: \c "checkpoint"\, \c "data"\, \c * "log"; default empty.} + * @config{encryption = (, configure an encryptor for system wide metadata and + * logs. If a system wide encryptor is set\, it is also used for encrypting + * data files and tables\, unless encryption configuration is explicitly set for + * them when they are created with WT_SESSION::create., a set of related + * configuration options defined below.} + * @config{ keyid, + * An identifier that identifies a unique instance of the encryptor. It is + * stored in clear text\, and thus is available when the wiredtiger database is + * reopened. On the first use of a (name\, keyid) combination\, the + * WT_ENCRYPTOR::customize function is called with the keyid as an argument., a + * string; default empty.} + * @config{ name, Permitted + * values are \c "none" or custom encryption engine name created with + * WT_CONNECTION::add_encryptor. See @ref encryption for more information., a + * string; default \c none.} + * @config{ secretkey, A string + * that is passed to the WT_ENCRYPTOR::customize function. It is never stored + * in clear text\, so must be given to any subsequent wiredtiger_open calls to + * reopen the database. It must also be provided to any "wt" commands used with + * this database., a string; default empty.} + * @config{ ),,} * @config{error_prefix, prefix string for error messages., a string; default * empty.} * @config{eviction = (, eviction configuration options., a set of related @@ -2762,7 +2819,7 @@ struct __wt_collator { * comparisons. */ int (*customize)(WT_COLLATOR *collator, WT_SESSION *session, - const char *uri, WT_CONFIG_ITEM *appcfg, WT_COLLATOR **customp); + const char *uri, WT_CONFIG_ITEM *passcfg, WT_COLLATOR **customp); /*! * If non-NULL a callback performed when the data source is closed @@ -3006,7 +3063,7 @@ struct __wt_compressor { * discarded by WiredTiger. * * If not NULL, this callback is called before each call to - * WT_COMPRESS::compress to determine the size of the destination + * WT_COMPRESSOR::compress to determine the size of the destination * buffer to provide. If the callback is NULL, the destination * buffer will be the same size as the source buffer. * @@ -3147,6 +3204,155 @@ struct __wt_data_source { }; /*! + * The interface implemented by applications to provide custom encryption. + * + * Encryptors must implement the WT_ENCRYPTOR interface: the + * WT_ENCRYPTOR::encrypt, WT_ENCRYPTOR::decrypt and WT_ENCRYPTOR::sizing + * callbacks must be specified, WT_ENCRYPTOR::customize and + * WT_ENCRYPTOR::terminate are optional. To build your own encryptor, use + * one of the encryptors in \c ext/encryptors as a template: + * \c ext/encryptors/nop_encrypt is a simple encryptor that passes through + * data unchanged, and is a reasonable starting point; + * \c ext/encryptors/rotn_encrypt is an encryptor implementing + * a simple rotation cipher, it shows the use of \c keyid, \c secretkey, + * and implements the WT_ENCRYPTOR::customize and + * WT_ENCRYPTOR::terminate callbacks. + * + * Applications register their implementation with WiredTiger by calling + * WT_CONNECTION::add_encryptor. + * + * @snippet nop_encrypt.c WT_ENCRYPTOR initialization structure + * @snippet nop_encrypt.c WT_ENCRYPTOR initialization function + */ +struct __wt_encryptor { + /*! + * Callback to encrypt a chunk of data. + * + * WT_ENCRYPTOR::encrypt takes a source buffer and a destination + * buffer. The callback encrypts the source buffer (plain text) + * into the destination buffer. + * + * On entry, \c src will point to memory, with the length of the memory + * in \c src_len. After successful completion, the callback should + * return \c 0 and set \c result_lenp to the number of bytes required + * for the encrypted representation. + * + * On entry, \c dst points to the destination buffer with a length + * of \c dst_len. The destination buffer will be at least src_len + * plus the size returned by that WT_ENCRYPT::sizing. + * + * This callback cannot be NULL. + * + * @param[in] src the data to encrypt + * @param[in] src_len the length of the data to encrypt + * @param[in] dst the destination buffer + * @param[in] dst_len the length of the destination buffer + * @param[out] result_lenp the length of the encrypted data + * @returns zero for success, non-zero to indicate an error. + * + * @snippet nop_encrypt.c WT_ENCRYPTOR encrypt + */ + int (*encrypt)(WT_ENCRYPTOR *encryptor, WT_SESSION *session, + uint8_t *src, size_t src_len, + uint8_t *dst, size_t dst_len, + size_t *result_lenp); + + /*! + * Callback to decrypt a chunk of data. + * + * WT_ENCRYPTOR::decrypt takes a source buffer and a destination + * buffer. The contents are switched from \c encrypt: the + * source buffer is the encrypted value, and the destination buffer is + * sized to be the original size. If the callback successfully + * decrypts the source buffer to the destination buffer, it returns + * 0. If an error occurs, it returns an errno or WiredTiger error code. + * + * On entry, \c src will point to memory, with the length of the memory + * in \c src_len. After successful completion, the callback should + * return \c 0 and set \c result_lenp to the number of bytes required + * for the decrypted representation. + * + * If the \c dst buffer is not big enough to hold the decrypted + * data, the callback should return an error. + * + * This callback cannot be NULL. + * + * @param[in] src the data to decrypt + * @param[in] src_len the length of the data to decrypt + * @param[in] dst the destination buffer + * @param[in] dst_len the length of the destination buffer + * @param[out] result_lenp the length of the decrypted data + * @returns zero for success, non-zero to indicate an error. + * + * @snippet nop_encrypt.c WT_ENCRYPTOR decrypt + */ + int (*decrypt)(WT_ENCRYPTOR *encryptor, WT_SESSION *session, + uint8_t *src, size_t src_len, + uint8_t *dst, size_t dst_len, + size_t *result_lenp); + + /*! + * Callback to size a destination buffer for encryption. + * + * WT_ENCRYPTOR::sizing is an callback that returns the number + * of additional bytes that is needed when encrypting a + * text buffer. This is always necessary, since encryptors + * typically generate encrypted text that is larger than the + * plain text input. Without such a call, WiredTiger would + * have no way to know the worst case for the encrypted buffer size. + * The WiredTiger encryption infrastructure assumes that + * buffer sizing is not dependent on the number of bytes + * of input, that there is a one to one relationship in number + * of bytes needed between input and output. + * + * This callback cannot be NULL. + * + * The callback should set \c expansion_constantp to the additional + * number of bytes needed. + * + * @param[out] expansion_constantp the additional number of bytes needed + * when encrypting. + * @returns zero for success, non-zero to indicate an error. + * + * @snippet nop_encrypt.c WT_ENCRYPTOR sizing + */ + int (*sizing)(WT_ENCRYPTOR *encryptor, WT_SESSION *session, + size_t *expansion_constantp); + + /*! + * If non-NULL, this callback is called to customize the encryptor. + * The customize function is called whenever a keyid is used for the + * first time with this encryptor, whether it be in + * the ::wiredtiger_open call or the WT_SESSION::create + * call. This gives the algorithm an + * opportunity to retrieve and save keys in a customized encryptor. + * If the callback returns a non-NULL encryptor, that instance + * is used instead of this one for any callbacks. + * + * @param[in] encrypt_config the "encryption" portion of the + * configuration from the wiredtiger_open or + * WT_SESSION::create call + * @param[out] customp the new modified encryptor, or NULL. + * @returns zero for success, non-zero to indicate an error. + */ + int (*customize)(WT_ENCRYPTOR *encryptor, WT_SESSION *session, + WT_CONFIG_ARG *encrypt_config, WT_ENCRYPTOR **customp); + + /*! + * If non-NULL, a callback performed when the database is closed. + * It is called for each encryptor that was added using + * WT_CONNECTION::add_encryptor or returned by the + * WT_ENCRYPTOR::customize callback. + * + * The WT_ENCRYPTOR::terminate callback is intended to allow cleanup, + * the handle will not be subsequently accessed by WiredTiger. + * + * @snippet nop_encrypt.c WT_ENCRYPTOR terminate + */ + int (*terminate)(WT_ENCRYPTOR *encryptor, WT_SESSION *session); +}; + +/*! * The interface implemented by applications to provide custom extraction of * index keys or column group values. * @@ -3412,122 +3618,120 @@ extern int wiredtiger_extension_terminate(WT_CONNECTION *connection); #define WT_STAT_CONN_LOG_PREALLOC_MAX 1083 /*! log: pre-allocated log files used */ #define WT_STAT_CONN_LOG_PREALLOC_USED 1084 -/*! log: log read operations */ -#define WT_STAT_CONN_LOG_READS 1085 /*! log: log release advances write LSN */ -#define WT_STAT_CONN_LOG_RELEASE_WRITE_LSN 1086 +#define WT_STAT_CONN_LOG_RELEASE_WRITE_LSN 1085 /*! log: records processed by log scan */ -#define WT_STAT_CONN_LOG_SCAN_RECORDS 1087 +#define WT_STAT_CONN_LOG_SCAN_RECORDS 1086 /*! log: log scan records requiring two reads */ -#define WT_STAT_CONN_LOG_SCAN_REREADS 1088 +#define WT_STAT_CONN_LOG_SCAN_REREADS 1087 /*! log: log scan operations */ -#define WT_STAT_CONN_LOG_SCANS 1089 +#define WT_STAT_CONN_LOG_SCANS 1088 /*! log: consolidated slot closures */ -#define WT_STAT_CONN_LOG_SLOT_CLOSES 1090 +#define WT_STAT_CONN_LOG_SLOT_CLOSES 1089 /*! log: logging bytes consolidated */ -#define WT_STAT_CONN_LOG_SLOT_CONSOLIDATED 1091 +#define WT_STAT_CONN_LOG_SLOT_CONSOLIDATED 1090 /*! log: consolidated slot joins */ -#define WT_STAT_CONN_LOG_SLOT_JOINS 1092 +#define WT_STAT_CONN_LOG_SLOT_JOINS 1091 /*! log: consolidated slot join races */ -#define WT_STAT_CONN_LOG_SLOT_RACES 1093 +#define WT_STAT_CONN_LOG_SLOT_RACES 1092 /*! log: slots selected for switching that were unavailable */ -#define WT_STAT_CONN_LOG_SLOT_SWITCH_FAILS 1094 +#define WT_STAT_CONN_LOG_SLOT_SWITCH_FAILS 1093 /*! log: record size exceeded maximum */ -#define WT_STAT_CONN_LOG_SLOT_TOOBIG 1095 +#define WT_STAT_CONN_LOG_SLOT_TOOBIG 1094 /*! log: failed to find a slot large enough for record */ -#define WT_STAT_CONN_LOG_SLOT_TOOSMALL 1096 +#define WT_STAT_CONN_LOG_SLOT_TOOSMALL 1095 /*! log: consolidated slot join transitions */ -#define WT_STAT_CONN_LOG_SLOT_TRANSITIONS 1097 +#define WT_STAT_CONN_LOG_SLOT_TRANSITIONS 1096 /*! log: log sync operations */ -#define WT_STAT_CONN_LOG_SYNC 1098 +#define WT_STAT_CONN_LOG_SYNC 1097 /*! log: log sync_dir operations */ -#define WT_STAT_CONN_LOG_SYNC_DIR 1099 +#define WT_STAT_CONN_LOG_SYNC_DIR 1098 /*! log: log server thread advances write LSN */ -#define WT_STAT_CONN_LOG_WRITE_LSN 1100 +#define WT_STAT_CONN_LOG_WRITE_LSN 1099 /*! log: log write operations */ -#define WT_STAT_CONN_LOG_WRITES 1101 +#define WT_STAT_CONN_LOG_WRITES 1100 /*! LSM: sleep for LSM checkpoint throttle */ -#define WT_STAT_CONN_LSM_CHECKPOINT_THROTTLE 1102 +#define WT_STAT_CONN_LSM_CHECKPOINT_THROTTLE 1101 /*! LSM: sleep for LSM merge throttle */ -#define WT_STAT_CONN_LSM_MERGE_THROTTLE 1103 +#define WT_STAT_CONN_LSM_MERGE_THROTTLE 1102 /*! LSM: rows merged in an LSM tree */ -#define WT_STAT_CONN_LSM_ROWS_MERGED 1104 +#define WT_STAT_CONN_LSM_ROWS_MERGED 1103 /*! LSM: application work units currently queued */ -#define WT_STAT_CONN_LSM_WORK_QUEUE_APP 1105 +#define WT_STAT_CONN_LSM_WORK_QUEUE_APP 1104 /*! LSM: merge work units currently queued */ -#define WT_STAT_CONN_LSM_WORK_QUEUE_MANAGER 1106 +#define WT_STAT_CONN_LSM_WORK_QUEUE_MANAGER 1105 /*! LSM: tree queue hit maximum */ -#define WT_STAT_CONN_LSM_WORK_QUEUE_MAX 1107 +#define WT_STAT_CONN_LSM_WORK_QUEUE_MAX 1106 /*! LSM: switch work units currently queued */ -#define WT_STAT_CONN_LSM_WORK_QUEUE_SWITCH 1108 +#define WT_STAT_CONN_LSM_WORK_QUEUE_SWITCH 1107 /*! LSM: tree maintenance operations scheduled */ -#define WT_STAT_CONN_LSM_WORK_UNITS_CREATED 1109 +#define WT_STAT_CONN_LSM_WORK_UNITS_CREATED 1108 /*! LSM: tree maintenance operations discarded */ -#define WT_STAT_CONN_LSM_WORK_UNITS_DISCARDED 1110 +#define WT_STAT_CONN_LSM_WORK_UNITS_DISCARDED 1109 /*! LSM: tree maintenance operations executed */ -#define WT_STAT_CONN_LSM_WORK_UNITS_DONE 1111 +#define WT_STAT_CONN_LSM_WORK_UNITS_DONE 1110 /*! connection: memory allocations */ -#define WT_STAT_CONN_MEMORY_ALLOCATION 1112 +#define WT_STAT_CONN_MEMORY_ALLOCATION 1111 /*! connection: memory frees */ -#define WT_STAT_CONN_MEMORY_FREE 1113 +#define WT_STAT_CONN_MEMORY_FREE 1112 /*! connection: memory re-allocations */ -#define WT_STAT_CONN_MEMORY_GROW 1114 +#define WT_STAT_CONN_MEMORY_GROW 1113 /*! thread-yield: page acquire busy blocked */ -#define WT_STAT_CONN_PAGE_BUSY_BLOCKED 1115 +#define WT_STAT_CONN_PAGE_BUSY_BLOCKED 1114 /*! thread-yield: page acquire eviction blocked */ -#define WT_STAT_CONN_PAGE_FORCIBLE_EVICT_BLOCKED 1116 +#define WT_STAT_CONN_PAGE_FORCIBLE_EVICT_BLOCKED 1115 /*! thread-yield: page acquire locked blocked */ -#define WT_STAT_CONN_PAGE_LOCKED_BLOCKED 1117 +#define WT_STAT_CONN_PAGE_LOCKED_BLOCKED 1116 /*! thread-yield: page acquire read blocked */ -#define WT_STAT_CONN_PAGE_READ_BLOCKED 1118 +#define WT_STAT_CONN_PAGE_READ_BLOCKED 1117 /*! thread-yield: page acquire time sleeping (usecs) */ -#define WT_STAT_CONN_PAGE_SLEEP 1119 +#define WT_STAT_CONN_PAGE_SLEEP 1118 /*! connection: total read I/Os */ -#define WT_STAT_CONN_READ_IO 1120 +#define WT_STAT_CONN_READ_IO 1119 /*! reconciliation: page reconciliation calls */ -#define WT_STAT_CONN_REC_PAGES 1121 +#define WT_STAT_CONN_REC_PAGES 1120 /*! reconciliation: page reconciliation calls for eviction */ -#define WT_STAT_CONN_REC_PAGES_EVICTION 1122 +#define WT_STAT_CONN_REC_PAGES_EVICTION 1121 /*! reconciliation: split bytes currently awaiting free */ -#define WT_STAT_CONN_REC_SPLIT_STASHED_BYTES 1123 +#define WT_STAT_CONN_REC_SPLIT_STASHED_BYTES 1122 /*! reconciliation: split objects currently awaiting free */ -#define WT_STAT_CONN_REC_SPLIT_STASHED_OBJECTS 1124 +#define WT_STAT_CONN_REC_SPLIT_STASHED_OBJECTS 1123 /*! connection: pthread mutex shared lock read-lock calls */ -#define WT_STAT_CONN_RWLOCK_READ 1125 +#define WT_STAT_CONN_RWLOCK_READ 1124 /*! connection: pthread mutex shared lock write-lock calls */ -#define WT_STAT_CONN_RWLOCK_WRITE 1126 +#define WT_STAT_CONN_RWLOCK_WRITE 1125 /*! session: open cursor count */ -#define WT_STAT_CONN_SESSION_CURSOR_OPEN 1127 +#define WT_STAT_CONN_SESSION_CURSOR_OPEN 1126 /*! session: open session count */ -#define WT_STAT_CONN_SESSION_OPEN 1128 +#define WT_STAT_CONN_SESSION_OPEN 1127 /*! transaction: transaction begins */ -#define WT_STAT_CONN_TXN_BEGIN 1129 +#define WT_STAT_CONN_TXN_BEGIN 1128 /*! transaction: transaction checkpoints */ -#define WT_STAT_CONN_TXN_CHECKPOINT 1130 +#define WT_STAT_CONN_TXN_CHECKPOINT 1129 /*! transaction: transaction checkpoint generation */ -#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1131 +#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1130 /*! transaction: transaction checkpoint currently running */ -#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1132 +#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1131 /*! transaction: transaction checkpoint max time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1133 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1132 /*! transaction: transaction checkpoint min time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1134 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1133 /*! transaction: transaction checkpoint most recent time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1135 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1134 /*! transaction: transaction checkpoint total time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1136 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1135 /*! transaction: transactions committed */ -#define WT_STAT_CONN_TXN_COMMIT 1137 +#define WT_STAT_CONN_TXN_COMMIT 1136 /*! transaction: transaction failures due to cache overflow */ -#define WT_STAT_CONN_TXN_FAIL_CACHE 1138 +#define WT_STAT_CONN_TXN_FAIL_CACHE 1137 /*! transaction: transaction range of IDs currently pinned by a checkpoint */ -#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1139 +#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1138 /*! transaction: transaction range of IDs currently pinned */ -#define WT_STAT_CONN_TXN_PINNED_RANGE 1140 +#define WT_STAT_CONN_TXN_PINNED_RANGE 1139 /*! transaction: transactions rolled back */ -#define WT_STAT_CONN_TXN_ROLLBACK 1141 +#define WT_STAT_CONN_TXN_ROLLBACK 1140 /*! connection: total write I/Os */ -#define WT_STAT_CONN_WRITE_IO 1142 +#define WT_STAT_CONN_WRITE_IO 1141 /*! * @} |