/* * __curfile_remove -- * WT_CURSOR->remove method for the btree cursor type. */ static int __curfile_remove(WT_CURSOR *cursor) { WT_CURSOR_BTREE *cbt; WT_DECL_RET; WT_SESSION_IMPL *session; cbt = (WT_CURSOR_BTREE *)cursor; CURSOR_UPDATE_API_CALL(cursor, session, remove, cbt->btree); WT_CURSOR_NEEDKEY(cursor); WT_CURSOR_NOVALUE(cursor); WT_BTREE_CURSOR_SAVE_AND_RESTORE(cursor, __wt_btcur_remove(cbt), ret); /* * After a successful remove, copy the key: the value is not available. */ if (ret == 0) { if (F_ISSET(cursor, WT_CURSTD_KEY_INT) && !WT_DATA_IN_ITEM(&(cursor)->key)) { WT_ERR(__wt_buf_set(session, &cursor->key, cursor->key.data, cursor->key.size)); F_CLR(cursor, WT_CURSTD_KEY_INT); F_SET(cursor, WT_CURSTD_KEY_EXT); } F_CLR(cursor, WT_CURSTD_VALUE_SET); } err: CURSOR_UPDATE_API_END(session, ret); return (ret); }
/* * __curfile_insert -- * WT_CURSOR->insert method for the btree cursor type. */ static int __curfile_insert(WT_CURSOR *cursor) { WT_CURSOR_BTREE *cbt; WT_DECL_RET; WT_SESSION_IMPL *session; cbt = (WT_CURSOR_BTREE *)cursor; CURSOR_UPDATE_API_CALL(cursor, session, insert, cbt->btree); if (!F_ISSET(cursor, WT_CURSTD_APPEND)) WT_CURSOR_NEEDKEY(cursor); WT_CURSOR_NEEDVALUE(cursor); WT_BTREE_CURSOR_SAVE_AND_RESTORE(cursor, __wt_btcur_insert(cbt), ret); /* * Insert is the one cursor operation that doesn't end with the cursor * pointing to an on-page item. The standard macro handles errors * correctly, but we need to leave the application cursor unchanged in * the case of success, except for column-store appends, where we are * returning a key. */ if (ret == 0) { if (!F_ISSET(cursor, WT_CURSTD_APPEND)) { F_SET(cursor, WT_CURSTD_KEY_EXT); F_CLR(cursor, WT_CURSTD_KEY_INT); } F_SET(cursor, WT_CURSTD_VALUE_EXT); F_CLR(cursor, WT_CURSTD_VALUE_INT); } err: CURSOR_UPDATE_API_END(session, ret); return (ret); }
/* * __curds_insert -- * WT_CURSOR.insert method for the data-source cursor type. */ static int __curds_insert(WT_CURSOR *cursor) { WT_CURSOR *source; WT_DECL_RET; WT_SESSION_IMPL *session; source = ((WT_CURSOR_DATA_SOURCE *)cursor)->source; CURSOR_UPDATE_API_CALL(cursor, session, insert); WT_ERR(__curds_txn_enter(session, true)); WT_STAT_CONN_INCR(session, cursor_insert); WT_STAT_DATA_INCR(session, cursor_insert); WT_STAT_DATA_INCRV(session, cursor_insert_bytes, cursor->key.size + cursor->value.size); if (!F_ISSET(cursor, WT_CURSTD_APPEND)) WT_ERR(__curds_key_set(cursor)); WT_ERR(__curds_value_set(cursor)); ret = __curds_cursor_resolve(cursor, source->insert(source)); err: __curds_txn_leave(session); CURSOR_UPDATE_API_END(session, ret); return (ret); }
/* * __curds_update -- * WT_CURSOR.update method for the data-source cursor type. */ static int __curds_update(WT_CURSOR *cursor) { WT_CURSOR *source; WT_DECL_RET; WT_SESSION_IMPL *session; source = ((WT_CURSOR_DATA_SOURCE *)cursor)->source; CURSOR_UPDATE_API_CALL(cursor, session, update); WT_STAT_CONN_INCR(session, cursor_update); WT_STAT_DATA_INCR(session, cursor_update); WT_STAT_DATA_INCRV(session, cursor_update_bytes, cursor->value.size); WT_ERR(__curds_txn_enter(session, true)); WT_ERR(__curds_key_set(cursor)); WT_ERR(__curds_value_set(cursor)); ret = __curds_cursor_resolve(cursor, source->update(source)); err: __curds_txn_leave(session); CURSOR_UPDATE_API_END(session, ret); return (ret); }
/* * __curfile_insert -- * WT_CURSOR->insert method for the btree cursor type. */ static int __curfile_insert(WT_CURSOR *cursor) { WT_CURSOR_BTREE *cbt; WT_DECL_RET; WT_SESSION_IMPL *session; cbt = (WT_CURSOR_BTREE *)cursor; CURSOR_UPDATE_API_CALL(cursor, session, insert, cbt->btree); if (!F_ISSET(cursor, WT_CURSTD_APPEND)) WT_CURSOR_NEEDKEY(cursor); WT_CURSOR_NEEDVALUE(cursor); WT_BTREE_CURSOR_SAVE_AND_RESTORE(cursor, __wt_btcur_insert(cbt), ret); /* * Insert is the one cursor operation that doesn't end with the cursor * pointing to an on-page item (except for column-store appends, where * we are returning a key). That is, the application's cursor continues * to reference the application's memory after a successful cursor call, * which isn't true anywhere else. We don't want to have to explain that * scoping corner case, so we reset the application's cursor so it can * free the referenced memory and continue on without risking subsequent * core dumps. */ if (ret == 0) { if (!F_ISSET(cursor, WT_CURSTD_APPEND)) F_CLR(cursor, WT_CURSTD_KEY_INT); F_CLR(cursor, WT_CURSTD_VALUE_INT); } err: CURSOR_UPDATE_API_END(session, ret); return (ret); }
/* * __curds_remove -- * WT_CURSOR.remove method for the data-source cursor type. */ static int __curds_remove(WT_CURSOR *cursor) { WT_DECL_RET; WT_SESSION_IMPL *session; CURSOR_UPDATE_API_CALL(cursor, session, remove, NULL); WT_ERR(__curds_key_set(cursor)); WT_ERR(cursor->data_source->remove(cursor->data_source)); err: CURSOR_UPDATE_API_END(session, ret); return (ret); }
/* * __curfile_remove -- * WT_CURSOR->remove method for the btree cursor type. */ static int __curfile_remove(WT_CURSOR *cursor) { WT_CURSOR_BTREE *cbt; WT_DECL_RET; WT_SESSION_IMPL *session; cbt = (WT_CURSOR_BTREE *)cursor; CURSOR_UPDATE_API_CALL(cursor, session, remove, cbt->btree); WT_CURSOR_NEEDKEY(cursor); ret = __wt_btcur_remove((WT_CURSOR_BTREE *)cursor); err: CURSOR_UPDATE_API_END(session, ret); return (ret); }
/* * __curfile_insert -- * WT_CURSOR->insert method for the btree cursor type. */ static int __curfile_insert(WT_CURSOR *cursor) { WT_CURSOR_BTREE *cbt; WT_DECL_RET; WT_SESSION_IMPL *session; cbt = (WT_CURSOR_BTREE *)cursor; CURSOR_UPDATE_API_CALL(cursor, session, insert, cbt->btree); if (!F_ISSET(cursor, WT_CURSTD_APPEND)) WT_CURSOR_NEEDKEY(cursor); WT_CURSOR_NEEDVALUE(cursor); ret = __wt_btcur_insert((WT_CURSOR_BTREE *)cursor); err: CURSOR_UPDATE_API_END(session, ret); return (ret); }
/* * __curfile_update -- * WT_CURSOR->update method for the btree cursor type. */ static int __curfile_update(WT_CURSOR *cursor) { WT_CURSOR_BTREE *cbt; WT_DECL_RET; WT_SESSION_IMPL *session; cbt = (WT_CURSOR_BTREE *)cursor; CURSOR_UPDATE_API_CALL(cursor, session, update, cbt->btree); WT_CURSOR_NEEDKEY(cursor); WT_CURSOR_NEEDVALUE(cursor); WT_BTREE_CURSOR_SAVE_AND_RESTORE(cursor, __wt_btcur_update(cbt), ret); err: CURSOR_UPDATE_API_END(session, ret); return (ret); }
/* * __curds_insert -- * WT_CURSOR.insert method for the data-source cursor type. */ static int __curds_insert(WT_CURSOR *cursor) { WT_DECL_RET; WT_SESSION_IMPL *session; CURSOR_UPDATE_API_CALL(cursor, session, insert, NULL); /* If not appending, we require a key. */ if (!F_ISSET(cursor, WT_CURSTD_APPEND)) WT_ERR(__curds_key_set(cursor)); WT_ERR(__curds_value_set(cursor)); WT_ERR(cursor->data_source->insert(cursor->data_source)); /* If appending, we allocated a key. */ if (F_ISSET(cursor, WT_CURSTD_APPEND)) __curds_key_get(cursor); err: CURSOR_UPDATE_API_END(session, ret); return (ret); }