diff options
Diffstat (limited to 'src/include/gnunet_db_lib.h')
-rw-r--r-- | src/include/gnunet_db_lib.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/include/gnunet_db_lib.h b/src/include/gnunet_db_lib.h new file mode 100644 index 000000000..9356f66cb --- /dev/null +++ b/src/include/gnunet_db_lib.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2017 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify it under the | ||
6 | terms of the GNU General Public License as published by the Free Software | ||
7 | Foundation; either version 3, or (at your option) any later version. | ||
8 | |||
9 | GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY | ||
10 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
11 | A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
12 | |||
13 | You should have received a copy of the GNU General Public License along with | ||
14 | GNUnet; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> | ||
15 | */ | ||
16 | /** | ||
17 | * @file include/gnunet_db_lib.h | ||
18 | * @brief shared defintions for transactional databases | ||
19 | * @author Christian Grothoff | ||
20 | */ | ||
21 | #ifndef GNUNET_DB_LIB_H | ||
22 | #define GNUNET_DB_LIB_H | ||
23 | |||
24 | |||
25 | /** | ||
26 | * Status code returned from functions running database commands. | ||
27 | * Can be combined with a function that returns the number | ||
28 | * of results, so all non-negative values indicate success. | ||
29 | */ | ||
30 | enum GNUNET_DB_QueryStatus | ||
31 | { | ||
32 | /** | ||
33 | * A hard error occurred, retrying will not help. | ||
34 | */ | ||
35 | GNUNET_DB_STATUS_HARD_ERROR = -2, | ||
36 | |||
37 | /** | ||
38 | * A soft error occurred, retrying the transaction may succeed. | ||
39 | * Includes DEADLOCKS and SERIALIZATION errors. | ||
40 | */ | ||
41 | GNUNET_DB_STATUS_SOFT_ERROR = -1, | ||
42 | |||
43 | /** | ||
44 | * The transaction succeeded, but yielded zero results. | ||
45 | * May include the case where an INSERT failed with UNIQUE | ||
46 | * violation (i.e. row already exists) or where DELETE | ||
47 | * failed to remove anything (i.e. nothing matched). | ||
48 | */ | ||
49 | GNUNET_DB_STATUS_SUCCESS_NO_RESULTS = 0, | ||
50 | |||
51 | /** | ||
52 | * The transaction succeeded, and yielded one result. | ||
53 | */ | ||
54 | GNUNET_DB_STATUS_SUCCESS_ONE_RESULT = 1 | ||
55 | |||
56 | /* Larger values may be returned for SELECT statements | ||
57 | that returned more than one result. */ | ||
58 | |||
59 | }; | ||
60 | |||
61 | #endif | ||