GNUnet 0.22.2
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, 2022 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
34#ifndef PLUGIN_DATACACHE_H
35#define PLUGIN_DATACACHE_H
36
37
39
40#ifdef __cplusplus
41extern "C"
42{
43#if 0 /* keep Emacsens' auto-indent happy */
44}
45#endif
46#endif
47
48
57typedef void
59 const struct GNUNET_HashCode *key,
60 size_t size);
61
62
69{
74
78 const char *section;
79
83 void *cls;
84
90
94 unsigned long long quota;
95};
96
97
102{
106 void *cls;
107
116 ssize_t
117 (*put) (void *cls,
118 uint32_t xor_distance,
119 const struct GNUNET_DATACACHE_Block *block);
120
121
133 unsigned int
134 (*get) (void *cls,
135 const struct GNUNET_HashCode *key,
138 void *iter_cls);
139
140
149 (*del)(void *cls);
150
151
167 unsigned int
168 (*get_closest) (void *cls,
169 const struct GNUNET_HashCode *key,
171 unsigned int num_results,
173 void *iter_cls);
174};
175
176
177#if 0 /* keep Emacsens' auto-indent happy */
178{
179#endif
180#ifdef __cplusplus
181}
182#endif
183
184#endif
185 /* end of group */
187 /* end of group addition */
struct GNUNET_HashCode key
The key used in the DHT.
static uint32_t type
Type string converted to DNS type value.
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.
enum GNUNET_GenericReturnValue(* GNUNET_DATACACHE_Iterator)(void *cls, const struct GNUNET_DATACACHE_Block *block)
An iterator over a set of items stored in the datacache.
GNUNET_GenericReturnValue
Named constants for return values.
static unsigned int size
Size of the "table".
Definition: peer.c:68
GNUNET_BLOCK_Type
WARNING: This header is generated! In order to add DHT block types, you must register them in GANA,...
Information about a block stored in the datacache.
The datastore service will pass a pointer to a struct of this type as the first and only argument to ...
const char * section
Configuration section to use.
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.
void * cls
Closure to use for callbacks.
unsigned long long quota
How much space are we allowed to use?
struct returned by the initialization function of the plugin
void * cls
Closure to pass to all plugin functions.
unsigned int(* get)(void *cls, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, GNUNET_DATACACHE_Iterator iter, void *iter_cls)
Iterate over the results for a particular key in the datastore.
unsigned int(* get_closest)(void *cls, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, unsigned int num_results, GNUNET_DATACACHE_Iterator iter, void *iter_cls)
Iterate over the results that are "close" to a particular key in the datacache.
enum GNUNET_GenericReturnValue(* del)(void *cls)
Delete the entry with the lowest expiration value from the datacache right now.
ssize_t(* put)(void *cls, uint32_t xor_distance, const struct GNUNET_DATACACHE_Block *block)
Store an item in the datastore.
A 512-bit hashcode.