GNUnet  0.10.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 
69 
73  const char *section;
74 
78  void *cls;
79 
85 
89  unsigned long long quota;
90 };
91 
92 
100  void *cls;
101 
116  ssize_t (*put) (void *cls,
117  const struct GNUNET_HashCode *key,
118  uint32_t xor_distance,
119  size_t size,
120  const char *data,
121  enum GNUNET_BLOCK_Type type,
122  struct GNUNET_TIME_Absolute discard_time,
123  unsigned int path_info_len,
124  const struct GNUNET_PeerIdentity *path_info);
125 
137  unsigned int (*get) (void *cls,
138  const struct GNUNET_HashCode *key,
139  enum GNUNET_BLOCK_Type type,
141  void *iter_cls);
142 
150  int (*del) (void *cls);
151 
160  unsigned int (*get_random) (void *cls,
162  void *iter_cls);
163 
164 
178  unsigned int (*get_closest) (void *cls,
179  const struct GNUNET_HashCode *key,
180  unsigned int num_results,
182  void *iter_cls);
183 };
184 
185 
186 #if 0 /* keep Emacsens' auto-indent happy */
187 {
188 #endif
189 #ifdef __cplusplus
190 }
191 #endif
192 
193 #endif
194  /* 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:66
The identity of the host (wraps the signing key of the peer).
configuration data
Definition: configuration.c:83
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 ...