template-based datastore backend More...
Go to the source code of this file.
Data Structures | |
struct | Plugin |
Handle for a plugin. More... | |
Functions | |
static void | template_plugin_estimate_size (void *cls, unsigned long long *estimate) |
Get an estimate of how much space the database is currently using. More... | |
static void | template_plugin_put (void *cls, const struct GNUNET_HashCode *key, bool absent, uint32_t size, const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, uint32_t anonymity, uint32_t replication, struct GNUNET_TIME_Absolute expiration, PluginPutCont cont, void *cont_cls) |
Store an item in the datastore. More... | |
static void | template_plugin_get_key (void *cls, uint64_t next_uid, bool random, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc, void *proc_cls) |
Get one of the results for a particular key in the datastore. More... | |
static void | template_plugin_get_replication (void *cls, PluginDatumProcessor proc, void *proc_cls) |
Get a random item for replication. More... | |
static void | template_plugin_get_expiration (void *cls, PluginDatumProcessor proc, void *proc_cls) |
Get a random item for expiration. More... | |
static void | template_plugin_get_zero_anonymity (void *cls, uint64_t next_uid, enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc, void *proc_cls) |
Call the given processor on an item with zero anonymity. More... | |
static void | template_plugin_drop (void *cls) |
Drop database. More... | |
static void | template_get_keys (void *cls, PluginKeyProcessor proc, void *proc_cls) |
Get all of the keys in the datastore. More... | |
static void | template_plugin_remove_key (void *cls, const struct GNUNET_HashCode *key, uint32_t size, const void *data, PluginRemoveCont cont, void *cont_cls) |
Remove a particular key in the datastore. More... | |
void * | libgnunet_plugin_datastore_template_init (void *cls) |
Entry point for the plugin. More... | |
void * | libgnunet_plugin_datastore_template_done (void *cls) |
Exit point from the plugin. More... | |
template-based datastore backend
Definition in file plugin_datastore_template.c.
|
static |
Get an estimate of how much space the database is currently using.
cls | our "struct Plugin*" |
Definition at line 51 of file plugin_datastore_template.c.
References GNUNET_break.
Referenced by libgnunet_plugin_datastore_template_init().
|
static |
Store an item in the datastore.
cls | closure |
key | key for the item |
absent | true if the key was not found in the bloom filter |
size | number of bytes in data |
data | content stored |
type | type of the content |
priority | priority of the content |
anonymity | anonymity-level for the content |
replication | replication-level for the content |
expiration | expiration time for the content |
cont | continuation called with success or failure status |
cont_cls | continuation closure |
Definition at line 77 of file plugin_datastore_template.c.
References GNUNET_break, GNUNET_SYSERR, key, and size.
Referenced by libgnunet_plugin_datastore_template_init().
|
static |
Get one of the results for a particular key in the datastore.
cls | closure |
next_uid | return the result with lowest uid >= next_uid |
random | if true, return a random result instead of using next_uid |
key | maybe NULL (to match all entries) |
type | entries of which type are relevant? Use 0 for any type. |
proc | function to call on each matching value; will be called with NULL if nothing matches |
proc_cls | closure for proc |
Definition at line 109 of file plugin_datastore_template.c.
References GNUNET_break.
Referenced by libgnunet_plugin_datastore_template_init().
|
static |
Get a random item for replication.
Returns a single, not expired, random item from those with the highest replication counters. The item's replication counter is decremented by one IF it was positive before. Call 'proc' with all values ZERO or NULL if the datastore is empty.
cls | closure |
proc | function to call the value (once only). |
proc_cls | closure for proc |
Definition at line 133 of file plugin_datastore_template.c.
References GNUNET_break.
Referenced by libgnunet_plugin_datastore_template_init().
|
static |
Get a random item for expiration.
Call 'proc' with all values ZERO or NULL if the datastore is empty.
cls | closure |
proc | function to call the value (once only). |
proc_cls | closure for proc |
Definition at line 149 of file plugin_datastore_template.c.
References GNUNET_break.
Referenced by libgnunet_plugin_datastore_template_init().
|
static |
Call the given processor on an item with zero anonymity.
cls | our "struct Plugin*" |
next_uid | return the result with lowest uid >= next_uid |
type | entries of which type should be considered? Must not be zero (ANY). |
proc | function to call on the matching value; will be called with NULL if no value matches |
proc_cls | closure for proc |
Definition at line 168 of file plugin_datastore_template.c.
References GNUNET_break.
Referenced by libgnunet_plugin_datastore_template_init().
|
static |
Drop database.
Definition at line 180 of file plugin_datastore_template.c.
References GNUNET_break.
Referenced by libgnunet_plugin_datastore_template_init().
|
static |
Get all of the keys in the datastore.
cls | closure |
proc | function to call on each key |
proc_cls | closure for proc |
Definition at line 194 of file plugin_datastore_template.c.
Referenced by libgnunet_plugin_datastore_template_init().
|
static |
Remove a particular key in the datastore.
cls | closure |
key | key for the content |
size | number of bytes in data |
data | content stored |
cont | continuation called with success or failure status |
cont_cls | continuation closure for cont |
Definition at line 213 of file plugin_datastore_template.c.
References GNUNET_break, GNUNET_SYSERR, key, and size.
Referenced by libgnunet_plugin_datastore_template_init().
void * libgnunet_plugin_datastore_template_init | ( | void * | cls | ) |
Entry point for the plugin.
cls | the "struct GNUNET_DATASTORE_PluginEnvironment*" |
Definition at line 232 of file plugin_datastore_template.c.
References _, Plugin::api, GNUNET_BLOCK_PluginFunctions::cls, GNUNET_DATASTORE_PluginEnvironment::cls, env, GNUNET_BLOCK_PluginFunctions::get_key, GNUNET_ERROR_TYPE_INFO, GNUNET_log_from, GNUNET_new, plugin, template_get_keys(), template_plugin_drop(), template_plugin_estimate_size(), template_plugin_get_expiration(), template_plugin_get_key(), template_plugin_get_replication(), template_plugin_get_zero_anonymity(), template_plugin_put(), and template_plugin_remove_key().
void * libgnunet_plugin_datastore_template_done | ( | void * | cls | ) |
Exit point from the plugin.
cls | our "struct Plugin*" |
Definition at line 263 of file plugin_datastore_template.c.
References Plugin::api, GNUNET_BLOCK_PluginFunctions::cls, GNUNET_DATASTORE_PluginFunctions::cls, GNUNET_free, and plugin.