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
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
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
53 * Closure to pass to all plugin functions.
58 * Store a record in the peerstore.
59 * Key is the combination of sub system and peer identity.
60 * One key can store multiple values.
62 * @param cls closure (internal context for the plugin)
63 * @param sub_system name of the GNUnet sub system responsible
64 * @param peer peer identity
65 * @param value value to be stored
66 * @param size size of value to be stored
67 * @param expiry absolute time after which the record is (possibly) deleted
68 * @param options options related to the store operation
69 * @param cont continuation called when record is stored
70 * @param cont_cls continuation closure
71 * @return #GNUNET_OK on success, else #GNUNET_SYSERR and cont is not called
74 (*store_record) (void *cls,
75 const char *sub_system,
76 const struct GNUNET_PeerIdentity *peer,
80 struct GNUNET_TIME_Absolute expiry,
81 enum GNUNET_PEERSTORE_StoreOption options,
82 GNUNET_PEERSTORE_Continuation cont,
86 * Iterate over the records given an optional peer id
89 * @param cls closure (internal context for the plugin)
90 * @param sub_system name of sub system
91 * @param peer Peer identity (can be NULL)
92 * @param key entry key string (can be NULL)
93 * @param iter function to call asynchronously with the results, terminated
95 * @param iter_cls closure for @a iter
96 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error and iter is not
100 (*iterate_records) (void *cls,
101 const char *sub_system,
102 const struct GNUNET_PeerIdentity *peer,
104 GNUNET_PEERSTORE_Processor iter,
108 * Delete expired records (expiry < now)
110 * @param cls closure (internal context for the plugin)
111 * @param now time to use as reference
112 * @param cont continuation called with the number of records expired
113 * @param cont_cls continuation closure
114 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error and cont is not
118 (*expire_records) (void *cls,
119 struct GNUNET_TIME_Absolute now,
120 GNUNET_PEERSTORE_Continuation cont,
126 #if 0 /* keep Emacsens' auto-indent happy */
135 /** @} */ /* end of group */