2 This file is part of GNUnet
3 Copyright (C) 2012, 2013 GNUnet e.V.
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.
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.
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/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
22 * @author Omar Tarabai
25 * Plugin API for the peerstore database backend
27 * @defgroup peerstore-plugin Peer Store service plugin API
28 * Plugin API for the peerstore database backend
31 #ifndef GNUNET_PEERSTORE_PLUGIN_H
32 #define GNUNET_PEERSTORE_PLUGIN_H
34 #include "gnunet_util_lib.h"
35 #include "gnunet_peerstore_service.h"
40 #if 0 /* keep Emacsens' auto-indent happy */
47 * @brief struct returned by the initialization function of the plugin
49 struct GNUNET_PEERSTORE_PluginFunctions
52 * Closure to pass to all plugin functions.
57 * Store a record in the peerstore.
58 * Key is the combination of sub system and peer identity.
59 * One key can store multiple values.
61 * @param cls closure (internal context for the plugin)
62 * @param sub_system name of the GNUnet sub system responsible
63 * @param peer peer identity
64 * @param value value to be stored
65 * @param size size of value to be stored
66 * @param expiry absolute time after which the record is (possibly) deleted
67 * @param options options related to the store operation
68 * @param cont continuation called when record is stored
69 * @param cont_cls continuation closure
70 * @return #GNUNET_OK on success, else #GNUNET_SYSERR and cont is not called
73 (*store_record) (void *cls,
74 const char *sub_system,
75 const struct GNUNET_PeerIdentity *peer,
79 struct GNUNET_TIME_Absolute expiry,
80 enum GNUNET_PEERSTORE_StoreOption options,
81 GNUNET_PEERSTORE_Continuation cont,
85 * Iterate over the records given an optional peer id
88 * @param cls closure (internal context for the plugin)
89 * @param sub_system name of sub system
90 * @param peer Peer identity (can be NULL)
91 * @param key entry key string (can be NULL)
92 * @param iter function to call asynchronously with the results, terminated
94 * @param iter_cls closure for @a iter
95 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error and iter is not
99 (*iterate_records) (void *cls,
100 const char *sub_system,
101 const struct GNUNET_PeerIdentity *peer,
103 GNUNET_PEERSTORE_Processor iter,
107 * Delete expired records (expiry < now)
109 * @param cls closure (internal context for the plugin)
110 * @param now time to use as reference
111 * @param cont continuation called with the number of records expired
112 * @param cont_cls continuation closure
113 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error and cont is not
117 (*expire_records) (void *cls,
118 struct GNUNET_TIME_Absolute now,
119 GNUNET_PEERSTORE_Continuation cont,
124 #if 0 /* keep Emacsens' auto-indent happy */
133 /** @} */ /* end of group */