diff options
Diffstat (limited to 'src/messenger/gnunet-service-messenger_operation_store.h')
-rw-r--r-- | src/messenger/gnunet-service-messenger_operation_store.h | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/src/messenger/gnunet-service-messenger_operation_store.h b/src/messenger/gnunet-service-messenger_operation_store.h deleted file mode 100644 index 18eb7f8a1..000000000 --- a/src/messenger/gnunet-service-messenger_operation_store.h +++ /dev/null | |||
@@ -1,132 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/gnunet-service-messenger_operation_store.h | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #ifndef GNUNET_SERVICE_MESSENGER_OPERATION_STORE_H | ||
27 | #define GNUNET_SERVICE_MESSENGER_OPERATION_STORE_H | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_container_lib.h" | ||
31 | #include "gnunet_crypto_lib.h" | ||
32 | #include "gnunet_scheduler_lib.h" | ||
33 | #include "gnunet_time_lib.h" | ||
34 | |||
35 | struct GNUNET_MESSENGER_SrvRoom; | ||
36 | |||
37 | struct GNUNET_MESSENGER_OperationStore | ||
38 | { | ||
39 | struct GNUNET_MESSENGER_SrvRoom *room; | ||
40 | |||
41 | struct GNUNET_CONTAINER_MultiHashMap *operations; | ||
42 | }; | ||
43 | |||
44 | /** | ||
45 | * Initializes an operation <i>store</i> as fully empty with a given <i>room</i>. | ||
46 | * | ||
47 | * @param[out] store Operation store | ||
48 | * @param[in/out] room Room | ||
49 | */ | ||
50 | void | ||
51 | init_operation_store (struct GNUNET_MESSENGER_OperationStore *store, | ||
52 | struct GNUNET_MESSENGER_SrvRoom *room); | ||
53 | |||
54 | /** | ||
55 | * Clears an operation <i>store</i>, stops all operations and deallocates its memory. | ||
56 | * | ||
57 | * @param[in/out] store Operation store | ||
58 | */ | ||
59 | void | ||
60 | clear_operation_store (struct GNUNET_MESSENGER_OperationStore *store); | ||
61 | |||
62 | /** | ||
63 | * Loads operations from a <i>directory</i> into an operation <i>store</i>. | ||
64 | * | ||
65 | * @param[out] store Operation store | ||
66 | * @param[in] directory Path to a directory | ||
67 | */ | ||
68 | void | ||
69 | load_operation_store (struct GNUNET_MESSENGER_OperationStore *store, | ||
70 | const char *directory); | ||
71 | |||
72 | /** | ||
73 | * Saves operations from an operation <i>store</i> into a <i>directory</i>. | ||
74 | * | ||
75 | * @param[in] store Operation store | ||
76 | * @param[in] directory Path to a directory | ||
77 | */ | ||
78 | void | ||
79 | save_operation_store (const struct GNUNET_MESSENGER_OperationStore *store, | ||
80 | const char *directory); | ||
81 | |||
82 | /** | ||
83 | * Returns the type of the active operation under a given <i>hash</i> in | ||
84 | * a specific operation <i>store</i>. If there is no active operation under | ||
85 | * the given <i>hash</i>, #GNUNET_MESSENGER_OP_UNKNOWN gets returned instead. | ||
86 | * | ||
87 | * @param[in] store Operation store | ||
88 | * @param[in] hash Hash of message | ||
89 | * @return Type of operation or #GNUNET_MESSENGER_OP_UNKNOWN | ||
90 | */ | ||
91 | enum GNUNET_MESSENGER_OperationType | ||
92 | get_store_operation_type (const struct GNUNET_MESSENGER_OperationStore *store, | ||
93 | const struct GNUNET_HashCode *hash); | ||
94 | |||
95 | /** | ||
96 | * Tries to use an operation under a given <i>hash</i> in a specific | ||
97 | * operation <i>store</i>. The operation will use the selected <i>type</i> | ||
98 | * if successful. The operation will be delayed by a given <i>delay</i>. | ||
99 | * | ||
100 | * If the selected type is #GNUNET_MESSENGER_OP_DELETE any active operation | ||
101 | * under the given hash will be stopped and replaced. | ||
102 | * | ||
103 | * If the new operation could be started successfully the method returns | ||
104 | * #GNUNET_OK, otherwise #GNUNET_SYSERR. | ||
105 | * | ||
106 | * @param[in/out] store Operation store | ||
107 | * @param[in] hash Hash of message | ||
108 | * @param[in] type Operation type | ||
109 | * @param[in] delay Delay | ||
110 | * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR | ||
111 | */ | ||
112 | int | ||
113 | use_store_operation (struct GNUNET_MESSENGER_OperationStore *store, | ||
114 | const struct GNUNET_HashCode *hash, | ||
115 | enum GNUNET_MESSENGER_OperationType type, | ||
116 | struct GNUNET_TIME_Relative delay); | ||
117 | |||
118 | /** | ||
119 | * Stops any active operation under a given <i>hash</i> in a specific | ||
120 | * operation <i>store</i>. | ||
121 | * | ||
122 | * Beware that calling this method will also implicitly free the memory | ||
123 | * of any active operation under the given hash! | ||
124 | * | ||
125 | * @param[in/out] store Operation store | ||
126 | * @param[in] hash Hash of message | ||
127 | */ | ||
128 | void | ||
129 | cancel_store_operation (struct GNUNET_MESSENGER_OperationStore *store, | ||
130 | const struct GNUNET_HashCode *hash); | ||
131 | |||
132 | #endif //GNUNET_SERVICE_MESSENGER_OPERATION_STORE_H | ||