GNUnet  0.10.x
Data Structures | Functions | Variables
gnunet-datastore.c File Reference

tool to manipulate datastores More...

#include <inttypes.h>
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_datastore_service.h"
Include dependency graph for gnunet-datastore.c:

Go to the source code of this file.

Data Structures

struct  DataRecord
 

Functions

static void do_shutdown (void *cls)
 
static void start_dump (void)
 Begin dumping the database. More...
 
static void start_insert (void)
 Begin inserting into the database. More...
 
static void do_get (const uint64_t next_uid)
 Perform next GET operation. More...
 
static void get_cb (void *cls, const struct GNUNET_HashCode *key, size_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)
 Process a datum that was stored in the datastore. More...
 
static void put_cb (void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
 Continuation called to notify client about result of the operation. More...
 
static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
 Main function that will be run by the scheduler. More...
 
int main (int argc, char *const *argv)
 The main function to manipulate datastores. More...
 

Variables

static GNUNET_NETWORK_STRUCT_END const size_t MAGIC_LEN = 16
 Length of our magic header. More...
 
static const uint8_t MAGIC_BYTES [16] = "GNUNETDATASTORE1"
 Magic header bytes. More...
 
static int dump
 Dump the database. More...
 
static int insert
 Insert into the database. More...
 
static char * file_name
 Dump file name. More...
 
static struct GNUNET_DISK_FileHandlefile_handle
 Dump file handle. More...
 
static int ret
 Global return value. More...
 
static struct GNUNET_DATASTORE_Handledatastore
 Handle for datastore. More...
 
static struct GNUNET_DATASTORE_QueueEntryqe
 Current operation. More...
 
static uint64_t record_count
 Record count. More...
 

Detailed Description

tool to manipulate datastores

Author
Christian Grothoff

Definition in file gnunet-datastore.c.

Function Documentation

◆ do_shutdown()

static void do_shutdown ( void *  cls)
static

Definition at line 126 of file gnunet-datastore.c.

References do_get(), GNUNET_DATASTORE_cancel(), GNUNET_DATASTORE_disconnect(), GNUNET_DISK_file_close(), GNUNET_NO, start_dump(), and start_insert().

Referenced by run().

127 {
128  if (NULL != qe)
130  if (NULL != datastore)
132  if (NULL != file_handle)
134 }
static struct GNUNET_DATASTORE_QueueEntry * qe
Current operation.
int GNUNET_DISK_file_close(struct GNUNET_DISK_FileHandle *h)
Close an open file.
Definition: disk.c:1817
static struct GNUNET_DISK_FileHandle * file_handle
Dump file handle.
static struct GNUNET_DATASTORE_Handle * datastore
Handle for datastore.
#define GNUNET_NO
Definition: gnunet_common.h:81
void GNUNET_DATASTORE_cancel(struct GNUNET_DATASTORE_QueueEntry *qe)
Cancel a datastore operation.
void GNUNET_DATASTORE_disconnect(struct GNUNET_DATASTORE_Handle *h, int drop)
Disconnect from the datastore service (and free associated resources).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ start_dump()

static void start_dump ( void  )
static

Begin dumping the database.

Definition at line 272 of file gnunet-datastore.c.

References _, do_get(), file_name, FPRINTF, GNUNET_DISK_file_open(), GNUNET_DISK_file_write(), GNUNET_DISK_get_handle_from_int_fd(), GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_OPEN_TRUNCATE, GNUNET_DISK_OPEN_WRITE, GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, GNUNET_SCHEDULER_shutdown(), MAGIC_BYTES, MAGIC_LEN, record_count, and ret.

Referenced by do_shutdown(), and run().

273 {
274  record_count = 0;
275 
276  if (NULL != file_name)
277  {
284  if (NULL == file_handle)
285  {
286  FPRINTF (stderr,
287  _("Unable to open dump file: %s\n"),
288  file_name);
289  ret = 1;
291  return;
292  }
293  }
294  else
295  {
297  }
299  do_get(0);
300 }
static int ret
Global return value.
Create file if it doesn&#39;t exist.
#define FPRINTF
Definition: plibc.h:683
static struct GNUNET_DISK_FileHandle * file_handle
Dump file handle.
static char * file_name
Dump file name.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:524
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
static uint64_t record_count
Record count.
Truncate file if it exists.
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
Definition: disk.c:1049
static GNUNET_NETWORK_STRUCT_END const size_t MAGIC_LEN
Length of our magic header.
Open the file for writing.
struct GNUNET_DISK_FileHandle * GNUNET_DISK_get_handle_from_int_fd(int fno)
Get a handle from a native integer FD.
Definition: disk.c:1937
static void do_get(const uint64_t next_uid)
Perform next GET operation.
struct GNUNET_DISK_FileHandle * GNUNET_DISK_file_open(const char *fn, enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm)
Open a file.
Definition: disk.c:1673
static const uint8_t MAGIC_BYTES[16]
Magic header bytes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ start_insert()

static void start_insert ( void  )
static

Begin inserting into the database.

Definition at line 400 of file gnunet-datastore.c.

References _, buf, file_name, FPRINTF, GNUNET_DISK_file_open(), GNUNET_DISK_file_read(), GNUNET_DISK_get_handle_from_int_fd(), GNUNET_DISK_OPEN_READ, GNUNET_DISK_PERM_NONE, GNUNET_SCHEDULER_shutdown(), GNUNET_TIME_UNIT_ZERO_ABS, GNUNET_YES, len, MAGIC_BYTES, MAGIC_LEN, put_cb(), record_count, and ret.

Referenced by do_shutdown(), get_cb(), and run().

401 {
402  record_count = 0;
403 
404  if (NULL != file_name)
405  {
409  if (NULL == file_handle)
410  {
411  FPRINTF (stderr,
412  _("Unable to open dump file: %s\n"),
413  file_name);
414  ret = 1;
416  return;
417  }
418  }
419  else
420  {
422  }
423 
424  uint8_t buf[MAGIC_LEN];
425  ssize_t len;
426 
428  if (len != MAGIC_LEN ||
429  0 != memcmp (buf, MAGIC_BYTES, MAGIC_LEN))
430  {
431  FPRINTF (stderr,
432  _("Input file is not of a supported format\n"));
433  return;
434  }
436 }
static int ret
Global return value.
Open the file for reading.
#define GNUNET_TIME_UNIT_ZERO_ABS
Absolute time zero.
#define FPRINTF
Definition: plibc.h:683
ssize_t GNUNET_DISK_file_read(const struct GNUNET_DISK_FileHandle *h, void *result, size_t len)
Read the contents of a binary file into a buffer.
Definition: disk.c:881
static struct GNUNET_DISK_FileHandle * file_handle
Dump file handle.
static char * file_name
Dump file name.
Nobody is allowed to do anything to the file.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:524
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
static uint64_t record_count
Record count.
static char buf[2048]
static GNUNET_NETWORK_STRUCT_END const size_t MAGIC_LEN
Length of our magic header.
struct GNUNET_DISK_FileHandle * GNUNET_DISK_get_handle_from_int_fd(int fno)
Get a handle from a native integer FD.
Definition: disk.c:1937
#define GNUNET_YES
Definition: gnunet_common.h:80
struct GNUNET_DISK_FileHandle * GNUNET_DISK_file_open(const char *fn, enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm)
Open a file.
Definition: disk.c:1673
static const uint8_t MAGIC_BYTES[16]
Magic header bytes.
static void put_cb(void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
Continuation called to notify client about result of the operation.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_get()

static void do_get ( const uint64_t  next_uid)
static

Perform next GET operation.

Definition at line 246 of file gnunet-datastore.c.

References _, FPRINTF, get_cb(), GNUNET_assert, GNUNET_BLOCK_TYPE_ANY, GNUNET_DATASTORE_get_key(), GNUNET_SCHEDULER_shutdown(), and ret.

Referenced by do_shutdown(), get_cb(), and start_dump().

247 {
248  GNUNET_assert (NULL == qe);
250  next_uid,
251  false /* random */,
252  NULL /* key */,
254  0 /* queue_priority */,
255  1 /* max_queue_size */,
256  &get_cb,
257  NULL /* proc_cls */);
258  if (NULL == qe)
259  {
260  FPRINTF (stderr,
261  _("Error queueing datastore GET operation\n"));
262  ret = 1;
264  }
265 }
static int ret
Global return value.
static struct GNUNET_DATASTORE_QueueEntry * qe
Current operation.
Any type of block, used as a wildcard when searching.
#define FPRINTF
Definition: plibc.h:683
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static struct GNUNET_DATASTORE_Handle * datastore
Handle for datastore.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:524
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
static void get_cb(void *cls, const struct GNUNET_HashCode *key, size_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)
Process a datum that was stored in the datastore.
struct GNUNET_DATASTORE_QueueEntry * GNUNET_DATASTORE_get_key(struct GNUNET_DATASTORE_Handle *h, uint64_t next_uid, bool random, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, unsigned int queue_priority, unsigned int max_queue_size, GNUNET_DATASTORE_DatumProcessor proc, void *proc_cls)
Get a result for a particular key from the datastore.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_cb()

static void get_cb ( void *  cls,
const struct GNUNET_HashCode key,
size_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 
)
static

Process a datum that was 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; maybe 0 if no unique identifier is available

Definition at line 174 of file gnunet-datastore.c.

References _, DataRecord::anonymity, do_get(), DataRecord::expiration, FPRINTF, GNUNET_DISK_file_close(), GNUNET_DISK_file_write(), GNUNET_SCHEDULER_shutdown(), GNUNET_TIME_absolute_hton(), insert, DataRecord::key, len, DataRecord::priority, record_count, DataRecord::replication, ret, DataRecord::size, start_insert(), and DataRecord::type.

Referenced by do_get().

184 {
185  qe = NULL;
186  if (NULL == key)
187  {
188  FPRINTF (stderr,
189  _("Dumped %" PRIu64 " records\n"),
190  record_count);
192  file_handle = NULL;
193  if (insert)
194  start_insert();
195  else
196  {
197  ret = 0;
199  }
200  return;
201  }
202 
203  struct DataRecord dr;
204  dr.size = htonl ((uint32_t) size);
205  dr.type = htonl (type);
206  dr.priority = htonl (priority);
207  dr.anonymity = htonl (anonymity);
208  dr.replication = htonl (replication);
209  dr.expiration = GNUNET_TIME_absolute_hton (expiration);
210  dr.key = *key;
211 
212  ssize_t len;
213  len = GNUNET_DISK_file_write (file_handle, &dr, sizeof (dr));
214  if (sizeof (dr) != len)
215  {
216  FPRINTF (stderr,
217  _("Short write to file: %zd bytes expecting %zd\n"),
218  len,
219  sizeof (dr));
220  ret = 1;
222  return;
223  }
224 
226  if (size != len)
227  {
228  FPRINTF (stderr,
229  _("Short write to file: %zd bytes expecting %zd\n"),
230  len,
231  size);
232  ret = 1;
234  return;
235  }
236 
237  record_count++;
238  do_get(uid + 1);
239 }
static int ret
Global return value.
static struct GNUNET_DATASTORE_QueueEntry * qe
Current operation.
int GNUNET_DISK_file_close(struct GNUNET_DISK_FileHandle *h)
Close an open file.
Definition: disk.c:1817
#define FPRINTF
Definition: plibc.h:683
static struct GNUNET_DISK_FileHandle * file_handle
Dump file handle.
static unsigned int replication
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:524
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
static uint64_t record_count
Record count.
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
Definition: disk.c:1049
static void start_insert(void)
Begin inserting into the database.
uint32_t priority
Priority of the item (NBO).
struct GNUNET_HashCode key
The key used in the DHT.
static unsigned int size
Size of the "table".
Definition: peer.c:67
uint32_t size
Number of bytes in the item (NBO).
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
static unsigned int anonymity
static void do_get(const uint64_t next_uid)
Perform next GET operation.
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.
Definition: time.c:654
static int insert
Insert into the database.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ put_cb()

static void put_cb ( void *  cls,
int32_t  success,
struct GNUNET_TIME_Absolute  min_expiration,
const char *  msg 
)
static

Continuation called to notify client about result of the operation.

Parameters
clsclosure
successGNUNET_SYSERR on failure (including timeout/queue drop) GNUNET_NO if content was already there GNUNET_YES (or other positive value) on success
min_expirationminimum expiration time required for 0-priority content to be stored by the datacache at this time, zero for unknown, forever if we have no space for 0-priority content
msgNULL on success, otherwise an error message

Definition at line 317 of file gnunet-datastore.c.

References _, DataRecord::anonymity, data, DataRecord::expiration, FPRINTF, GNUNET_DATASTORE_put(), GNUNET_DISK_file_read(), GNUNET_SCHEDULER_shutdown(), GNUNET_SYSERR, GNUNET_TIME_absolute_ntoh(), DataRecord::key, len, DataRecord::priority, record_count, DataRecord::replication, ret, DataRecord::size, and DataRecord::type.

Referenced by start_insert().

321 {
322  qe = NULL;
323  if (GNUNET_SYSERR == success)
324  {
325  FPRINTF (stderr,
326  _("Failed to store item: %s, aborting\n"),
327  msg);
328  ret = 1;
330  return;
331  }
332 
333  struct DataRecord dr;
334  ssize_t len;
335 
336  len = GNUNET_DISK_file_read (file_handle, &dr, sizeof (dr));
337  if (0 == len)
338  {
339  FPRINTF (stderr,
340  _("Inserted %" PRIu64 " records\n"),
341  record_count);
342  ret = 0;
344  return;
345  }
346  else if (sizeof (dr) != len)
347  {
348  FPRINTF (stderr,
349  _("Short read from file: %zd bytes expecting %zd\n"),
350  len,
351  sizeof (dr));
352  ret = 1;
354  return;
355  }
356 
357  const size_t size = ntohl (dr.size);
358  uint8_t data[size];
359  len = GNUNET_DISK_file_read (file_handle, data, size);
360  if (size != len)
361  {
362  FPRINTF (stderr,
363  _("Short read from file: %zd bytes expecting %zd\n"),
364  len,
365  size);
366  ret = 1;
368  return;
369  }
370 
371  record_count++;
373  0,
374  &dr.key,
375  size,
376  data,
377  ntohl (dr.type),
378  ntohl (dr.priority),
379  ntohl (dr.anonymity),
380  ntohl (dr.replication),
381  GNUNET_TIME_absolute_ntoh (dr.expiration),
382  0,
383  1,
384  &put_cb,
385  NULL);
386  if (NULL == qe)
387  {
388  FPRINTF (stderr,
389  _("Error queueing datastore PUT operation\n"));
390  ret = 1;
392  }
393 }
static int ret
Global return value.
static struct GNUNET_DATASTORE_QueueEntry * qe
Current operation.
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_ntoh(struct GNUNET_TIME_AbsoluteNBO a)
Convert absolute time from network byte order.
Definition: time.c:670
#define FPRINTF
Definition: plibc.h:683
ssize_t GNUNET_DISK_file_read(const struct GNUNET_DISK_FileHandle *h, void *result, size_t len)
Read the contents of a binary file into a buffer.
Definition: disk.c:881
static struct GNUNET_DISK_FileHandle * file_handle
Dump file handle.
struct GNUNET_DATASTORE_QueueEntry * GNUNET_DATASTORE_put(struct GNUNET_DATASTORE_Handle *h, uint32_t rid, const struct GNUNET_HashCode *key, size_t size, const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, uint32_t anonymity, uint32_t replication, struct GNUNET_TIME_Absolute expiration, unsigned int queue_priority, unsigned int max_queue_size, GNUNET_DATASTORE_ContinuationWithStatus cont, void *cont_cls)
Store an item in the datastore.
static struct GNUNET_DATASTORE_Handle * datastore
Handle for datastore.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:524
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
static uint64_t record_count
Record count.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
static unsigned int size
Size of the "table".
Definition: peer.c:67
uint32_t data
The data value.
static void put_cb(void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
Continuation called to notify client about result of the operation.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

static void run ( void *  cls,
char *const *  args,
const char *  cfgfile,
const struct GNUNET_CONFIGURATION_Handle cfg 
)
static

Main function that will be run by the scheduler.

Parameters
clsclosure
argsremaining command-line arguments
cfgfilename of the configuration file used
cfgconfiguration

Definition at line 448 of file gnunet-datastore.c.

References _, do_shutdown(), dump, FPRINTF, GNUNET_DATASTORE_connect(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), insert, ret, start_dump(), and start_insert().

Referenced by main().

452 {
455  if (NULL == datastore)
456  {
457  FPRINTF (stderr,
458  _("Failed connecting to the datastore.\n"));
459  ret = 1;
461  return;
462  }
463  if (dump)
464  start_dump();
465  else if (insert)
466  start_insert();
467  else
468  {
469  FPRINTF (stderr,
470  _("Please choose at least one operation: %s, %s\n"),
471  "dump",
472  "insert");
473  ret = 1;
475  }
476 }
static int ret
Global return value.
#define FPRINTF
Definition: plibc.h:683
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.
Definition: scheduler.c:1293
static struct GNUNET_DATASTORE_Handle * datastore
Handle for datastore.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:524
static void do_shutdown(void *cls)
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
static void start_insert(void)
Begin inserting into the database.
static void start_dump(void)
Begin dumping the database.
static int dump
Dump the database.
struct GNUNET_DATASTORE_Handle * GNUNET_DATASTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the datastore service.
static int insert
Insert into the database.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *const *  argv 
)

The main function to manipulate datastores.

Parameters
argcnumber of arguments from the command line
argvcommand line arguments
Returns
0 ok, 1 on error

Definition at line 487 of file gnunet-datastore.c.

References dump, file_name, gettext_noop, GNUNET_free, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_filename(), GNUNET_GETOPT_option_flag(), GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), insert, ret, and run().

489 {
492  "dump",
493  gettext_noop ("Dump all records from the datastore"),
494  &dump),
496  "insert",
497  gettext_noop ("Insert records into the datastore"),
498  &insert),
500  "file",
501  "FILENAME",
502  gettext_noop ("File to dump or insert"),
503  &file_name),
505  };
506  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
507  return 2;
508 
509  if (GNUNET_OK !=
510  GNUNET_PROGRAM_run (argc, argv, "gnunet-datastore",
511  gettext_noop ("Manipulate GNUnet datastore"),
512  options, &run, NULL))
513  ret = 1;
514  GNUNET_free ((void*) argv);
515  return ret;
516 }
static int ret
Global return value.
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
int GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
Definition: strings.c:1521
static char * file_name
Dump file name.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
Definition of a command line option.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_filename(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a filename (automatically path expanded).
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
Main function that will be run by the scheduler.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
int GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration, parse options).
Definition: program.c:361
static int dump
Dump the database.
static int insert
Insert into the database.
#define GNUNET_free(ptr)
Wrapper around free.
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:

Variable Documentation

◆ MAGIC_LEN

GNUNET_NETWORK_STRUCT_END const size_t MAGIC_LEN = 16
static

Length of our magic header.

Definition at line 77 of file gnunet-datastore.c.

Referenced by start_dump(), and start_insert().

◆ MAGIC_BYTES

const uint8_t MAGIC_BYTES[16] = "GNUNETDATASTORE1"
static

Magic header bytes.

Definition at line 82 of file gnunet-datastore.c.

Referenced by start_dump(), and start_insert().

◆ dump

int dump
static

Dump the database.

Definition at line 87 of file gnunet-datastore.c.

Referenced by getPRK(), GNUNET_CRYPTO_hkdf_v(), main(), and run().

◆ insert

int insert
static

Insert into the database.

Definition at line 92 of file gnunet-datastore.c.

Referenced by get_cb(), main(), and run().

◆ file_name

char* file_name
static

◆ file_handle

struct GNUNET_DISK_FileHandle* file_handle
static

Dump file handle.

Definition at line 102 of file gnunet-datastore.c.

◆ ret

int ret
static

Global return value.

Definition at line 107 of file gnunet-datastore.c.

Referenced by do_get(), get_cb(), main(), put_cb(), run(), start_dump(), and start_insert().

◆ datastore

struct GNUNET_DATASTORE_Handle* datastore
static

Handle for datastore.

Definition at line 112 of file gnunet-datastore.c.

◆ qe

struct GNUNET_DATASTORE_QueueEntry* qe
static

◆ record_count

uint64_t record_count
static