GNUnet  0.18.1
Data Store service plugin API

API for the database backend plugins. More...

Collaboration diagram for Data Store service plugin API:

Data Structures

struct  GNUNET_DATASTORE_PluginEnvironment
 The datastore service will pass a pointer to a struct of this type as the first and only argument to the entry point of each datastore plugin. More...
 
struct  GNUNET_DATASTORE_PluginFunctions
 Each plugin is required to return a pointer to a struct of this type as the return value from its entry point. More...
 

Macros

#define GNUNET_DATASTORE_ENTRY_OVERHEAD   256
 How many bytes of overhead will we assume per entry in any DB (for reservations)? More...
 

Typedefs

typedef void(* GNUNET_DATASTORE_DiskUtilizationChange) (void *cls, int delta)
 Function invoked to notify service of disk utilization changes. More...
 
typedef enum GNUNET_GenericReturnValue(* PluginDatumProcessor) (void *cls, const struct GNUNET_HashCode *key, 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, uint64_t uid)
 An processor over a set of items stored in the datastore. More...
 
typedef void(* PluginEstimateSize) (void *cls, unsigned long long *estimate)
 Get an estimate of how much space the database is currently using. More...
 
typedef void(* PluginPutCont) (void *cls, const struct GNUNET_HashCode *key, uint32_t size, int status, const char *msg)
 Put continuation. More...
 
typedef void(* PluginPut) (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...
 
typedef void(* PluginKeyProcessor) (void *cls, const struct GNUNET_HashCode *key, unsigned int count)
 An processor over a set of keys stored in the datastore. More...
 
typedef void(* PluginGetKeys) (void *cls, PluginKeyProcessor proc, void *proc_cls)
 Get all of the keys in the datastore. More...
 
typedef void(* PluginGetKey) (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...
 
typedef void(* PluginRemoveCont) (void *cls, const struct GNUNET_HashCode *key, uint32_t size, int status, const char *msg)
 Remove continuation. More...
 
typedef void(* PluginRemoveKey) (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...
 
typedef void(* PluginGetRandom) (void *cls, PluginDatumProcessor proc, void *proc_cls)
 Get a random item (additional constraints may apply depending on the specific implementation). More...
 
typedef void(* PluginGetType) (void *cls, uint64_t next_uid, enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc, void *proc_cls)
 Select a single item from the datastore (among those applicable). More...
 
typedef void(* PluginDrop) (void *cls)
 Drop database. More...
 

Detailed Description

API for the database backend plugins.

Macro Definition Documentation

◆ GNUNET_DATASTORE_ENTRY_OVERHEAD

#define GNUNET_DATASTORE_ENTRY_OVERHEAD   256

How many bytes of overhead will we assume per entry in any DB (for reservations)?

Definition at line 49 of file gnunet_datastore_plugin.h.

Typedef Documentation

◆ GNUNET_DATASTORE_DiskUtilizationChange

typedef void(* GNUNET_DATASTORE_DiskUtilizationChange) (void *cls, int delta)

Function invoked to notify service of disk utilization changes.

Parameters
clsclosure
deltachange in disk utilization, 0 for "reset to empty"

Definition at line 60 of file gnunet_datastore_plugin.h.

◆ PluginDatumProcessor

typedef enum GNUNET_GenericReturnValue(* PluginDatumProcessor) (void *cls, const struct GNUNET_HashCode *key, 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, uint64_t uid)

An processor over a set of items stored in the datastore.

Parameters
clsclosure
keykey for the content
sizenumber of bytes in data
datacontent stored
typetype of the content
prioritypriority of the content
anonymityanonymity-level for the content
replicationreplication-level for the content
expirationexpiration time for the content
uidunique identifier for the datum
Returns
GNUNET_OK to keep the item GNUNET_NO to delete the item

Definition at line 60 of file gnunet_datastore_plugin.h.

◆ PluginEstimateSize

typedef void(* PluginEstimateSize) (void *cls, unsigned long long *estimate)

Get an estimate of how much space the database is currently using.

NB: estimate is an output parameter because emscripten cannot handle returning 64-bit integers from dynamically loaded modules.

Parameters
clsclosure
estimatelocation to store estimate
Returns
number of bytes used on disk

Definition at line 129 of file gnunet_datastore_plugin.h.

◆ PluginPutCont

typedef void(* PluginPutCont) (void *cls, const struct GNUNET_HashCode *key, uint32_t size, int status, const char *msg)

Put continuation.

Parameters
clsclosure
keykey for the item stored
sizesize of the item stored
statusGNUNET_OK if inserted, GNUNET_NO if updated, or #GNUNET_SYSERROR if error
msgerror message on error

Definition at line 144 of file gnunet_datastore_plugin.h.

◆ PluginPut

typedef void(* PluginPut) (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.

If the item is already present, the priorities and replication levels are summed up and the higher expiration time and lower anonymity level is used.

Parameters
clsclosure
keykey for the item
absenttrue if the key was not found in the bloom filter
sizenumber of bytes in data
datacontent stored
typetype of the content
prioritypriority of the content
anonymityanonymity-level for the content
replicationreplication-level for the content
expirationexpiration time for the content
contcontinuation called with success or failure status
cont_clscontinuation closure for cont

Definition at line 170 of file gnunet_datastore_plugin.h.

◆ PluginKeyProcessor

typedef void(* PluginKeyProcessor) (void *cls, const struct GNUNET_HashCode *key, unsigned int count)

An processor over a set of keys stored in the datastore.

Parameters
clsclosure
keykey in the data store, if NULL iteration is finished
counthow many values are stored under this key in the datastore

Definition at line 192 of file gnunet_datastore_plugin.h.

◆ PluginGetKeys

typedef void(* PluginGetKeys) (void *cls, PluginKeyProcessor proc, void *proc_cls)

Get all of the keys in the datastore.

Parameters
clsclosure
procfunction to call on each key
proc_clsclosure for proc

Definition at line 205 of file gnunet_datastore_plugin.h.

◆ PluginGetKey

typedef void(* PluginGetKey) (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.

Parameters
clsclosure
next_uidreturn the result with lowest uid >= next_uid
randomif true, return a random result instead of using next_uid
keymaybe NULL (to match all entries)
typeentries of which type are relevant? Use 0 for any type.
procfunction to call on the matching value; will be called with NULL if nothing matches
proc_clsclosure for proc

Definition at line 224 of file gnunet_datastore_plugin.h.

◆ PluginRemoveCont

typedef void(* PluginRemoveCont) (void *cls, const struct GNUNET_HashCode *key, uint32_t size, int status, const char *msg)

Remove continuation.

Parameters
clsclosure
keykey for the content removed
sizenumber of bytes removed
statusGNUNET_OK if removed, GNUNET_NO if not found, or #GNUNET_SYSERROR if error
msgerror message on error

Definition at line 244 of file gnunet_datastore_plugin.h.

◆ PluginRemoveKey

typedef void(* PluginRemoveKey) (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.

Parameters
clsclosure
keykey for the content
sizenumber of bytes in data
datacontent stored
contcontinuation called with success or failure status
cont_clscontinuation closure for cont

Definition at line 262 of file gnunet_datastore_plugin.h.

◆ PluginGetRandom

typedef void(* PluginGetRandom) (void *cls, PluginDatumProcessor proc, void *proc_cls)

Get a random item (additional constraints may apply depending on the specific implementation).

Calls proc with all values ZERO or NULL if no item applies, otherwise proc is called once and only once with an item.

Parameters
clsclosure
procfunction to call the value (once only).
proc_clsclosure for proc

Definition at line 281 of file gnunet_datastore_plugin.h.

◆ PluginGetType

typedef void(* PluginGetType) (void *cls, uint64_t next_uid, enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc, void *proc_cls)

Select a single item from the datastore (among those applicable).

Parameters
clsclosure
next_uidreturn the result with lowest uid >= next_uid
typeentries of which type should be considered? Must not be zero (ANY).
procfunction to call on the matching value; will be called with NULL if no value matches
proc_clsclosure for proc

Definition at line 298 of file gnunet_datastore_plugin.h.

◆ PluginDrop

typedef void(* PluginDrop) (void *cls)

Drop database.

Parameters
clsclosure

Definition at line 311 of file gnunet_datastore_plugin.h.