37 #define MAX_PENDING 1024 42 #define MAX_BF_SIZE ((uint32_t) (1LL << 31)) 48 #define MAX_EXPIRE_DELAY \ 49 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15) 55 #define MIN_EXPIRE_DELAY \ 56 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) 72 #define MAX_STAT_SYNC_LAG 50 236 "# utilization by current datastore",
327 "Deleting content `%s' of type %u that expired %s ago\n",
359 expired_kill_task = NULL;
395 unsigned long long *need = cls;
401 "Deleting %llu bytes of low-priority (%u) content `%s' of type %u at %s prior to expiration (still trying to free another %llu bytes)\n",
403 (
unsigned int) priority,
442 unsigned long long last;
445 "Asked to free up %llu bytes of cache space\n",
448 while ((need > 0) && (last != need))
473 "Transmitting `%s' message with value %d and message `%s'\n",
476 msg != NULL ? msg :
"(none)");
477 slen = (msg == NULL) ? 0 : strlen (msg) + 1;
479 sm->
status = htonl (code);
532 dm->
size = htonl (size);
533 dm->
type = htonl (type);
543 "Transmitting DATA message for `%s' of type %u with expiration %s (in: %s)\n",
571 static int reservation_gen;
574 unsigned long long used;
575 unsigned long long req;
581 entries = ntohl (msg->
entries);
585 if (used + req >
quota)
593 "Insufficient space (%llu bytes are available) to satisfy RESERVE request for %llu bytes\n"),
605 "The requested amount (%llu bytes) is larger than the cache size (%llu bytes)\n"),
611 "Insufficient space to satisfy request and " 612 "requested amount is larger than cache size"));
618 gettext_noop (
"Insufficient space to satisfy request"));
634 e->
rid = ++reservation_gen;
635 if (reservation_gen < 0)
655 int rid = ntohl (msg->
rid);
656 unsigned long long rem;
661 while (NULL != (pos = next))
680 "Returning %llu remaining reserved bytes to storage pool\n",
710 dsize = ntohl (dm->
size);
747 "Successfully stored %u bytes under key `%s'\n",
757 _ (
"Need %llu bytes more space (%llu allowed, using %llu)\n"),
800 "Processing PUT request for `%s' of type %u\n",
802 (uint32_t) ntohl (dm->
type));
803 rid = ntohl (dm->
rid);
804 size = ntohl (dm->
size);
808 while ((NULL != pos) && (rid != pos->
rid))
854 "Processing GET request of type %u\n",
855 (uint32_t) ntohl (msg->
type));
883 "Processing GET request for `%s' of type %u\n",
885 (uint32_t) ntohl (msg->
type));
894 "Empty result set for GET request for `%s' (bloomfilter).\n",
898 "# requests filtered by bloomfilter"),
939 "# GET REPLICATION requests received"),
967 "Processing GET_ZERO_ANONYMITY request\n");
970 "# GET ZERO ANONYMITY requests received"),
1010 "Content not found for REMOVE request.\n");
1015 "Item matches REMOVE request for key `%s'.\n",
1062 "Processing REMOVE request for `%s'\n",
1102 if ((delta < 0) && (
payload < -delta))
1107 "Datastore payload must have been inaccurate (%lld < %lld). Recomputing it.\n"),
1109 (
long long) -delta);
1112 _ (
"New payload: %lld\n"),
1113 (
long long) payload);
1146 "Notification from statistics about existing payload (%llu), new payload is %llu\n",
1147 (
unsigned long long) value,
1148 (
unsigned long long)
payload);
1167 _ (
"Loading `%s' datastore plugin\n"),
1173 if (NULL == ret->
api)
1176 _ (
"Failed to load datastore plugin for `%s'\n"),
1197 "Datastore service is unloading plugin...\n");
1236 _ (
"Bloomfilter construction complete.\n"));
1257 if (NULL != stat_timeout_task)
1260 stat_timeout_task = NULL;
1278 "Failed to obtain value from statistics service, recomputing it\n");
1281 _ (
"New payload: %lld\n"),
1288 _ (
"Rebuilding bloomfilter. Please be patient.\n"));
1298 "Plugin does not support get_keys function. Please fix!\n"));
1313 stat_timeout_task = NULL;
1326 if (NULL != expired_kill_task)
1329 expired_kill_task = NULL;
1348 if (NULL != stat_get)
1353 if (NULL != stat_timeout_task)
1356 stat_timeout_task = NULL;
1412 if (pos->
client == client)
1415 reservations =
next;
1448 unsigned int bf_size;
1463 _ (
"# bytes used in file-sharing datastore `%s'"),
1482 quota / (32 * 1024LL);
1491 _ (
"Could not use specified filename `%s' for bloomfilter.\n"),
1492 NULL != fn ? fn :
"");
1508 if (0 != unlink (pfn))
1512 _ (
"Failed to remove bogus bloomfilter file `%s'\n"),
1534 _ (
"Failed to remove bogus bloomfilter file `%s'\n"),
1573 _ (
"Failed to initialize bloomfilter.\n"));
1588 if (NULL == stat_get)
static void handle_drop(void *cls, const struct GNUNET_MessageHeader *message)
Handle DROP-message.
static void add_key_to_bloomfilter(void *cls, const struct GNUNET_HashCode *key, unsigned int count)
Adds a given key to the bloomfilter in cls count times.
#define GNUNET_MESSAGE_TYPE_DATASTORE_STATUS
Message sent by datastore to client informing about status processing a request (in response to RESER...
static struct GNUNET_TIME_Absolute min_expiration
Minimum time that content should have to not be discarded instantly (time stamp of any content that w...
static void handle_get(void *cls, const struct GetMessage *msg)
Handle GNUNET_MESSAGE_TYPE_DATASTORE_GET-message.
struct GNUNET_CONTAINER_BloomFilter * GNUNET_CONTAINER_bloomfilter_init(const char *data, size_t size, unsigned int k)
Create a Bloom filter from raw bits.
static void handle_put(void *cls, const struct DataMessage *dm)
Handle PUT-message.
GNUNET_DATASTORE_DiskUtilizationChange duc
Function to call on disk utilization change.
PluginGetKeys get_keys
Iterate over all keys in the database.
PluginPut put
Function to store an item in the datastore.
static int cleaning_done
Have we already cleaned up the TCCs and are hence no longer willing (or able) to transmit anything to...
uint32_t random
If true return a random result.
PluginGetType get_zero_anonymity
Get datum (of the specified type) with anonymity level zero.
static char * subsystem
Set to subsystem that we're going to get stats for (or NULL for all).
struct GNUNET_MessageHeader * msg
static void disk_utilization_change_cb(void *cls, int delta)
Function called by plugins to notify us about a change in their disk utilization. ...
GNUNET_SERVICE_MAIN("datastore", GNUNET_SERVICE_OPTION_NONE, &run, &client_connect_cb, &client_disconnect_cb, NULL, GNUNET_MQ_hd_fixed_size(reserve, GNUNET_MESSAGE_TYPE_DATASTORE_RESERVE, struct ReserveMessage, NULL), GNUNET_MQ_hd_fixed_size(release_reserve, GNUNET_MESSAGE_TYPE_DATASTORE_RELEASE_RESERVE, struct ReleaseReserveMessage, NULL), GNUNET_MQ_hd_var_size(put, GNUNET_MESSAGE_TYPE_DATASTORE_PUT, struct DataMessage, NULL), GNUNET_MQ_hd_fixed_size(get, GNUNET_MESSAGE_TYPE_DATASTORE_GET, struct GetMessage, NULL), GNUNET_MQ_hd_fixed_size(get_key, GNUNET_MESSAGE_TYPE_DATASTORE_GET_KEY, struct GetKeyMessage, NULL), GNUNET_MQ_hd_fixed_size(get_replication, GNUNET_MESSAGE_TYPE_DATASTORE_GET_REPLICATION, struct GNUNET_MessageHeader, NULL), GNUNET_MQ_hd_fixed_size(get_zero_anonymity, GNUNET_MESSAGE_TYPE_DATASTORE_GET_ZERO_ANONYMITY, struct GetZeroAnonymityMessage, NULL), GNUNET_MQ_hd_var_size(remove, GNUNET_MESSAGE_TYPE_DATASTORE_REMOVE, struct DataMessage, NULL), GNUNET_MQ_hd_fixed_size(drop, GNUNET_MESSAGE_TYPE_DATASTORE_DROP, struct GNUNET_MessageHeader, NULL), GNUNET_MQ_handler_end())
Define "main" method using service macro.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_ntoh(struct GNUNET_TIME_AbsoluteNBO a)
Convert absolute time from network byte order.
void GNUNET_CONTAINER_bloomfilter_add(struct GNUNET_CONTAINER_BloomFilter *bf, const struct GNUNET_HashCode *e)
Add an element to the filter.
#define GNUNET_TIME_UNIT_ZERO_ABS
Absolute time zero.
static void manage_space(unsigned long long need)
Manage available disk space by running tasks that will discard content if necessary.
static struct GNUNET_TIME_Relative delta
static int end
Set if we are to shutdown all services (including ARM).
struct GNUNET_TIME_AbsoluteNBO expiration
Expiration time (NBO); zero for remove.
uint32_t type
Desired content type (actually an enum GNUNET_BLOCK_Type)
uint32_t entries
Number of items to reserve.
void GNUNET_SERVICE_resume(struct GNUNET_SERVICE_Handle *sh)
Resume accepting connections from the listen socket.
Any type of block, used as a wildcard when searching.
static int transmit_item(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)
Function that will transmit the given datastore entry to the client.
Message from datastore service informing client about the current size of the datastore.
static struct GNUNET_SERVICE_Handle * service
Handle to our server.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
GNUNET_BLOCK_Type
Blocks in the datastore and the datacache must have a unique type.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed_with_priority(struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
struct GNUNET_MQ_Handle * GNUNET_SERVICE_client_get_mq(struct GNUNET_SERVICE_Client *c)
Obtain the message queue of c.
static int quota_processor(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 iterator over a set of items stored in the datastore that deletes until we're happy with respect t...
uint32_t type
Type of the item (NBO), zero for remove, (actually an enum GNUNET_BLOCK_Type)
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received, or when GNUNET_SCHEDULER_shutdown() is being invoked.
char * lib_name
Name of the library (i.e.
struct GNUNET_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for the statistics service.
static int check_put(void *cls, const struct DataMessage *dm)
Verify PUT-message.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
uint32_t random
If true return a random result.
#define GNUNET_TIME_UNIT_SECONDS
One second.
#define MAX_STAT_SYNC_LAG
After how many payload-changing operations do we sync our statistics?
uint64_t amount
Number of bytes (still) reserved.
PluginRemoveKey remove_key
Function to remove an item from the database.
void GNUNET_STATISTICS_get_cancel(struct GNUNET_STATISTICS_GetHandle *gh)
Cancel a GNUNET_STATISTICS_get request.
Message from datastore client informing service that the remainder of the reserved bytes can now be r...
static unsigned int replication
static void remove_continuation(void *cls, const struct GNUNET_HashCode *key, uint32_t size, int status, const char *msg)
Remove continuation.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
PluginEstimateSize estimate_size
Calculate the current on-disk size of the SQ store.
static int ret
Return value of the commandline.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
#define GNUNET_MESSAGE_TYPE_DATASTORE_GET_REPLICATION
Message sent by datastore client to get random data.
static struct Experiment * e
Message to the datastore service asking about specific content.
struct GNUNET_TIME_AbsoluteNBO min_expiration
Minimum expiration time required for content to be stored by the datacache at this time...
Linked list of things we still need to do.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
Message to the datastore service asking about zero anonymity content.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
#define GNUNET_MESSAGE_TYPE_DATASTORE_RESERVE
Message sent by datastore client on join.
uint64_t next_uid
UID at which to start the search.
static int do_drop
Should the database be dropped on exit?
#define GNUNET_MESSAGE_TYPE_DATASTORE_PUT
Message sent by datastore client to store data.
static char * quota_stat_name
Name under which we store current space consumption.
static int check_remove(void *cls, const struct DataMessage *dm)
Verify REMOVE-message.
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
static void sync_stats()
Synchronize our utilization statistics with the statistics service.
uint64_t abs_value_us
The actual value.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static int check_data(const struct DataMessage *dm)
Check that the given message is a valid data message.
#define GNUNET_TIME_UNIT_FOREVER_ABS
Constant used to specify "forever".
void * GNUNET_PLUGIN_unload(const char *library_name, void *arg)
Unload plugin (runs the "done" callback and returns whatever "done" returned).
Handle to a client that is connected to a service.
PluginGetRandom get_replication
Function to get a random item with high replication score from the database, lowering the item's repl...
#define GNUNET_MESSAGE_TYPE_DATASTORE_RELEASE_RESERVE
Message sent by datastore client on join.
#define MAX_EXPIRE_DELAY
How long are we at most keeping "expired" content past the expiration date in the database...
PluginDrop drop
Delete the database.
structs for communication between datastore service and API
static struct DatastorePlugin * load_plugin()
Load the datastore plugin.
static void unload_plugin(struct DatastorePlugin *plug)
Function called when the service shuts down.
int32_t rid
Reservation identifier.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
static struct GNUNET_STATISTICS_GetHandle * stat_get
Handle for pending get request.
static void * client_connect_cb(void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq)
Add a client to our list of active clients.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_with_priority(enum GNUNET_SCHEDULER_Priority prio, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified priority.
static int process_stat_in(void *cls, const char *subsystem, const char *name, uint64_t value, int is_persistent)
Callback function to process statistic values.
#define GNUNET_MESSAGE_TYPE_DATASTORE_DROP
Message sent by datastore client to drop the database.
static void handle_get_replication(void *cls, const struct GNUNET_MessageHeader *message)
Handle GET_REPLICATION-message.
void GNUNET_log_config_missing(enum GNUNET_ErrorType kind, const char *section, const char *option)
Log error message about missing configuration option.
static char * value
Value of the record to add/remove.
void GNUNET_CONTAINER_bloomfilter_remove(struct GNUNET_CONTAINER_BloomFilter *bf, const struct GNUNET_HashCode *e)
Remove an element from the filter.
int GNUNET_CONTAINER_bloomfilter_test(const struct GNUNET_CONTAINER_BloomFilter *bf, const struct GNUNET_HashCode *e)
Test if an element is in the filter.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
static char * fn
Filename of the unique file.
Message to the datastore service asking about specific content.
uint32_t type
Desired content type.
static struct ReservationList * reservations
Linked list of space reservations made by clients.
PluginGetRandom get_expiration
Function to get a random expired item or, if none are expired, either the oldest entry or one with a ...
struct ListEntry * entries
List of peers in the list.
static void process_stat_done(void *cls, int success)
We finished receiving the statistic.
Each plugin is required to return a pointer to a struct of this type as the return value from its ent...
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
uint16_t status
See PRISM_STATUS_*-constants.
char * short_name
Short name for the plugin (i.e.
struct GNUNET_CONTAINER_BloomFilter * GNUNET_CONTAINER_bloomfilter_load(const char *filename, size_t size, unsigned int k)
Load a Bloom filter from a file.
static struct GNUNET_CONTAINER_BloomFilter * filter
Bloomfilter to quickly tell if we don't have the content.
static void client_disconnect_cb(void *cls, struct GNUNET_SERVICE_Client *client, void *app_ctx)
Called whenever a client is disconnected.
The datastore service will pass a pointer to a struct of this type as the first and only argument to ...
void GNUNET_STATISTICS_set(struct GNUNET_STATISTICS_Handle *handle, const char *name, uint64_t value, int make_persistent)
Set statistic value for the peer.
static struct GNUNET_SCHEDULER_Task * expired_kill_task
Identity of the task that is used to delete expired content.
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
#define GNUNET_DATASTORE_ENTRY_OVERHEAD
How many bytes of overhead will we assume per entry in any DB (for reservations)? ...
static char * expiration
Credential TTL.
uint32_t type
Desired content type.
#define GNUNET_MESSAGE_TYPE_DATASTORE_DATA_END
Message sent by datastore to client signaling end of matching data.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
uint32_t replication
Desired replication level.
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
uint32_t rid
Reservation ID to use; use zero for none.
struct GNUNET_DATASTORE_PluginFunctions * api
API of the transport as returned by the plugin's initialization function.
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
static void stat_timeout(void *cls)
Fetching stats took to long, run without.
struct ReservationList * next
This is a linked list.
struct GNUNET_DATASTORE_PluginEnvironment env
Environment this transport service is using for this plugin.
Message transmitting content from or to the datastore service.
struct GNUNET_HashCode key
Desired key.
static void handle_reserve(void *cls, const struct ReserveMessage *msg)
Handle RESERVE-message.
struct GNUNET_HashCode key
The key used in the DHT.
static unsigned int size
Size of the "table".
static int stats_worked
Did we get an answer from statistics?
uint32_t size
Number of bytes in the item (NBO).
static unsigned int last_sync
Number of updates that were made to the payload value since we last synchronized it with the statisti...
uint32_t anonymity
Desired anonymity level (NBO), zero for remove.
static int refresh_bf
Should we refresh the BF when the DB is loaded?
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_size(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *size)
Get a configuration value that should be a size in bytes.
static void handle_get_key(void *cls, const struct GetKeyMessage *msg)
Handle GNUNET_MESSAGE_TYPE_DATASTORE_GET_KEY-message.
static void handle_release_reserve(void *cls, const struct ReleaseReserveMessage *msg)
Handle RELEASE_RESERVE-message.
uint64_t entries
Number of items (still) reserved.
static unsigned long long payload
How much data are we currently storing in the database?
int32_t rid
Reservation id.
static struct GNUNET_STATISTICS_Handle * stats
Handle for reporting statistics.
void * cls
Closure to use for all of the following callbacks (except "next_request").
static int expired_processor(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)
Iterate over the expired items stored in the datastore.
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message...
struct GNUNET_MessageHeader header
Type is either GNUNET_MESSAGE_TYPE_DATASTORE_PUT, GNUNET_MESSAGE_TYPE_DATASTORE_REMOVE or GNUNET_MESS...
static unsigned long long quota
How much space are we allowed to use?
static struct DatastorePlugin * plugin
Our datastore plugin (NULL if not available).
static void cleaning_task(void *cls)
Task run during shutdown.
Handle to a message queue.
static unsigned long long cache_size
How much space are we using for the cache? (space available for insertions that will be instantly rec...
uint64_t next_uid
UID at which to start the search.
uint64_t uid
Unique ID for the content (can be used for UPDATE); can be zero for remove (which indicates that the ...
#define GNUNET_MESSAGE_TYPE_DATASTORE_GET_ZERO_ANONYMITY
Message sent by datastore client to get random data.
#define GNUNET_MESSAGE_TYPE_DATASTORE_GET_KEY
Message sent by datastore client to get data by key.
struct GNUNET_STATISTICS_GetHandle * GNUNET_STATISTICS_get(struct GNUNET_STATISTICS_Handle *handle, const char *subsystem, const char *name, GNUNET_STATISTICS_Callback cont, GNUNET_STATISTICS_Iterator proc, void *cls)
Get statistic from the peer.
static void run(void *cls, const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_SERVICE_Handle *serv)
Process datastore requests.
struct GNUNET_HashCode key
Key under which the item can be found.
uint32_t priority
Priority of the item (NBO), zero for remove.
static void put_continuation(void *cls, const struct GNUNET_HashCode *key, uint32_t size, int status, const char *msg)
Put continuation.
static void begin_service()
Initialization complete, start operating the service.
struct GNUNET_MQ_Handle * mq
#define GNUNET_log(kind,...)
Entry in list of pending tasks.
Message from datastore service informing client about the success or failure of a requested operation...
#define MAX_BF_SIZE
Limit size of bloom filter to 2 GB.
static void handle_remove(void *cls, const struct DataMessage *dm)
Handle REMOVE-message.
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future)
Given a timestamp in the future, how much time remains until then?
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
Time for absolute times used by GNUnet, in microseconds.
static unsigned int anonymity
int32_t status
Status code, -1 for errors.
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_difference(struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Absolute end)
Compute the time difference between the given start and end times.
#define MIN_EXPIRE_DELAY
How fast are we allowed to query the database for deleting expired content? (1 item per second)...
void * GNUNET_PLUGIN_load(const char *library_name, void *arg)
Setup plugin (runs the "init" callback and returns whatever "init" returned).
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_create_for_file(const char *filename)
Create the directory structure for storing a file.
#define GNUNET_MESSAGE_TYPE_DATASTORE_REMOVE
Message sent by datastore client to remove data.
static void transmit_status(struct GNUNET_SERVICE_Client *client, int code, const char *msg)
Transmit a status code to the client.
uint64_t next_uid
UID at which to start the search.
#define GNUNET_MESSAGE_TYPE_DATASTORE_GET
Message sent by datastore client to get data.
static unsigned long long reserved
How much space have we currently reserved?
const char * GNUNET_STRINGS_absolute_time_to_string(struct GNUNET_TIME_Absolute t)
Like asctime, except for GNUnet time.
struct GNUNET_SERVICE_Client * client
Client that made the reservation.
void GNUNET_SERVICE_suspend(struct GNUNET_SERVICE_Handle *sh)
Suspend accepting connections from the listen socket temporarily.
PluginGetKey get_key
Get a particular datum matching a given hash from the datastore.
static void delete_expired(void *cls)
Task that is used to remove expired entries from the datastore.
uint32_t data
The data value.
struct GNUNET_TIME_AbsoluteNBO GNUNET_TIME_absolute_hton(struct GNUNET_TIME_Absolute a)
Convert absolute time to network byte order.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
void GNUNET_CONTAINER_bloomfilter_free(struct GNUNET_CONTAINER_BloomFilter *bf)
Free the space associated with a filter in memory, flush to drive if needed (do not free the space on...
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
static char * plugin_name
Name of our plugin.
enum GNUNET_GenericReturnValue GNUNET_DISK_file_test(const char *fil)
Check that fil corresponds to a filename (of a file that exists and that is not a directory)...
#define GNUNET_MESSAGE_TYPE_DATASTORE_DATA
Message sent by datastore to client providing requested data (in response to GET or GET_RANDOM reques...
Linked list of active reservations.
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
#define GNUNET_free(ptr)
Wrapper around free.
static struct GNUNET_SCHEDULER_Task * stat_timeout_task
Task to timeout stat GET.
static void handle_get_zero_anonymity(void *cls, const struct GetZeroAnonymityMessage *msg)
Handle GET_ZERO_ANONYMITY-message.
#define gettext_noop(String)
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
uint64_t amount
Number of bytes to reserve.