1 /* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 // vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
3 #ident "$Id$"
4 /*======
5 This file is part of PerconaFT.
6 
7 
8 Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
9 
10     PerconaFT is free software: you can redistribute it and/or modify
11     it under the terms of the GNU General Public License, version 2,
12     as published by the Free Software Foundation.
13 
14     PerconaFT is distributed in the hope that it will be useful,
15     but WITHOUT ANY WARRANTY; without even the implied warranty of
16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17     GNU General Public License for more details.
18 
19     You should have received a copy of the GNU General Public License
20     along with PerconaFT.  If not, see <http://www.gnu.org/licenses/>.
21 
22 ----------------------------------------
23 
24     PerconaFT is free software: you can redistribute it and/or modify
25     it under the terms of the GNU Affero General Public License, version 3,
26     as published by the Free Software Foundation.
27 
28     PerconaFT is distributed in the hope that it will be useful,
29     but WITHOUT ANY WARRANTY; without even the implied warranty of
30     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
31     GNU Affero General Public License for more details.
32 
33     You should have received a copy of the GNU Affero General Public License
34     along with PerconaFT.  If not, see <http://www.gnu.org/licenses/>.
35 ======= */
36 
37 #ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
38 
39 #pragma once
40 
41 typedef enum {
42     YDB_LAYER_NUM_INSERTS = 0,
43     YDB_LAYER_NUM_INSERTS_FAIL,
44     YDB_LAYER_NUM_DELETES,
45     YDB_LAYER_NUM_DELETES_FAIL,
46     YDB_LAYER_NUM_UPDATES,
47     YDB_LAYER_NUM_UPDATES_FAIL,
48     YDB_LAYER_NUM_UPDATES_BROADCAST,
49     YDB_LAYER_NUM_UPDATES_BROADCAST_FAIL,
50     YDB_LAYER_NUM_MULTI_INSERTS,
51     YDB_LAYER_NUM_MULTI_INSERTS_FAIL,
52     YDB_LAYER_NUM_MULTI_DELETES,
53     YDB_LAYER_NUM_MULTI_DELETES_FAIL,
54     YDB_LAYER_NUM_MULTI_UPDATES,
55     YDB_LAYER_NUM_MULTI_UPDATES_FAIL,
56     YDB_WRITE_LAYER_STATUS_NUM_ROWS              /* number of rows in this status array */
57 } ydb_write_lock_layer_status_entry;
58 
59 typedef struct {
60     bool initialized;
61     TOKU_ENGINE_STATUS_ROW_S status[YDB_WRITE_LAYER_STATUS_NUM_ROWS];
62 } YDB_WRITE_LAYER_STATUS_S, *YDB_WRITE_LAYER_STATUS;
63 
64 void ydb_write_layer_get_status(YDB_WRITE_LAYER_STATUS statp);
65 
66 int toku_db_del(DB *db, DB_TXN *txn, DBT *key, uint32_t flags, bool holds_mo_lock);
67 int toku_db_put(DB *db, DB_TXN *txn, DBT *key, DBT *val, uint32_t flags, bool holds_mo_lock);
68 int autotxn_db_del(DB* db, DB_TXN* txn, DBT* key, uint32_t flags);
69 int autotxn_db_put(DB* db, DB_TXN* txn, DBT* key, DBT* data, uint32_t flags);
70 int autotxn_db_update(DB *db, DB_TXN *txn, const DBT *key, const DBT *update_function_extra, uint32_t flags);
71 int autotxn_db_update_broadcast(DB *db, DB_TXN *txn, const DBT *update_function_extra, uint32_t flags);
72 int env_put_multiple(
73     DB_ENV *env,
74     DB *src_db,
75     DB_TXN *txn,
76     const DBT *src_key, const DBT *src_val,
77     uint32_t num_dbs,
78     DB **db_array,
79     DBT_ARRAY *keys, DBT_ARRAY *vals,
80     uint32_t *flags_array
81     );
82 int env_del_multiple(
83     DB_ENV *env,
84     DB *src_db,
85     DB_TXN *txn,
86     const DBT *src_key,
87     const DBT *src_val,
88     uint32_t num_dbs,
89     DB **db_array,
90     DBT_ARRAY *keys,
91     uint32_t *flags_array
92     );
93 int env_update_multiple(
94     DB_ENV *env,
95     DB *src_db,
96     DB_TXN *txn,
97     DBT *old_src_key, DBT *old_src_data,
98     DBT *new_src_key, DBT *new_src_data,
99     uint32_t num_dbs,
100     DB **db_array,
101     uint32_t* flags_array,
102     uint32_t num_keys, DBT_ARRAY keys[],
103     uint32_t num_vals, DBT_ARRAY vals[]
104     );
105