GNUnet  0.11.x
gnunet_datacache_plugin.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2006, 2009, 2015 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 
31 #ifndef PLUGIN_DATACACHE_H
32 #define PLUGIN_DATACACHE_H
33 
34 #include "gnunet_datacache_lib.h"
35 
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #if 0 /* keep Emacsens' auto-indent happy */
40 }
41 #endif
42 #endif
43 
44 
53 typedef void
55  const struct GNUNET_HashCode *key,
56  size_t size);
57 
58 
65 {
70 
74  const char *section;
75 
79  void *cls;
80 
86 
90  unsigned long long quota;
91 };
92 
93 
98 {
102  void *cls;
103 
118  ssize_t (*put) (void *cls,
119  const struct GNUNET_HashCode *key,
120  uint32_t xor_distance,
121  size_t size,
122  const char *data,
123  enum GNUNET_BLOCK_Type type,
124  struct GNUNET_TIME_Absolute discard_time,
125  unsigned int path_info_len,
126  const struct GNUNET_PeerIdentity *path_info);
127 
139  unsigned int (*get) (void *cls,
140  const struct GNUNET_HashCode *key,
141  enum GNUNET_BLOCK_Type type,
143  void *iter_cls);
144 
152  int (*del) (void *cls);
153 
162  unsigned int (*get_random) (void *cls,
164  void *iter_cls);
165 
166 
180  unsigned int (*get_closest) (void *cls,
181  const struct GNUNET_HashCode *key,
182  unsigned int num_results,
184  void *iter_cls);
185 };
186 
187 
188 #if 0 /* keep Emacsens' auto-indent happy */
189 {
190 #endif
191 #ifdef __cplusplus
192 }
193 #endif
194 
195 #endif
196  /* end of group */
const char * section
Configuration section to use.
void * cls
Closure to pass to all plugin functions.
GNUNET_BLOCK_Type
Blocks in the datastore and the datacache must have a unique type.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
GNUNET_DATACACHE_DeleteNotifyCallback delete_notify
Function to call whenever the plugin needs to discard content that it was asked to store...
static int del
Desired action is to remove a record.
struct returned by the initialization function of the plugin
A 512-bit hashcode.
struct GNUNET_HashCode key
The key used in the DHT.
static unsigned int size
Size of the "table".
Definition: peer.c:67
The identity of the host (wraps the signing key of the peer).
configuration data
Definition: configuration.c:85
void(* GNUNET_DATACACHE_DeleteNotifyCallback)(void *cls, const struct GNUNET_HashCode *key, size_t size)
Function called by plugins to notify the datacache about content deletions.
int(* GNUNET_DATACACHE_Iterator)(void *cls, const struct GNUNET_HashCode *key, size_t data_size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute exp, unsigned int path_info_len, const struct GNUNET_PeerIdentity *path_info)
An iterator over a set of items stored in the datacache.
void * cls
Closure to use for callbacks.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
Time for absolute times used by GNUnet, in microseconds.
unsigned long long quota
How much space are we allowed to use?
uint32_t data
The data value.
The datastore service will pass a pointer to a struct of this type as the first and only argument to ...