aboutsummaryrefslogtreecommitdiff
path: root/src/datastore
diff options
context:
space:
mode:
Diffstat (limited to 'src/datastore')
-rw-r--r--src/datastore/Makefile.am83
-rw-r--r--src/datastore/Makefile.in458
-rw-r--r--src/datastore/datastore.conf.in8
-rw-r--r--src/datastore/datastore.h6
-rw-r--r--src/datastore/datastore_api.c52
-rw-r--r--src/datastore/gnunet-service-datastore.c20
-rw-r--r--src/datastore/perf_datastore_api.c113
-rw-r--r--src/datastore/perf_plugin_datastore.c87
-rw-r--r--src/datastore/perf_plugin_datastore_data_heap.conf7
-rw-r--r--src/datastore/perf_plugin_datastore_data_mysql.conf1
-rw-r--r--src/datastore/perf_plugin_datastore_data_postgres.conf1
-rw-r--r--src/datastore/perf_plugin_datastore_data_sqlite.conf1
-rw-r--r--src/datastore/plugin_datastore_heap.c868
-rw-r--r--src/datastore/plugin_datastore_mysql.c34
-rw-r--r--src/datastore/plugin_datastore_postgres.c32
-rw-r--r--src/datastore/plugin_datastore_sqlite.c47
-rw-r--r--src/datastore/plugin_datastore_template.c22
-rw-r--r--src/datastore/test_datastore_api.c122
-rw-r--r--src/datastore/test_datastore_api_data_heap.conf20
-rw-r--r--src/datastore/test_datastore_api_data_mysql.conf1
-rw-r--r--src/datastore/test_datastore_api_data_postgres.conf1
-rw-r--r--src/datastore/test_datastore_api_data_sqlite.conf3
-rw-r--r--src/datastore/test_datastore_api_management.c146
-rw-r--r--src/datastore/test_defaults.conf6
-rw-r--r--src/datastore/test_plugin_datastore.c95
-rw-r--r--src/datastore/test_plugin_datastore_data_heap.conf6
-rw-r--r--src/datastore/test_plugin_datastore_data_mysql.conf1
-rw-r--r--src/datastore/test_plugin_datastore_data_postgres.conf1
-rw-r--r--src/datastore/test_plugin_datastore_data_sqlite.conf1
29 files changed, 1579 insertions, 664 deletions
diff --git a/src/datastore/Makefile.am b/src/datastore/Makefile.am
index e7bccbc..57639fa 100644
--- a/src/datastore/Makefile.am
+++ b/src/datastore/Makefile.am
@@ -4,6 +4,8 @@ plugindir = $(libdir)/gnunet
pkgcfgdir= $(pkgdatadir)/config.d/
+libexecdir= $(pkglibdir)/libexec/
+
pkgcfg_DATA = \
datastore.conf
@@ -31,7 +33,7 @@ libgnunetdatastore_la_LDFLAGS = \
-version-info 1:0:0
-bin_PROGRAMS = \
+libexec_PROGRAMS = \
gnunet-service-datastore
gnunet_service_datastore_SOURCES = \
@@ -85,6 +87,7 @@ plugin_LTLIBRARIES = \
$(SQLITE_PLUGIN) \
$(MYSQL_PLUGIN) \
$(POSTGRES_PLUGIN) \
+ libgnunet_plugin_datastore_heap.la \
libgnunet_plugin_datastore_template.la
@@ -92,11 +95,21 @@ libgnunet_plugin_datastore_sqlite_la_SOURCES = \
plugin_datastore_sqlite.c
libgnunet_plugin_datastore_sqlite_la_LIBADD = \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3
+ $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3 \
+ $(LTLIBINTL)
libgnunet_plugin_datastore_sqlite_la_LDFLAGS = \
$(GN_PLUGIN_LDFLAGS)
+libgnunet_plugin_datastore_heap_la_SOURCES = \
+ plugin_datastore_heap.c
+libgnunet_plugin_datastore_heap_la_LIBADD = \
+ $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
+ $(LTLIBINTL)
+libgnunet_plugin_datastore_heap_la_LDFLAGS = \
+ $(GN_PLUGIN_LDFLAGS)
+
+
libgnunet_plugin_datastore_mysql_la_SOURCES = \
plugin_datastore_mysql.c
libgnunet_plugin_datastore_mysql_la_LIBADD = \
@@ -123,11 +136,17 @@ libgnunet_plugin_datastore_postgres_la_CPPFLAGS = \
libgnunet_plugin_datastore_template_la_SOURCES = \
plugin_datastore_template.c
libgnunet_plugin_datastore_template_la_LIBADD = \
- $(top_builddir)/src/util/libgnunetutil.la $(XLIBS)
+ $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
+ $(LTLIBINTL)
libgnunet_plugin_datastore_template_la_LDFLAGS = \
$(GN_PLUGIN_LDFLAGS)
check_PROGRAMS = \
+ test_datastore_api_heap \
+ test_datastore_api_management_heap \
+ perf_datastore_api_heap \
+ perf_plugin_datastore_heap \
+ test_plugin_datastore_heap \
$(SQLITE_TESTS) \
$(MYSQL_TESTS) \
$(POSTGRES_TESTS)
@@ -136,90 +155,139 @@ if ENABLE_TEST_RUN
TESTS = $(check_PROGRAMS)
endif
+test_datastore_api_heap_SOURCES = \
+ test_datastore_api.c
+test_datastore_api_heap_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/datastore/libgnunetdatastore.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+test_datastore_api_management_heap_SOURCES = \
+ test_datastore_api_management.c
+test_datastore_api_management_heap_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/datastore/libgnunetdatastore.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+perf_datastore_api_heap_SOURCES = \
+ perf_datastore_api.c
+perf_datastore_api_heap_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/datastore/libgnunetdatastore.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+perf_plugin_datastore_heap_SOURCES = \
+ perf_plugin_datastore.c
+perf_plugin_datastore_heap_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+test_plugin_datastore_heap_SOURCES = \
+ test_plugin_datastore.c
+test_plugin_datastore_heap_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+
test_datastore_api_sqlite_SOURCES = \
test_datastore_api.c
test_datastore_api_sqlite_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
test_datastore_api_management_sqlite_SOURCES = \
test_datastore_api_management.c
test_datastore_api_management_sqlite_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
perf_datastore_api_sqlite_SOURCES = \
perf_datastore_api.c
perf_datastore_api_sqlite_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
perf_plugin_datastore_sqlite_SOURCES = \
perf_plugin_datastore.c
perf_plugin_datastore_sqlite_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
test_plugin_datastore_sqlite_SOURCES = \
test_plugin_datastore.c
test_plugin_datastore_sqlite_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
test_datastore_api_mysql_SOURCES = \
test_datastore_api.c
test_datastore_api_mysql_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
test_datastore_api_management_mysql_SOURCES = \
test_datastore_api_management.c
test_datastore_api_management_mysql_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
perf_datastore_api_mysql_SOURCES = \
perf_datastore_api.c
perf_datastore_api_mysql_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
test_plugin_datastore_mysql_SOURCES = \
test_plugin_datastore.c
test_plugin_datastore_mysql_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
perf_plugin_datastore_mysql_SOURCES = \
perf_plugin_datastore.c
perf_plugin_datastore_mysql_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
test_datastore_api_postgres_SOURCES = \
test_datastore_api.c
test_datastore_api_postgres_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
test_datastore_api_management_postgres_SOURCES = \
test_datastore_api_management.c
test_datastore_api_management_postgres_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
perf_datastore_api_postgres_SOURCES = \
perf_datastore_api.c
perf_datastore_api_postgres_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
test_plugin_datastore_postgres_SOURCES = \
test_plugin_datastore.c
test_plugin_datastore_postgres_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
perf_plugin_datastore_postgres_SOURCES = \
perf_plugin_datastore.c
perf_plugin_datastore_postgres_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
@@ -227,10 +295,13 @@ EXTRA_DIST = \
test_defaults.conf \
test_datastore_api_data_sqlite.conf \
perf_plugin_datastore_data_sqlite.conf \
+ test_plugin_datastore_data_sqlite.conf \
+ test_datastore_api_data_heap.conf \
+ perf_plugin_datastore_data_heap.conf \
+ test_plugin_datastore_data_heap.conf \
test_datastore_api_data_mysql.conf \
perf_plugin_datastore_data_mysql.conf \
+ test_plugin_datastore_data_mysql.conf \
test_datastore_api_data_postgres.conf \
perf_plugin_datastore_data_postgres.conf \
- test_plugin_datastore_data_mysql.conf \
- test_plugin_datastore_data_postgres.conf \
- test_plugin_datastore_data_sqlite.conf \ No newline at end of file
+ test_plugin_datastore_data_postgres.conf
diff --git a/src/datastore/Makefile.in b/src/datastore/Makefile.in
index 2488d24..8aa07ba 100644
--- a/src/datastore/Makefile.in
+++ b/src/datastore/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -18,6 +18,23 @@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -37,22 +54,28 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-bin_PROGRAMS = gnunet-service-datastore$(EXEEXT)
-check_PROGRAMS = $(am__EXEEXT_2) $(am__EXEEXT_4) $(am__EXEEXT_6)
+libexec_PROGRAMS = gnunet-service-datastore$(EXEEXT)
+check_PROGRAMS = test_datastore_api_heap$(EXEEXT) \
+ test_datastore_api_management_heap$(EXEEXT) \
+ perf_datastore_api_heap$(EXEEXT) \
+ perf_plugin_datastore_heap$(EXEEXT) \
+ test_plugin_datastore_heap$(EXEEXT) $(am__EXEEXT_2) \
+ $(am__EXEEXT_4) $(am__EXEEXT_6)
subdir = src/datastore
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/datastore.conf.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \
$(top_srcdir)/m4/align.m4 $(top_srcdir)/m4/argz.m4 \
- $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/iconv.m4 \
- $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libcurl.m4 \
- $(top_srcdir)/m4/libgcrypt.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/libunistring.m4 $(top_srcdir)/m4/ltdl.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glib-2.0.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/libunistring.m4 \
+ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -82,10 +105,30 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(plugindir)" \
- "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgcfgdir)"
+ "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(pkgcfgdir)"
LTLIBRARIES = $(lib_LTLIBRARIES) $(plugin_LTLIBRARIES)
am__DEPENDENCIES_1 =
+libgnunet_plugin_datastore_heap_la_DEPENDENCIES = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_libgnunet_plugin_datastore_heap_la_OBJECTS = \
+ plugin_datastore_heap.lo
+libgnunet_plugin_datastore_heap_la_OBJECTS = \
+ $(am_libgnunet_plugin_datastore_heap_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+libgnunet_plugin_datastore_heap_la_LINK = $(LIBTOOL) $(AM_V_lt) \
+ --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
+ $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libgnunet_plugin_datastore_heap_la_LDFLAGS) $(LDFLAGS) -o $@
libgnunet_plugin_datastore_mysql_la_DEPENDENCIES = \
$(top_builddir)/src/mysql/libgnunetmysql.la \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
@@ -95,9 +138,6 @@ am_libgnunet_plugin_datastore_mysql_la_OBJECTS = \
libgnunet_plugin_datastore_mysql_la-plugin_datastore_mysql.lo
libgnunet_plugin_datastore_mysql_la_OBJECTS = \
$(am_libgnunet_plugin_datastore_mysql_la_OBJECTS)
-AM_V_lt = $(am__v_lt_$(V))
-am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
-am__v_lt_0 = --silent
libgnunet_plugin_datastore_mysql_la_LINK = $(LIBTOOL) $(AM_V_lt) \
--tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
$(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -123,7 +163,7 @@ libgnunet_plugin_datastore_postgres_la_LINK = $(LIBTOOL) $(AM_V_lt) \
libgnunet_plugin_datastore_sqlite_la_DEPENDENCIES = \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/util/libgnunetutil.la \
- $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
am_libgnunet_plugin_datastore_sqlite_la_OBJECTS = \
plugin_datastore_sqlite.lo
libgnunet_plugin_datastore_sqlite_la_OBJECTS = \
@@ -137,7 +177,7 @@ libgnunet_plugin_datastore_sqlite_la_LINK = $(LIBTOOL) $(AM_V_lt) \
@HAVE_SQLITE_TRUE@ -rpath $(plugindir)
libgnunet_plugin_datastore_template_la_DEPENDENCIES = \
$(top_builddir)/src/util/libgnunetutil.la \
- $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
am_libgnunet_plugin_datastore_template_la_OBJECTS = \
plugin_datastore_template.lo
libgnunet_plugin_datastore_template_la_OBJECTS = \
@@ -176,7 +216,7 @@ libgnunetdatastore_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
@HAVE_POSTGRES_TRUE@ test_datastore_api_management_postgres$(EXEEXT) \
@HAVE_POSTGRES_TRUE@ test_plugin_datastore_postgres$(EXEEXT) \
@HAVE_POSTGRES_TRUE@ $(am__EXEEXT_5)
-PROGRAMS = $(bin_PROGRAMS)
+PROGRAMS = $(libexec_PROGRAMS)
am_gnunet_service_datastore_OBJECTS = \
gnunet-service-datastore.$(OBJEXT)
gnunet_service_datastore_OBJECTS = \
@@ -185,47 +225,83 @@ gnunet_service_datastore_DEPENDENCIES = \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(am__DEPENDENCIES_1)
+am_perf_datastore_api_heap_OBJECTS = perf_datastore_api.$(OBJEXT)
+perf_datastore_api_heap_OBJECTS = \
+ $(am_perf_datastore_api_heap_OBJECTS)
+perf_datastore_api_heap_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/datastore/libgnunetdatastore.la \
+ $(top_builddir)/src/util/libgnunetutil.la
am_perf_datastore_api_mysql_OBJECTS = perf_datastore_api.$(OBJEXT)
perf_datastore_api_mysql_OBJECTS = \
$(am_perf_datastore_api_mysql_OBJECTS)
perf_datastore_api_mysql_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
am_perf_datastore_api_postgres_OBJECTS = perf_datastore_api.$(OBJEXT)
perf_datastore_api_postgres_OBJECTS = \
$(am_perf_datastore_api_postgres_OBJECTS)
perf_datastore_api_postgres_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
am_perf_datastore_api_sqlite_OBJECTS = perf_datastore_api.$(OBJEXT)
perf_datastore_api_sqlite_OBJECTS = \
$(am_perf_datastore_api_sqlite_OBJECTS)
perf_datastore_api_sqlite_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
+am_perf_plugin_datastore_heap_OBJECTS = \
+ perf_plugin_datastore.$(OBJEXT)
+perf_plugin_datastore_heap_OBJECTS = \
+ $(am_perf_plugin_datastore_heap_OBJECTS)
+perf_plugin_datastore_heap_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la
am_perf_plugin_datastore_mysql_OBJECTS = \
perf_plugin_datastore.$(OBJEXT)
perf_plugin_datastore_mysql_OBJECTS = \
$(am_perf_plugin_datastore_mysql_OBJECTS)
perf_plugin_datastore_mysql_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
am_perf_plugin_datastore_postgres_OBJECTS = \
perf_plugin_datastore.$(OBJEXT)
perf_plugin_datastore_postgres_OBJECTS = \
$(am_perf_plugin_datastore_postgres_OBJECTS)
perf_plugin_datastore_postgres_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
am_perf_plugin_datastore_sqlite_OBJECTS = \
perf_plugin_datastore.$(OBJEXT)
perf_plugin_datastore_sqlite_OBJECTS = \
$(am_perf_plugin_datastore_sqlite_OBJECTS)
perf_plugin_datastore_sqlite_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+am_test_datastore_api_heap_OBJECTS = test_datastore_api.$(OBJEXT)
+test_datastore_api_heap_OBJECTS = \
+ $(am_test_datastore_api_heap_OBJECTS)
+test_datastore_api_heap_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/datastore/libgnunetdatastore.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+am_test_datastore_api_management_heap_OBJECTS = \
+ test_datastore_api_management.$(OBJEXT)
+test_datastore_api_management_heap_OBJECTS = \
+ $(am_test_datastore_api_management_heap_OBJECTS)
+test_datastore_api_management_heap_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
am_test_datastore_api_management_mysql_OBJECTS = \
test_datastore_api_management.$(OBJEXT)
test_datastore_api_management_mysql_OBJECTS = \
$(am_test_datastore_api_management_mysql_OBJECTS)
test_datastore_api_management_mysql_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
am_test_datastore_api_management_postgres_OBJECTS = \
@@ -233,6 +309,7 @@ am_test_datastore_api_management_postgres_OBJECTS = \
test_datastore_api_management_postgres_OBJECTS = \
$(am_test_datastore_api_management_postgres_OBJECTS)
test_datastore_api_management_postgres_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
am_test_datastore_api_management_sqlite_OBJECTS = \
@@ -240,43 +317,57 @@ am_test_datastore_api_management_sqlite_OBJECTS = \
test_datastore_api_management_sqlite_OBJECTS = \
$(am_test_datastore_api_management_sqlite_OBJECTS)
test_datastore_api_management_sqlite_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
am_test_datastore_api_mysql_OBJECTS = test_datastore_api.$(OBJEXT)
test_datastore_api_mysql_OBJECTS = \
$(am_test_datastore_api_mysql_OBJECTS)
test_datastore_api_mysql_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
am_test_datastore_api_postgres_OBJECTS = test_datastore_api.$(OBJEXT)
test_datastore_api_postgres_OBJECTS = \
$(am_test_datastore_api_postgres_OBJECTS)
test_datastore_api_postgres_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
am_test_datastore_api_sqlite_OBJECTS = test_datastore_api.$(OBJEXT)
test_datastore_api_sqlite_OBJECTS = \
$(am_test_datastore_api_sqlite_OBJECTS)
test_datastore_api_sqlite_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
+am_test_plugin_datastore_heap_OBJECTS = \
+ test_plugin_datastore.$(OBJEXT)
+test_plugin_datastore_heap_OBJECTS = \
+ $(am_test_plugin_datastore_heap_OBJECTS)
+test_plugin_datastore_heap_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la
am_test_plugin_datastore_mysql_OBJECTS = \
test_plugin_datastore.$(OBJEXT)
test_plugin_datastore_mysql_OBJECTS = \
$(am_test_plugin_datastore_mysql_OBJECTS)
test_plugin_datastore_mysql_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
am_test_plugin_datastore_postgres_OBJECTS = \
test_plugin_datastore.$(OBJEXT)
test_plugin_datastore_postgres_OBJECTS = \
$(am_test_plugin_datastore_postgres_OBJECTS)
test_plugin_datastore_postgres_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
am_test_plugin_datastore_sqlite_OBJECTS = \
test_plugin_datastore.$(OBJEXT)
test_plugin_datastore_sqlite_OBJECTS = \
$(am_test_plugin_datastore_sqlite_OBJECTS)
test_plugin_datastore_sqlite_DEPENDENCIES = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -288,64 +379,81 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_$(V))
-am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_$(V))
-am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
-SOURCES = $(libgnunet_plugin_datastore_mysql_la_SOURCES) \
+SOURCES = $(libgnunet_plugin_datastore_heap_la_SOURCES) \
+ $(libgnunet_plugin_datastore_mysql_la_SOURCES) \
$(libgnunet_plugin_datastore_postgres_la_SOURCES) \
$(libgnunet_plugin_datastore_sqlite_la_SOURCES) \
$(libgnunet_plugin_datastore_template_la_SOURCES) \
$(libgnunetdatastore_la_SOURCES) \
$(gnunet_service_datastore_SOURCES) \
+ $(perf_datastore_api_heap_SOURCES) \
$(perf_datastore_api_mysql_SOURCES) \
$(perf_datastore_api_postgres_SOURCES) \
$(perf_datastore_api_sqlite_SOURCES) \
+ $(perf_plugin_datastore_heap_SOURCES) \
$(perf_plugin_datastore_mysql_SOURCES) \
$(perf_plugin_datastore_postgres_SOURCES) \
$(perf_plugin_datastore_sqlite_SOURCES) \
+ $(test_datastore_api_heap_SOURCES) \
+ $(test_datastore_api_management_heap_SOURCES) \
$(test_datastore_api_management_mysql_SOURCES) \
$(test_datastore_api_management_postgres_SOURCES) \
$(test_datastore_api_management_sqlite_SOURCES) \
$(test_datastore_api_mysql_SOURCES) \
$(test_datastore_api_postgres_SOURCES) \
$(test_datastore_api_sqlite_SOURCES) \
+ $(test_plugin_datastore_heap_SOURCES) \
$(test_plugin_datastore_mysql_SOURCES) \
$(test_plugin_datastore_postgres_SOURCES) \
$(test_plugin_datastore_sqlite_SOURCES)
-DIST_SOURCES = $(libgnunet_plugin_datastore_mysql_la_SOURCES) \
+DIST_SOURCES = $(libgnunet_plugin_datastore_heap_la_SOURCES) \
+ $(libgnunet_plugin_datastore_mysql_la_SOURCES) \
$(libgnunet_plugin_datastore_postgres_la_SOURCES) \
$(libgnunet_plugin_datastore_sqlite_la_SOURCES) \
$(libgnunet_plugin_datastore_template_la_SOURCES) \
$(libgnunetdatastore_la_SOURCES) \
$(gnunet_service_datastore_SOURCES) \
+ $(perf_datastore_api_heap_SOURCES) \
$(perf_datastore_api_mysql_SOURCES) \
$(perf_datastore_api_postgres_SOURCES) \
$(perf_datastore_api_sqlite_SOURCES) \
+ $(perf_plugin_datastore_heap_SOURCES) \
$(perf_plugin_datastore_mysql_SOURCES) \
$(perf_plugin_datastore_postgres_SOURCES) \
$(perf_plugin_datastore_sqlite_SOURCES) \
+ $(test_datastore_api_heap_SOURCES) \
+ $(test_datastore_api_management_heap_SOURCES) \
$(test_datastore_api_management_mysql_SOURCES) \
$(test_datastore_api_management_postgres_SOURCES) \
$(test_datastore_api_management_sqlite_SOURCES) \
$(test_datastore_api_mysql_SOURCES) \
$(test_datastore_api_postgres_SOURCES) \
$(test_datastore_api_sqlite_SOURCES) \
+ $(test_plugin_datastore_heap_SOURCES) \
$(test_plugin_datastore_mysql_SOURCES) \
$(test_plugin_datastore_postgres_SOURCES) \
$(test_plugin_datastore_sqlite_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
DATA = $(pkgcfg_DATA)
ETAGS = etags
CTAGS = ctags
@@ -387,6 +495,10 @@ EXEEXT = @EXEEXT@
EXT_LIBS = @EXT_LIBS@
EXT_LIB_PATH = @EXT_LIB_PATH@
FGREP = @FGREP@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
GNUNETDNS_GROUP = @GNUNETDNS_GROUP@
@@ -397,6 +509,7 @@ GN_LIBINTL = @GN_LIBINTL@
GN_LIB_LDFLAGS = @GN_LIB_LDFLAGS@
GN_PLUGIN_LDFLAGS = @GN_PLUGIN_LDFLAGS@
GN_USER_HOME_DIR = @GN_USER_HOME_DIR@
+GOBJECT_QUERY = @GOBJECT_QUERY@
GREP = @GREP@
HAVE_LIBUNISTRING = @HAVE_LIBUNISTRING@
INCLTDL = @INCLTDL@
@@ -419,6 +532,8 @@ LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@
LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+LIBGTOP_CFLAGS = @LIBGTOP_CFLAGS@
+LIBGTOP_LIBS = @LIBGTOP_LIBS@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBLTDL = @LIBLTDL@
@@ -440,6 +555,7 @@ LT_CONFIG_H = @LT_CONFIG_H@
LT_DLLOADERS = @LT_DLLOADERS@
LT_DLPREOPEN = @LT_DLPREOPEN@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MONKEYPREFIX = @MONKEYPREFIX@
MSGFMT = @MSGFMT@
@@ -449,6 +565,7 @@ MYSQL_CPPFLAGS = @MYSQL_CPPFLAGS@
MYSQL_LDFLAGS = @MYSQL_LDFLAGS@
NM = @NM@
NMEDIT = @NMEDIT@
+NSS_DIR = @NSS_DIR@
OBJC = @OBJC@
OBJCDEPMODE = @OBJCDEPMODE@
OBJCFLAGS = @OBJCFLAGS@
@@ -464,6 +581,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
POSTGRES_CPPFLAGS = @POSTGRES_CPPFLAGS@
POSTGRES_LDFLAGS = @POSTGRES_LDFLAGS@
POSUB = @POSUB@
@@ -495,6 +613,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -517,6 +636,7 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+gitcommand = @gitcommand@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -527,10 +647,9 @@ includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
-libexecdir = @libexecdir@
+libexecdir = $(pkglibdir)/libexec/
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
ltdl_LIBOBJS = @ltdl_LIBOBJS@
ltdl_LTLIBOBJS = @ltdl_LTLIBOBJS@
mandir = @mandir@
@@ -548,6 +667,7 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
+svnversioncommand = @svnversioncommand@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@
@@ -627,6 +747,7 @@ plugin_LTLIBRARIES = \
$(SQLITE_PLUGIN) \
$(MYSQL_PLUGIN) \
$(POSTGRES_PLUGIN) \
+ libgnunet_plugin_datastore_heap.la \
libgnunet_plugin_datastore_template.la
libgnunet_plugin_datastore_sqlite_la_SOURCES = \
@@ -634,11 +755,22 @@ libgnunet_plugin_datastore_sqlite_la_SOURCES = \
libgnunet_plugin_datastore_sqlite_la_LIBADD = \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3
+ $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3 \
+ $(LTLIBINTL)
libgnunet_plugin_datastore_sqlite_la_LDFLAGS = \
$(GN_PLUGIN_LDFLAGS)
+libgnunet_plugin_datastore_heap_la_SOURCES = \
+ plugin_datastore_heap.c
+
+libgnunet_plugin_datastore_heap_la_LIBADD = \
+ $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
+ $(LTLIBINTL)
+
+libgnunet_plugin_datastore_heap_la_LDFLAGS = \
+ $(GN_PLUGIN_LDFLAGS)
+
libgnunet_plugin_datastore_mysql_la_SOURCES = \
plugin_datastore_mysql.c
@@ -671,16 +803,56 @@ libgnunet_plugin_datastore_template_la_SOURCES = \
plugin_datastore_template.c
libgnunet_plugin_datastore_template_la_LIBADD = \
- $(top_builddir)/src/util/libgnunetutil.la $(XLIBS)
+ $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
+ $(LTLIBINTL)
libgnunet_plugin_datastore_template_la_LDFLAGS = \
$(GN_PLUGIN_LDFLAGS)
@ENABLE_TEST_RUN_TRUE@TESTS = $(check_PROGRAMS)
+test_datastore_api_heap_SOURCES = \
+ test_datastore_api.c
+
+test_datastore_api_heap_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/datastore/libgnunetdatastore.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+test_datastore_api_management_heap_SOURCES = \
+ test_datastore_api_management.c
+
+test_datastore_api_management_heap_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/datastore/libgnunetdatastore.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+perf_datastore_api_heap_SOURCES = \
+ perf_datastore_api.c
+
+perf_datastore_api_heap_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/datastore/libgnunetdatastore.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+perf_plugin_datastore_heap_SOURCES = \
+ perf_plugin_datastore.c
+
+perf_plugin_datastore_heap_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+test_plugin_datastore_heap_SOURCES = \
+ test_plugin_datastore.c
+
+test_plugin_datastore_heap_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
test_datastore_api_sqlite_SOURCES = \
test_datastore_api.c
test_datastore_api_sqlite_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
@@ -688,6 +860,7 @@ test_datastore_api_management_sqlite_SOURCES = \
test_datastore_api_management.c
test_datastore_api_management_sqlite_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
@@ -695,6 +868,7 @@ perf_datastore_api_sqlite_SOURCES = \
perf_datastore_api.c
perf_datastore_api_sqlite_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
@@ -702,18 +876,21 @@ perf_plugin_datastore_sqlite_SOURCES = \
perf_plugin_datastore.c
perf_plugin_datastore_sqlite_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
test_plugin_datastore_sqlite_SOURCES = \
test_plugin_datastore.c
test_plugin_datastore_sqlite_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
test_datastore_api_mysql_SOURCES = \
test_datastore_api.c
test_datastore_api_mysql_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
@@ -721,6 +898,7 @@ test_datastore_api_management_mysql_SOURCES = \
test_datastore_api_management.c
test_datastore_api_management_mysql_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
@@ -728,6 +906,7 @@ perf_datastore_api_mysql_SOURCES = \
perf_datastore_api.c
perf_datastore_api_mysql_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
@@ -735,18 +914,21 @@ test_plugin_datastore_mysql_SOURCES = \
test_plugin_datastore.c
test_plugin_datastore_mysql_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
perf_plugin_datastore_mysql_SOURCES = \
perf_plugin_datastore.c
perf_plugin_datastore_mysql_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
test_datastore_api_postgres_SOURCES = \
test_datastore_api.c
test_datastore_api_postgres_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
@@ -754,6 +936,7 @@ test_datastore_api_management_postgres_SOURCES = \
test_datastore_api_management.c
test_datastore_api_management_postgres_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
@@ -761,6 +944,7 @@ perf_datastore_api_postgres_SOURCES = \
perf_datastore_api.c
perf_datastore_api_postgres_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la
@@ -768,25 +952,30 @@ test_plugin_datastore_postgres_SOURCES = \
test_plugin_datastore.c
test_plugin_datastore_postgres_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
perf_plugin_datastore_postgres_SOURCES = \
perf_plugin_datastore.c
perf_plugin_datastore_postgres_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
EXTRA_DIST = \
test_defaults.conf \
test_datastore_api_data_sqlite.conf \
perf_plugin_datastore_data_sqlite.conf \
+ test_plugin_datastore_data_sqlite.conf \
+ test_datastore_api_data_heap.conf \
+ perf_plugin_datastore_data_heap.conf \
+ test_plugin_datastore_data_heap.conf \
test_datastore_api_data_mysql.conf \
perf_plugin_datastore_data_mysql.conf \
+ test_plugin_datastore_data_mysql.conf \
test_datastore_api_data_postgres.conf \
perf_plugin_datastore_data_postgres.conf \
- test_plugin_datastore_data_mysql.conf \
- test_plugin_datastore_data_postgres.conf \
- test_plugin_datastore_data_sqlite.conf
+ test_plugin_datastore_data_postgres.conf
all: all-am
@@ -826,7 +1015,6 @@ datastore.conf: $(top_builddir)/config.status $(srcdir)/datastore.conf.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
@@ -834,6 +1022,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
else :; fi; \
done; \
test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
@@ -857,7 +1047,6 @@ clean-libLTLIBRARIES:
done
install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)"
@list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
@@ -865,6 +1054,8 @@ install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
else :; fi; \
done; \
test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \
}
@@ -886,20 +1077,34 @@ clean-pluginLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libgnunet_plugin_datastore_mysql.la: $(libgnunet_plugin_datastore_mysql_la_OBJECTS) $(libgnunet_plugin_datastore_mysql_la_DEPENDENCIES)
+libgnunet_plugin_datastore_heap.la: $(libgnunet_plugin_datastore_heap_la_OBJECTS) $(libgnunet_plugin_datastore_heap_la_DEPENDENCIES) $(EXTRA_libgnunet_plugin_datastore_heap_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libgnunet_plugin_datastore_heap_la_LINK) -rpath $(plugindir) $(libgnunet_plugin_datastore_heap_la_OBJECTS) $(libgnunet_plugin_datastore_heap_la_LIBADD) $(LIBS)
+libgnunet_plugin_datastore_mysql.la: $(libgnunet_plugin_datastore_mysql_la_OBJECTS) $(libgnunet_plugin_datastore_mysql_la_DEPENDENCIES) $(EXTRA_libgnunet_plugin_datastore_mysql_la_DEPENDENCIES)
$(AM_V_CCLD)$(libgnunet_plugin_datastore_mysql_la_LINK) $(am_libgnunet_plugin_datastore_mysql_la_rpath) $(libgnunet_plugin_datastore_mysql_la_OBJECTS) $(libgnunet_plugin_datastore_mysql_la_LIBADD) $(LIBS)
-libgnunet_plugin_datastore_postgres.la: $(libgnunet_plugin_datastore_postgres_la_OBJECTS) $(libgnunet_plugin_datastore_postgres_la_DEPENDENCIES)
+libgnunet_plugin_datastore_postgres.la: $(libgnunet_plugin_datastore_postgres_la_OBJECTS) $(libgnunet_plugin_datastore_postgres_la_DEPENDENCIES) $(EXTRA_libgnunet_plugin_datastore_postgres_la_DEPENDENCIES)
$(AM_V_CCLD)$(libgnunet_plugin_datastore_postgres_la_LINK) $(am_libgnunet_plugin_datastore_postgres_la_rpath) $(libgnunet_plugin_datastore_postgres_la_OBJECTS) $(libgnunet_plugin_datastore_postgres_la_LIBADD) $(LIBS)
-libgnunet_plugin_datastore_sqlite.la: $(libgnunet_plugin_datastore_sqlite_la_OBJECTS) $(libgnunet_plugin_datastore_sqlite_la_DEPENDENCIES)
+libgnunet_plugin_datastore_sqlite.la: $(libgnunet_plugin_datastore_sqlite_la_OBJECTS) $(libgnunet_plugin_datastore_sqlite_la_DEPENDENCIES) $(EXTRA_libgnunet_plugin_datastore_sqlite_la_DEPENDENCIES)
$(AM_V_CCLD)$(libgnunet_plugin_datastore_sqlite_la_LINK) $(am_libgnunet_plugin_datastore_sqlite_la_rpath) $(libgnunet_plugin_datastore_sqlite_la_OBJECTS) $(libgnunet_plugin_datastore_sqlite_la_LIBADD) $(LIBS)
-libgnunet_plugin_datastore_template.la: $(libgnunet_plugin_datastore_template_la_OBJECTS) $(libgnunet_plugin_datastore_template_la_DEPENDENCIES)
+libgnunet_plugin_datastore_template.la: $(libgnunet_plugin_datastore_template_la_OBJECTS) $(libgnunet_plugin_datastore_template_la_DEPENDENCIES) $(EXTRA_libgnunet_plugin_datastore_template_la_DEPENDENCIES)
$(AM_V_CCLD)$(libgnunet_plugin_datastore_template_la_LINK) -rpath $(plugindir) $(libgnunet_plugin_datastore_template_la_OBJECTS) $(libgnunet_plugin_datastore_template_la_LIBADD) $(LIBS)
-libgnunetdatastore.la: $(libgnunetdatastore_la_OBJECTS) $(libgnunetdatastore_la_DEPENDENCIES)
+libgnunetdatastore.la: $(libgnunetdatastore_la_OBJECTS) $(libgnunetdatastore_la_DEPENDENCIES) $(EXTRA_libgnunetdatastore_la_DEPENDENCIES)
$(AM_V_CCLD)$(libgnunetdatastore_la_LINK) -rpath $(libdir) $(libgnunetdatastore_la_OBJECTS) $(libgnunetdatastore_la_LIBADD) $(LIBS)
-install-binPROGRAMS: $(bin_PROGRAMS)
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+install-libexecPROGRAMS: $(libexec_PROGRAMS)
@$(NORMAL_INSTALL)
- test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
- @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \
+ fi; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p || test -f $$p1; \
@@ -916,84 +1121,90 @@ install-binPROGRAMS: $(bin_PROGRAMS)
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
- echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
- $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \
} \
; done
-uninstall-binPROGRAMS:
+uninstall-libexecPROGRAMS:
@$(NORMAL_UNINSTALL)
- @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' `; \
test -n "$$list" || exit 0; \
- echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(bindir)" && rm -f $$files
+ echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(libexecdir)" && rm -f $$files
-clean-binPROGRAMS:
- @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+clean-libexecPROGRAMS:
+ @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
-
-clean-checkPROGRAMS:
- @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
- echo " rm -f" $$list; \
- rm -f $$list || exit $$?; \
- test -n "$(EXEEXT)" || exit 0; \
- list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f" $$list; \
- rm -f $$list
-gnunet-service-datastore$(EXEEXT): $(gnunet_service_datastore_OBJECTS) $(gnunet_service_datastore_DEPENDENCIES)
+gnunet-service-datastore$(EXEEXT): $(gnunet_service_datastore_OBJECTS) $(gnunet_service_datastore_DEPENDENCIES) $(EXTRA_gnunet_service_datastore_DEPENDENCIES)
@rm -f gnunet-service-datastore$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(gnunet_service_datastore_OBJECTS) $(gnunet_service_datastore_LDADD) $(LIBS)
-perf_datastore_api_mysql$(EXEEXT): $(perf_datastore_api_mysql_OBJECTS) $(perf_datastore_api_mysql_DEPENDENCIES)
+perf_datastore_api_heap$(EXEEXT): $(perf_datastore_api_heap_OBJECTS) $(perf_datastore_api_heap_DEPENDENCIES) $(EXTRA_perf_datastore_api_heap_DEPENDENCIES)
+ @rm -f perf_datastore_api_heap$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(perf_datastore_api_heap_OBJECTS) $(perf_datastore_api_heap_LDADD) $(LIBS)
+perf_datastore_api_mysql$(EXEEXT): $(perf_datastore_api_mysql_OBJECTS) $(perf_datastore_api_mysql_DEPENDENCIES) $(EXTRA_perf_datastore_api_mysql_DEPENDENCIES)
@rm -f perf_datastore_api_mysql$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(perf_datastore_api_mysql_OBJECTS) $(perf_datastore_api_mysql_LDADD) $(LIBS)
-perf_datastore_api_postgres$(EXEEXT): $(perf_datastore_api_postgres_OBJECTS) $(perf_datastore_api_postgres_DEPENDENCIES)
+perf_datastore_api_postgres$(EXEEXT): $(perf_datastore_api_postgres_OBJECTS) $(perf_datastore_api_postgres_DEPENDENCIES) $(EXTRA_perf_datastore_api_postgres_DEPENDENCIES)
@rm -f perf_datastore_api_postgres$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(perf_datastore_api_postgres_OBJECTS) $(perf_datastore_api_postgres_LDADD) $(LIBS)
-perf_datastore_api_sqlite$(EXEEXT): $(perf_datastore_api_sqlite_OBJECTS) $(perf_datastore_api_sqlite_DEPENDENCIES)
+perf_datastore_api_sqlite$(EXEEXT): $(perf_datastore_api_sqlite_OBJECTS) $(perf_datastore_api_sqlite_DEPENDENCIES) $(EXTRA_perf_datastore_api_sqlite_DEPENDENCIES)
@rm -f perf_datastore_api_sqlite$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(perf_datastore_api_sqlite_OBJECTS) $(perf_datastore_api_sqlite_LDADD) $(LIBS)
-perf_plugin_datastore_mysql$(EXEEXT): $(perf_plugin_datastore_mysql_OBJECTS) $(perf_plugin_datastore_mysql_DEPENDENCIES)
+perf_plugin_datastore_heap$(EXEEXT): $(perf_plugin_datastore_heap_OBJECTS) $(perf_plugin_datastore_heap_DEPENDENCIES) $(EXTRA_perf_plugin_datastore_heap_DEPENDENCIES)
+ @rm -f perf_plugin_datastore_heap$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(perf_plugin_datastore_heap_OBJECTS) $(perf_plugin_datastore_heap_LDADD) $(LIBS)
+perf_plugin_datastore_mysql$(EXEEXT): $(perf_plugin_datastore_mysql_OBJECTS) $(perf_plugin_datastore_mysql_DEPENDENCIES) $(EXTRA_perf_plugin_datastore_mysql_DEPENDENCIES)
@rm -f perf_plugin_datastore_mysql$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(perf_plugin_datastore_mysql_OBJECTS) $(perf_plugin_datastore_mysql_LDADD) $(LIBS)
-perf_plugin_datastore_postgres$(EXEEXT): $(perf_plugin_datastore_postgres_OBJECTS) $(perf_plugin_datastore_postgres_DEPENDENCIES)
+perf_plugin_datastore_postgres$(EXEEXT): $(perf_plugin_datastore_postgres_OBJECTS) $(perf_plugin_datastore_postgres_DEPENDENCIES) $(EXTRA_perf_plugin_datastore_postgres_DEPENDENCIES)
@rm -f perf_plugin_datastore_postgres$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(perf_plugin_datastore_postgres_OBJECTS) $(perf_plugin_datastore_postgres_LDADD) $(LIBS)
-perf_plugin_datastore_sqlite$(EXEEXT): $(perf_plugin_datastore_sqlite_OBJECTS) $(perf_plugin_datastore_sqlite_DEPENDENCIES)
+perf_plugin_datastore_sqlite$(EXEEXT): $(perf_plugin_datastore_sqlite_OBJECTS) $(perf_plugin_datastore_sqlite_DEPENDENCIES) $(EXTRA_perf_plugin_datastore_sqlite_DEPENDENCIES)
@rm -f perf_plugin_datastore_sqlite$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(perf_plugin_datastore_sqlite_OBJECTS) $(perf_plugin_datastore_sqlite_LDADD) $(LIBS)
-test_datastore_api_management_mysql$(EXEEXT): $(test_datastore_api_management_mysql_OBJECTS) $(test_datastore_api_management_mysql_DEPENDENCIES)
+test_datastore_api_heap$(EXEEXT): $(test_datastore_api_heap_OBJECTS) $(test_datastore_api_heap_DEPENDENCIES) $(EXTRA_test_datastore_api_heap_DEPENDENCIES)
+ @rm -f test_datastore_api_heap$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_datastore_api_heap_OBJECTS) $(test_datastore_api_heap_LDADD) $(LIBS)
+test_datastore_api_management_heap$(EXEEXT): $(test_datastore_api_management_heap_OBJECTS) $(test_datastore_api_management_heap_DEPENDENCIES) $(EXTRA_test_datastore_api_management_heap_DEPENDENCIES)
+ @rm -f test_datastore_api_management_heap$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_datastore_api_management_heap_OBJECTS) $(test_datastore_api_management_heap_LDADD) $(LIBS)
+test_datastore_api_management_mysql$(EXEEXT): $(test_datastore_api_management_mysql_OBJECTS) $(test_datastore_api_management_mysql_DEPENDENCIES) $(EXTRA_test_datastore_api_management_mysql_DEPENDENCIES)
@rm -f test_datastore_api_management_mysql$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(test_datastore_api_management_mysql_OBJECTS) $(test_datastore_api_management_mysql_LDADD) $(LIBS)
-test_datastore_api_management_postgres$(EXEEXT): $(test_datastore_api_management_postgres_OBJECTS) $(test_datastore_api_management_postgres_DEPENDENCIES)
+test_datastore_api_management_postgres$(EXEEXT): $(test_datastore_api_management_postgres_OBJECTS) $(test_datastore_api_management_postgres_DEPENDENCIES) $(EXTRA_test_datastore_api_management_postgres_DEPENDENCIES)
@rm -f test_datastore_api_management_postgres$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(test_datastore_api_management_postgres_OBJECTS) $(test_datastore_api_management_postgres_LDADD) $(LIBS)
-test_datastore_api_management_sqlite$(EXEEXT): $(test_datastore_api_management_sqlite_OBJECTS) $(test_datastore_api_management_sqlite_DEPENDENCIES)
+test_datastore_api_management_sqlite$(EXEEXT): $(test_datastore_api_management_sqlite_OBJECTS) $(test_datastore_api_management_sqlite_DEPENDENCIES) $(EXTRA_test_datastore_api_management_sqlite_DEPENDENCIES)
@rm -f test_datastore_api_management_sqlite$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(test_datastore_api_management_sqlite_OBJECTS) $(test_datastore_api_management_sqlite_LDADD) $(LIBS)
-test_datastore_api_mysql$(EXEEXT): $(test_datastore_api_mysql_OBJECTS) $(test_datastore_api_mysql_DEPENDENCIES)
+test_datastore_api_mysql$(EXEEXT): $(test_datastore_api_mysql_OBJECTS) $(test_datastore_api_mysql_DEPENDENCIES) $(EXTRA_test_datastore_api_mysql_DEPENDENCIES)
@rm -f test_datastore_api_mysql$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(test_datastore_api_mysql_OBJECTS) $(test_datastore_api_mysql_LDADD) $(LIBS)
-test_datastore_api_postgres$(EXEEXT): $(test_datastore_api_postgres_OBJECTS) $(test_datastore_api_postgres_DEPENDENCIES)
+test_datastore_api_postgres$(EXEEXT): $(test_datastore_api_postgres_OBJECTS) $(test_datastore_api_postgres_DEPENDENCIES) $(EXTRA_test_datastore_api_postgres_DEPENDENCIES)
@rm -f test_datastore_api_postgres$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(test_datastore_api_postgres_OBJECTS) $(test_datastore_api_postgres_LDADD) $(LIBS)
-test_datastore_api_sqlite$(EXEEXT): $(test_datastore_api_sqlite_OBJECTS) $(test_datastore_api_sqlite_DEPENDENCIES)
+test_datastore_api_sqlite$(EXEEXT): $(test_datastore_api_sqlite_OBJECTS) $(test_datastore_api_sqlite_DEPENDENCIES) $(EXTRA_test_datastore_api_sqlite_DEPENDENCIES)
@rm -f test_datastore_api_sqlite$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(test_datastore_api_sqlite_OBJECTS) $(test_datastore_api_sqlite_LDADD) $(LIBS)
-test_plugin_datastore_mysql$(EXEEXT): $(test_plugin_datastore_mysql_OBJECTS) $(test_plugin_datastore_mysql_DEPENDENCIES)
+test_plugin_datastore_heap$(EXEEXT): $(test_plugin_datastore_heap_OBJECTS) $(test_plugin_datastore_heap_DEPENDENCIES) $(EXTRA_test_plugin_datastore_heap_DEPENDENCIES)
+ @rm -f test_plugin_datastore_heap$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_plugin_datastore_heap_OBJECTS) $(test_plugin_datastore_heap_LDADD) $(LIBS)
+test_plugin_datastore_mysql$(EXEEXT): $(test_plugin_datastore_mysql_OBJECTS) $(test_plugin_datastore_mysql_DEPENDENCIES) $(EXTRA_test_plugin_datastore_mysql_DEPENDENCIES)
@rm -f test_plugin_datastore_mysql$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(test_plugin_datastore_mysql_OBJECTS) $(test_plugin_datastore_mysql_LDADD) $(LIBS)
-test_plugin_datastore_postgres$(EXEEXT): $(test_plugin_datastore_postgres_OBJECTS) $(test_plugin_datastore_postgres_DEPENDENCIES)
+test_plugin_datastore_postgres$(EXEEXT): $(test_plugin_datastore_postgres_OBJECTS) $(test_plugin_datastore_postgres_DEPENDENCIES) $(EXTRA_test_plugin_datastore_postgres_DEPENDENCIES)
@rm -f test_plugin_datastore_postgres$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(test_plugin_datastore_postgres_OBJECTS) $(test_plugin_datastore_postgres_LDADD) $(LIBS)
-test_plugin_datastore_sqlite$(EXEEXT): $(test_plugin_datastore_sqlite_OBJECTS) $(test_plugin_datastore_sqlite_DEPENDENCIES)
+test_plugin_datastore_sqlite$(EXEEXT): $(test_plugin_datastore_sqlite_OBJECTS) $(test_plugin_datastore_sqlite_DEPENDENCIES) $(EXTRA_test_plugin_datastore_sqlite_DEPENDENCIES)
@rm -f test_plugin_datastore_sqlite$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(test_plugin_datastore_sqlite_OBJECTS) $(test_plugin_datastore_sqlite_LDADD) $(LIBS)
@@ -1009,6 +1220,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgnunet_plugin_datastore_postgres_la-plugin_datastore_postgres.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perf_datastore_api.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perf_plugin_datastore.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_datastore_heap.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_datastore_sqlite.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_datastore_template.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_datastore_api.Po@am__quote@
@@ -1018,42 +1230,37 @@ distclean-compile:
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
libgnunet_plugin_datastore_mysql_la-plugin_datastore_mysql.lo: plugin_datastore_mysql.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgnunet_plugin_datastore_mysql_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgnunet_plugin_datastore_mysql_la-plugin_datastore_mysql.lo -MD -MP -MF $(DEPDIR)/libgnunet_plugin_datastore_mysql_la-plugin_datastore_mysql.Tpo -c -o libgnunet_plugin_datastore_mysql_la-plugin_datastore_mysql.lo `test -f 'plugin_datastore_mysql.c' || echo '$(srcdir)/'`plugin_datastore_mysql.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgnunet_plugin_datastore_mysql_la-plugin_datastore_mysql.Tpo $(DEPDIR)/libgnunet_plugin_datastore_mysql_la-plugin_datastore_mysql.Plo
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='plugin_datastore_mysql.c' object='libgnunet_plugin_datastore_mysql_la-plugin_datastore_mysql.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='plugin_datastore_mysql.c' object='libgnunet_plugin_datastore_mysql_la-plugin_datastore_mysql.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgnunet_plugin_datastore_mysql_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgnunet_plugin_datastore_mysql_la-plugin_datastore_mysql.lo `test -f 'plugin_datastore_mysql.c' || echo '$(srcdir)/'`plugin_datastore_mysql.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgnunet_plugin_datastore_mysql_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgnunet_plugin_datastore_mysql_la-plugin_datastore_mysql.lo `test -f 'plugin_datastore_mysql.c' || echo '$(srcdir)/'`plugin_datastore_mysql.c
libgnunet_plugin_datastore_postgres_la-plugin_datastore_postgres.lo: plugin_datastore_postgres.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgnunet_plugin_datastore_postgres_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgnunet_plugin_datastore_postgres_la-plugin_datastore_postgres.lo -MD -MP -MF $(DEPDIR)/libgnunet_plugin_datastore_postgres_la-plugin_datastore_postgres.Tpo -c -o libgnunet_plugin_datastore_postgres_la-plugin_datastore_postgres.lo `test -f 'plugin_datastore_postgres.c' || echo '$(srcdir)/'`plugin_datastore_postgres.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgnunet_plugin_datastore_postgres_la-plugin_datastore_postgres.Tpo $(DEPDIR)/libgnunet_plugin_datastore_postgres_la-plugin_datastore_postgres.Plo
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='plugin_datastore_postgres.c' object='libgnunet_plugin_datastore_postgres_la-plugin_datastore_postgres.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='plugin_datastore_postgres.c' object='libgnunet_plugin_datastore_postgres_la-plugin_datastore_postgres.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgnunet_plugin_datastore_postgres_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgnunet_plugin_datastore_postgres_la-plugin_datastore_postgres.lo `test -f 'plugin_datastore_postgres.c' || echo '$(srcdir)/'`plugin_datastore_postgres.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgnunet_plugin_datastore_postgres_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgnunet_plugin_datastore_postgres_la-plugin_datastore_postgres.lo `test -f 'plugin_datastore_postgres.c' || echo '$(srcdir)/'`plugin_datastore_postgres.c
mostlyclean-libtool:
-rm -f *.lo
@@ -1062,8 +1269,11 @@ clean-libtool:
-rm -rf .libs _libs
install-pkgcfgDATA: $(pkgcfg_DATA)
@$(NORMAL_INSTALL)
- test -z "$(pkgcfgdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgcfgdir)"
@list='$(pkgcfg_DATA)'; test -n "$(pkgcfgdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgcfgdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgcfgdir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@@ -1077,9 +1287,7 @@ uninstall-pkgcfgDATA:
@$(NORMAL_UNINSTALL)
@list='$(pkgcfg_DATA)'; test -n "$(pkgcfgdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- test -n "$$files" || exit 0; \
- echo " ( cd '$(DESTDIR)$(pkgcfgdir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(pkgcfgdir)" && rm -f $$files
+ dir='$(DESTDIR)$(pkgcfgdir)'; $(am__uninstall_files_from_dir)
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -1214,14 +1422,15 @@ check-TESTS: $(TESTS)
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
if test "$$failed" -eq 0; then \
- echo "$$grn$$dashes"; \
+ col="$$grn"; \
else \
- echo "$$red$$dashes"; \
+ col="$$red"; \
fi; \
- echo "$$banner"; \
- test -z "$$skipped" || echo "$$skipped"; \
- test -z "$$report" || echo "$$report"; \
- echo "$$dashes$$std"; \
+ echo "$${col}$$dashes$${std}"; \
+ echo "$${col}$$banner$${std}"; \
+ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+ test -z "$$report" || echo "$${col}$$report$${std}"; \
+ echo "$${col}$$dashes$${std}"; \
test "$$failed" -eq 0; \
else :; fi
@@ -1260,10 +1469,8 @@ check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA)
-install-binPROGRAMS: install-libLTLIBRARIES
-
installdirs:
- for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgcfgdir)"; do \
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(pkgcfgdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@@ -1276,10 +1483,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
@@ -1293,8 +1505,8 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
- clean-libLTLIBRARIES clean-libtool clean-pluginLTLIBRARIES \
+clean-am: clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \
+ clean-libexecPROGRAMS clean-libtool clean-pluginLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
@@ -1321,7 +1533,7 @@ install-dvi: install-dvi-am
install-dvi-am:
-install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+install-exec-am: install-libLTLIBRARIES install-libexecPROGRAMS
install-html: install-html-am
@@ -1361,27 +1573,27 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES \
+uninstall-am: uninstall-libLTLIBRARIES uninstall-libexecPROGRAMS \
uninstall-pkgcfgDATA uninstall-pluginLTLIBRARIES
.MAKE: check-am install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
- clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
- clean-libLTLIBRARIES clean-libtool clean-pluginLTLIBRARIES \
+ clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \
+ clean-libexecPROGRAMS clean-libtool clean-pluginLTLIBRARIES \
ctags distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-binPROGRAMS \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-libLTLIBRARIES \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-libLTLIBRARIES install-libexecPROGRAMS \
install-man install-pdf install-pdf-am install-pkgcfgDATA \
install-pluginLTLIBRARIES install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
- uninstall-binPROGRAMS uninstall-libLTLIBRARIES \
+ uninstall-libLTLIBRARIES uninstall-libexecPROGRAMS \
uninstall-pkgcfgDATA uninstall-pluginLTLIBRARIES
diff --git a/src/datastore/datastore.conf.in b/src/datastore/datastore.conf.in
index 837c619..7a92070 100644
--- a/src/datastore/datastore.conf.in
+++ b/src/datastore/datastore.conf.in
@@ -1,16 +1,15 @@
[datastore]
AUTOSTART = YES
UNIXPATH = /tmp/gnunet-service-datastore.sock
-UNIX_MATCH_UID = YES
+UNIX_MATCH_UID = NO
UNIX_MATCH_GID = YES
@UNIXONLY@ PORT = 2093
HOSTNAME = localhost
HOME = $SERVICEHOME
-CONFIG = $DEFAULTCONFIG
BINARY = gnunet-service-datastore
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
-QUOTA = 100 MB
+QUOTA = 5 GB
BLOOMFILTER = $SERVICEHOME/datastore/bloomfilter
DATABASE = sqlite
# DISABLE_SOCKET_FORWARDING = NO
@@ -30,4 +29,5 @@ CONFIG = ~/.my.cnf
# PORT = 3306
-
+[datastore-heap]
+HASHMAPSIZE = 1024
diff --git a/src/datastore/datastore.h b/src/datastore/datastore.h
index 87ceb01..4f43185 100644
--- a/src/datastore/datastore.h
+++ b/src/datastore/datastore.h
@@ -111,7 +111,7 @@ struct GetMessage
/**
* Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET. Size
* can either be "sizeof(struct GetMessage)" or
- * "sizeof(struct GetMessage) - sizeof(GNUNET_HashCode)"!
+ * "sizeof(struct GetMessage) - sizeof(struct GNUNET_HashCode)"!
*/
struct GNUNET_MessageHeader header;
@@ -129,7 +129,7 @@ struct GetMessage
* Desired key (optional). Check the "size" of the
* header to see if the key is actually present.
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
};
@@ -252,7 +252,7 @@ struct DataMessage
/**
* Key under which the item can be found.
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
};
GNUNET_NETWORK_STRUCT_END
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c
index 57663e9..fab3bf0 100644
--- a/src/datastore/datastore_api.c
+++ b/src/datastore/datastore_api.c
@@ -34,6 +34,11 @@
#define LOG(kind,...) GNUNET_log_from (kind, "datastore-api",__VA_ARGS__)
/**
+ * Collect an instane number of statistics? May cause excessive IPC.
+ */
+#define INSANE_STATISTICS GNUNET_NO
+
+/**
* If a client stopped asking for more results, how many more do
* we receive from the DB before killing the connection? Trade-off
* between re-doing TCP handshakes and (needlessly) receiving
@@ -388,7 +393,7 @@ timeout_queue_entry (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
gettext_noop ("# queue entry timeouts"), 1,
GNUNET_NO);
qe->task = GNUNET_SCHEDULER_NO_TASK;
- GNUNET_assert (qe->was_transmitted == GNUNET_NO);
+ GNUNET_assert (GNUNET_NO == qe->was_transmitted);
LOG (GNUNET_ERROR_TYPE_DEBUG, "Timeout of request in datastore queue\n");
qe->response_proc (qe->h, NULL);
}
@@ -456,20 +461,21 @@ make_queue_entry (struct GNUNET_DATASTORE_Handle *h, size_t msize,
pos = h->queue_head;
}
c++;
+#if INSANE_STATISTICS
GNUNET_STATISTICS_update (h->stats, gettext_noop ("# queue entries created"),
1, GNUNET_NO);
+#endif
GNUNET_CONTAINER_DLL_insert_after (h->queue_head, h->queue_tail, pos, ret);
h->queue_size++;
ret->task = GNUNET_SCHEDULER_add_delayed (timeout, &timeout_queue_entry, ret);
- pos = ret->next;
- while (pos != NULL)
+ for (pos = ret->next; NULL != pos; pos = pos->next)
{
if ((pos->max_queue < h->queue_size) && (pos->was_transmitted == GNUNET_NO))
{
GNUNET_assert (pos->response_proc != NULL);
/* move 'pos' element to head so that it will be
* killed on 'NULL' call below */
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Dropping request from datastore queue\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Dropping request from datastore queue\n");
GNUNET_CONTAINER_DLL_remove (h->queue_head, h->queue_tail, pos);
GNUNET_CONTAINER_DLL_insert (h->queue_head, h->queue_tail, pos);
GNUNET_STATISTICS_update (h->stats,
@@ -480,7 +486,6 @@ make_queue_entry (struct GNUNET_DATASTORE_Handle *h, size_t msize,
pos->response_proc (h, NULL);
break;
}
- pos = pos->next;
}
return ret;
}
@@ -507,12 +512,7 @@ try_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_DATASTORE_Handle *h = cls;
- if (h->retry_time.rel_value < GNUNET_CONSTANTS_SERVICE_RETRY.rel_value)
- h->retry_time = GNUNET_CONSTANTS_SERVICE_RETRY;
- else
- h->retry_time = GNUNET_TIME_relative_multiply (h->retry_time, 2);
- if (h->retry_time.rel_value > GNUNET_CONSTANTS_SERVICE_TIMEOUT.rel_value)
- h->retry_time = GNUNET_CONSTANTS_SERVICE_TIMEOUT;
+ h->retry_time = GNUNET_TIME_STD_BACKOFF (h->retry_time);
h->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
h->client = GNUNET_CLIENT_connect ("datastore", h->cfg);
if (h->client == NULL)
@@ -544,10 +544,6 @@ do_disconnect (struct GNUNET_DATASTORE_Handle *h)
"client NULL in disconnect, will not try to reconnect\n");
return;
}
-#if 0
- GNUNET_STATISTICS_update (stats, gettext_noop ("# reconnected to DATASTORE"),
- 1, GNUNET_NO);
-#endif
GNUNET_CLIENT_disconnect (h->client);
h->skip_next_messages = 0;
h->client = NULL;
@@ -629,9 +625,11 @@ transmit_request (void *cls, size_t size, void *buf)
h->in_receive = GNUNET_YES;
GNUNET_CLIENT_receive (h->client, &receive_cb, h,
GNUNET_TIME_absolute_get_remaining (qe->timeout));
+#if INSANE_STATISTICS
GNUNET_STATISTICS_update (h->stats,
gettext_noop ("# bytes sent to datastore"), 1,
GNUNET_NO);
+#endif
return msize;
}
@@ -799,7 +797,7 @@ process_status_message (void *cls, const struct GNUNET_MessageHeader *msg)
GNUNET_STATISTICS_update (h->stats,
gettext_noop ("# status messages received"), 1,
GNUNET_NO);
- h->retry_time.rel_value = 0;
+ h->retry_time = GNUNET_TIME_UNIT_ZERO;
process_queue (h);
if (rc.cont != NULL)
rc.cont (rc.cont_cls, status,
@@ -836,7 +834,7 @@ process_status_message (void *cls, const struct GNUNET_MessageHeader *msg)
*/
struct GNUNET_DATASTORE_QueueEntry *
GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, uint32_t rid,
- const GNUNET_HashCode * key, size_t size,
+ 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,
@@ -1087,7 +1085,7 @@ GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, uint64_t uid,
*/
struct GNUNET_DATASTORE_QueueEntry *
GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h,
- const GNUNET_HashCode * key, size_t size,
+ const struct GNUNET_HashCode * key, size_t size,
const void *data, unsigned int queue_priority,
unsigned int max_queue_size,
struct GNUNET_TIME_Relative timeout,
@@ -1150,14 +1148,14 @@ process_result_message (void *cls, const struct GNUNET_MessageHeader *msg)
const struct DataMessage *dm;
int was_transmitted;
- if (msg == NULL)
+ if (NULL == msg)
{
qe = h->queue_head;
GNUNET_assert (NULL != qe);
rc = qe->qc.rc;
was_transmitted = qe->was_transmitted;
free_queue_entry (qe);
- if (was_transmitted == GNUNET_YES)
+ if (GNUNET_YES == was_transmitted)
{
LOG (GNUNET_ERROR_TYPE_WARNING,
_("Failed to receive response from database.\n"));
@@ -1167,7 +1165,7 @@ process_result_message (void *cls, const struct GNUNET_MessageHeader *msg)
{
process_queue (h);
}
- if (rc.proc != NULL)
+ if (NULL != rc.proc)
rc.proc (rc.proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS,
0);
return;
@@ -1181,7 +1179,7 @@ process_result_message (void *cls, const struct GNUNET_MessageHeader *msg)
free_queue_entry (qe);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Received end of result set, new queue size is %u\n", h->queue_size);
- h->retry_time.rel_value = 0;
+ h->retry_time = GNUNET_TIME_UNIT_ZERO;
h->result_count = 0;
process_queue (h);
if (rc.proc != NULL)
@@ -1218,15 +1216,17 @@ process_result_message (void *cls, const struct GNUNET_MessageHeader *msg)
0);
return;
}
+#if INSANE_STATISTICS
GNUNET_STATISTICS_update (h->stats, gettext_noop ("# Results received"), 1,
GNUNET_NO);
+#endif
dm = (const struct DataMessage *) msg;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Received result %llu with type %u and size %u with key %s\n",
(unsigned long long) GNUNET_ntohll (dm->uid), ntohl (dm->type),
ntohl (dm->size), GNUNET_h2s (&dm->key));
free_queue_entry (qe);
- h->retry_time.rel_value = 0;
+ h->retry_time = GNUNET_TIME_UNIT_ZERO;
process_queue (h);
if (rc.proc != NULL)
rc.proc (rc.proc_cls, &dm->key, ntohl (dm->size), &dm[1], ntohl (dm->type),
@@ -1381,7 +1381,7 @@ GNUNET_DATASTORE_get_zero_anonymity (struct GNUNET_DATASTORE_Handle *h,
*/
struct GNUNET_DATASTORE_QueueEntry *
GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, uint64_t offset,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
enum GNUNET_BLOCK_Type type,
unsigned int queue_priority,
unsigned int max_queue_size,
@@ -1406,8 +1406,10 @@ GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, uint64_t offset,
GNUNET_h2s (key));
return NULL;
}
+#if INSANE_STATISTICS
GNUNET_STATISTICS_update (h->stats, gettext_noop ("# GET requests executed"),
1, GNUNET_NO);
+#endif
gm = (struct GetMessage *) &qe[1];
gm->header.type = htons (GNUNET_MESSAGE_TYPE_DATASTORE_GET);
gm->type = htonl (type);
@@ -1420,7 +1422,7 @@ GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, uint64_t offset,
else
{
gm->header.size =
- htons (sizeof (struct GetMessage) - sizeof (GNUNET_HashCode));
+ htons (sizeof (struct GetMessage) - sizeof (struct GNUNET_HashCode));
}
process_queue (h);
return qe;
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c
index 49b9db8..93b43b1 100644
--- a/src/datastore/gnunet-service-datastore.c
+++ b/src/datastore/gnunet-service-datastore.c
@@ -316,7 +316,7 @@ delete_expired (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
* GNUNET_NO to delete the item and continue (if supported)
*/
static int
-expired_processor (void *cls, const GNUNET_HashCode * key, uint32_t size,
+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,
struct GNUNET_TIME_Absolute expiration, uint64_t uid)
@@ -394,7 +394,7 @@ delete_expired (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* GNUNET_NO to delete the item and continue (if supported)
*/
static int
-quota_processor (void *cls, const GNUNET_HashCode * key, uint32_t size,
+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,
struct GNUNET_TIME_Absolute expiration, uint64_t uid)
@@ -581,7 +581,7 @@ transmit_status (struct GNUNET_SERVER_Client *client, int code, const char *msg)
* GNUNET_NO to delete the item and continue (if supported)
*/
static int
-transmit_item (void *cls, const GNUNET_HashCode * key, uint32_t size,
+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, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
@@ -871,7 +871,7 @@ execute_put (struct GNUNET_SERVER_Client *client, const struct DataMessage *dm)
* GNUNET_NO to delete the item
*/
static int
-check_present (void *cls, const GNUNET_HashCode * key, uint32_t size,
+check_present (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
@@ -930,7 +930,7 @@ handle_put (void *cls, struct GNUNET_SERVER_Client *client,
int rid;
struct ReservationList *pos;
struct PutContext *pc;
- GNUNET_HashCode vhash;
+ struct GNUNET_HashCode vhash;
uint32_t size;
if ((dm == NULL) || (ntohl (dm->type) == 0))
@@ -993,7 +993,7 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client,
size = ntohs (message->size);
if ((size != sizeof (struct GetMessage)) &&
- (size != sizeof (struct GetMessage) - sizeof (GNUNET_HashCode)))
+ (size != sizeof (struct GetMessage) - sizeof (struct GNUNET_HashCode)))
{
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -1120,7 +1120,7 @@ handle_get_zero_anonymity (void *cls, struct GNUNET_SERVER_Client *client,
* in to be deleted (by returning GNUNET_NO).
*/
static int
-remove_callback (void *cls, const GNUNET_HashCode * key, uint32_t size,
+remove_callback (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration, uint64_t uid)
@@ -1160,7 +1160,7 @@ handle_remove (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
const struct DataMessage *dm = check_data (message);
- GNUNET_HashCode vhash;
+ struct GNUNET_HashCode vhash;
if (dm == NULL)
{
@@ -1428,7 +1428,7 @@ cleanup_reservations (void *cls, struct GNUNET_SERVER_Client *client)
*/
static void
add_key_to_bloomfilter (void *cls,
- const GNUNET_HashCode *key,
+ const struct GNUNET_HashCode *key,
unsigned int count)
{
struct GNUNET_CONTAINER_BloomFilter *bf = cls;
@@ -1549,7 +1549,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
pfn);
GNUNET_free (pfn);
pfn = NULL;
- filter = GNUNET_CONTAINER_bloomfilter_load (NULL, bf_size, 5); /* approx. 3% false positives at max use */
+ filter = GNUNET_CONTAINER_bloomfilter_init (NULL, bf_size, 5); /* approx. 3% false positives at max use */
}
}
}
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c
index cdbd6ae..cf21ebe 100644
--- a/src/datastore/perf_datastore_api.c
+++ b/src/datastore/perf_datastore_api.c
@@ -36,19 +36,14 @@
#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_datastore_service.h"
+#include "gnunet_testing_lib.h"
#include <gauger.h>
-#define VERBOSE GNUNET_NO
-
/**
* How long until we give up on transmitting the message?
*/
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15)
-static const char *plugin_name;
-
-static struct GNUNET_DATASTORE_Handle *datastore;
-
/**
* Target datastore size (in bytes).
*/
@@ -81,8 +76,13 @@ static unsigned long long stored_ops;
static struct GNUNET_TIME_Absolute start_time;
+static const char *plugin_name;
+
+static struct GNUNET_DATASTORE_Handle *datastore;
+
static int ok;
+
enum RunPhase
{
RP_DONE = 0,
@@ -103,13 +103,10 @@ struct CpsRunContext
};
-
static void
run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
-
-
static void
check_success (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
{
@@ -174,7 +171,7 @@ remove_next (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration,
static void
-delete_value (void *cls, const GNUNET_HashCode * key, size_t size,
+delete_value (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
@@ -199,7 +196,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct CpsRunContext *crc = cls;
size_t size;
- static GNUNET_HashCode key;
+ static struct GNUNET_HashCode key;
static char data[65536];
int i;
int k;
@@ -209,7 +206,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
switch (crc->phase)
{
case RP_PUT:
- memset (&key, 256 - crc->i, sizeof (GNUNET_HashCode));
+ memset (&key, 256 - crc->i, sizeof (struct GNUNET_HashCode));
i = crc->j;
k = crc->i;
/* most content is 32k */
@@ -217,7 +214,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
if (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 16) == 0) /* but some of it is less! */
size = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 32 * 1024);
crc->size = size = size - (size & 7); /* always multiple of 8 */
- GNUNET_CRYPTO_hash (&key, sizeof (GNUNET_HashCode), &key);
+ GNUNET_CRYPTO_hash (&key, sizeof (struct GNUNET_HashCode), &key);
memset (data, i, size);
if (i > 255)
memset (data, i - 255, size / 2);
@@ -297,11 +294,12 @@ run_tests (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, c
static void
-run (void *cls, char *const *args, const char *cfgfile,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
+run (void *cls,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ struct GNUNET_TESTING_Peer *peer)
{
struct CpsRunContext *crc;
- static GNUNET_HashCode zkey;
+ static struct GNUNET_HashCode zkey;
datastore = GNUNET_DATASTORE_connect (cfg);
start_time = GNUNET_TIME_absolute_get ();
@@ -322,85 +320,22 @@ run (void *cls, char *const *args, const char *cfgfile,
}
-static int
-check ()
+int
+main (int argc, char *argv[])
{
- struct GNUNET_OS_Process *proc;
char cfg_name[128];
- char *const argv[] = {
- "perf-datastore-api",
- "-c",
- cfg_name,
-#if VERBOSE
- "-L", "DEBUG",
-#endif
- NULL
- };
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
-
+ plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
GNUNET_snprintf (cfg_name, sizeof (cfg_name),
"test_datastore_api_data_%s.conf", plugin_name);
- proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
- "gnunet-service-arm",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
- "-c", cfg_name, NULL);
- GNUNET_assert (NULL != proc);
- GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
- "perf-datastore-api", "nohelp", options, &run, NULL);
- sleep (1); /* give datastore chance to process 'DROP' */
- if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
- {
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
- ok = 1;
- }
- GNUNET_OS_process_wait (proc);
- GNUNET_OS_process_destroy (proc);
- proc = NULL;
+ if (0 !=
+ GNUNET_TESTING_peer_run ("perf-gnunet-datastore",
+ cfg_name,
+ &run,
+ NULL))
+ return 1;
+ FPRINTF (stderr, "%s", "\n");
return ok;
}
-
-int
-main (int argc, char *argv[])
-{
- int ret;
- char *pos;
- char dir_name[128];
-
- sleep (1);
- /* determine name of plugin to use */
- plugin_name = argv[0];
- while (NULL != (pos = strstr (plugin_name, "_")))
- plugin_name = pos + 1;
- if (NULL != (pos = strstr (plugin_name, ".")))
- pos[0] = 0;
- else
- pos = (char *) plugin_name;
-
- GNUNET_snprintf (dir_name, sizeof (dir_name), "/tmp/test-gnunet-datastore-%s",
- plugin_name);
- GNUNET_DISK_directory_remove (dir_name);
- GNUNET_log_setup ("perf-datastore-api",
-#if VERBOSE
- "DEBUG",
-#else
- "WARNING",
-#endif
- NULL);
- ret = check ();
- if (pos != plugin_name)
- pos[0] = '.';
-#if REPORT_ID
- FPRINTF (stderr, "%s", "\n");
-#endif
- GNUNET_DISK_directory_remove (dir_name);
- return ret;
-}
-
/* end of perf_datastore_api.c */
diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c
index 1860374..56e2b87 100644
--- a/src/datastore/perf_plugin_datastore.c
+++ b/src/datastore/perf_plugin_datastore.c
@@ -27,10 +27,9 @@
#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_datastore_plugin.h"
+#include "gnunet_testing_lib.h"
#include <gauger.h>
-#define VERBOSE GNUNET_NO
-
/**
* Target datastore size (in bytes). Realistic sizes are
* more like 16 GB (not the default of 16 MB); however,
@@ -104,7 +103,7 @@ putValue (struct GNUNET_DATASTORE_PluginFunctions *api, int i, int k)
{
char value[65536];
size_t size;
- static GNUNET_HashCode key;
+ static struct GNUNET_HashCode key;
static int ic;
char *msg;
unsigned int prio;
@@ -117,7 +116,7 @@ putValue (struct GNUNET_DATASTORE_PluginFunctions *api, int i, int k)
/* generate random key */
key.bits[0] = (unsigned int) GNUNET_TIME_absolute_get ().abs_value;
- GNUNET_CRYPTO_hash (&key, sizeof (GNUNET_HashCode), &key);
+ GNUNET_CRYPTO_hash (&key, sizeof (struct GNUNET_HashCode), &key);
memset (value, i, size);
if (i > 255)
memset (value, i - 255, size / 2);
@@ -150,7 +149,7 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
static int
-iterate_zeros (void *cls, const GNUNET_HashCode * key, uint32_t size,
+iterate_zeros (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
@@ -164,10 +163,10 @@ iterate_zeros (void *cls, const GNUNET_HashCode * key, uint32_t size,
memcpy (&i, &cdata[4], sizeof (i));
hits[i / 8] |= (1 << (i % 8));
-#if VERBOSE
- FPRINTF (stderr, "Found result type=%u, priority=%u, size=%u, expire=%llu\n",
- type, priority, size, (unsigned long long) expiration.abs_value);
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Found result %d type=%u, priority=%u, size=%u, expire=%llu\n",
+ i,
+ type, priority, size, (unsigned long long) expiration.abs_value);
crc->cnt++;
if (crc->cnt == PUT_10 / 4 - 1)
{
@@ -198,7 +197,7 @@ iterate_zeros (void *cls, const GNUNET_HashCode * key, uint32_t size,
static int
-expiration_get (void *cls, const GNUNET_HashCode * key, uint32_t size,
+expiration_get (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration, uint64_t uid)
@@ -243,7 +242,7 @@ expiration_get (void *cls, const GNUNET_HashCode * key, uint32_t size,
static int
-replication_get (void *cls, const GNUNET_HashCode * key, uint32_t size,
+replication_get (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration, uint64_t uid)
@@ -343,9 +342,8 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
GNUNET_break (0);
crc->phase = RP_ERROR;
}
-#if VERBOSE
- FPRINTF (stderr, "In phase %d, iteration %u\n", crc->phase, crc->cnt);
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "In phase %d, iteration %u\n", crc->phase, crc->cnt);
switch (crc->phase)
{
case RP_ERROR:
@@ -438,6 +436,11 @@ run (void *cls, char *const *args, const char *cfgfile,
struct GNUNET_DATASTORE_PluginFunctions *api;
struct CpsRunContext *crc;
+ if (NULL == c)
+ {
+ GNUNET_break (0);
+ return;
+ }
api = load_plugin (c);
if (api == NULL)
{
@@ -454,68 +457,38 @@ run (void *cls, char *const *args, const char *cfgfile,
}
-static int
-check ()
+int
+main (int argc, char *argv[])
{
+ char dir_name[128];
char cfg_name[128];
-
- char *const argv[] = {
+ char *const xargv[] = {
"perf-plugin-datastore",
"-c",
cfg_name,
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
};
- GNUNET_snprintf (category, sizeof (category), "DATASTORE-%s", plugin_name);
- GNUNET_snprintf (cfg_name, sizeof (cfg_name),
- "perf_plugin_datastore_data_%s.conf", plugin_name);
- GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
- "perf-plugin-datastore", "nohelp", options, &run, NULL);
- if (ok != 0)
- FPRINTF (stderr, "Missed some testcases: %u\n", ok);
- return ok;
-}
-
-
-int
-main (int argc, char *argv[])
-{
- int ret;
- char *pos;
- char dir_name[128];
-
- sleep (1);
- /* determine name of plugin to use */
- plugin_name = argv[0];
- while (NULL != (pos = strstr (plugin_name, "_")))
- plugin_name = pos + 1;
- if (NULL != (pos = strstr (plugin_name, ".")))
- pos[0] = 0;
- else
- pos = (char *) plugin_name;
-
+ plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
GNUNET_snprintf (dir_name, sizeof (dir_name), "/tmp/perf-gnunet-datastore-%s",
plugin_name);
GNUNET_DISK_directory_remove (dir_name);
GNUNET_log_setup ("perf-plugin-datastore",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
- ret = check ();
- if (pos != plugin_name)
- pos[0] = '.';
+ GNUNET_snprintf (category, sizeof (category), "DATASTORE-%s", plugin_name);
+ GNUNET_snprintf (cfg_name, sizeof (cfg_name),
+ "perf_plugin_datastore_data_%s.conf", plugin_name);
+ GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
+ "perf-plugin-datastore", "nohelp", options, &run, NULL);
+ if (ok != 0)
+ FPRINTF (stderr, "Missed some testcases: %u\n", ok);
GNUNET_DISK_directory_remove (dir_name);
- return ret;
+ return ok;
}
/* end of perf_plugin_datastore.c */
diff --git a/src/datastore/perf_plugin_datastore_data_heap.conf b/src/datastore/perf_plugin_datastore_data_heap.conf
new file mode 100644
index 0000000..7ee215c
--- /dev/null
+++ b/src/datastore/perf_plugin_datastore_data_heap.conf
@@ -0,0 +1,7 @@
+@INLINE@ test_defaults.conf
+[PATHS]
+SERVICEHOME = /tmp/perf-gnunet-datastore-heap/
+
+
+[datastore]
+DATABASE = heap
diff --git a/src/datastore/perf_plugin_datastore_data_mysql.conf b/src/datastore/perf_plugin_datastore_data_mysql.conf
index dd26512..006b146 100644
--- a/src/datastore/perf_plugin_datastore_data_mysql.conf
+++ b/src/datastore/perf_plugin_datastore_data_mysql.conf
@@ -1,7 +1,6 @@
@INLINE@ test_defaults.conf
[PATHS]
SERVICEHOME = /tmp/perf-gnunet-datastore-mysql/
-DEFAULTCONFIG = perf_plugin_datastore_data_mysql.conf
[datastore]
DATABASE = mysql
diff --git a/src/datastore/perf_plugin_datastore_data_postgres.conf b/src/datastore/perf_plugin_datastore_data_postgres.conf
index 53ce6cf..052fa48 100644
--- a/src/datastore/perf_plugin_datastore_data_postgres.conf
+++ b/src/datastore/perf_plugin_datastore_data_postgres.conf
@@ -1,7 +1,6 @@
@INLINE@ test_defaults.conf
[PATHS]
SERVICEHOME = /tmp/perf-gnunet-datastore-postgres/
-DEFAULTCONFIG = perf_plugin_datastore_data_postgres.conf
[datastore]
DATABASE = postgres
diff --git a/src/datastore/perf_plugin_datastore_data_sqlite.conf b/src/datastore/perf_plugin_datastore_data_sqlite.conf
index 241d85e..5f97597 100644
--- a/src/datastore/perf_plugin_datastore_data_sqlite.conf
+++ b/src/datastore/perf_plugin_datastore_data_sqlite.conf
@@ -1,5 +1,4 @@
@INLINE@ test_defaults.conf
[PATHS]
SERVICEHOME = /tmp/perf-gnunet-datastore-sqlite/
-DEFAULTCONFIG = perf_plugin_datastore_data_sqlite.conf
diff --git a/src/datastore/plugin_datastore_heap.c b/src/datastore/plugin_datastore_heap.c
new file mode 100644
index 0000000..9f9360b
--- /dev/null
+++ b/src/datastore/plugin_datastore_heap.c
@@ -0,0 +1,868 @@
+/*
+ This file is part of GNUnet
+ (C) 2012 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file datastore/plugin_datastore_heap.c
+ * @brief heap-based datastore backend; usually we want the datastore
+ * to be persistent, and storing data in the heap is obviously
+ * NOT going to be persistent; still, this plugin is useful for
+ * testing/benchmarking --- but never for production!
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include "gnunet_datastore_plugin.h"
+
+
+/**
+ * A value that we are storing.
+ */
+struct Value
+{
+
+ /**
+ * Key for the value.
+ */
+ struct GNUNET_HashCode key;
+
+ /**
+ * Pointer to the value's data (allocated at the end of this struct).
+ */
+ const void *data;
+
+ /**
+ * Entry for this value in the 'expire' heap.
+ */
+ struct GNUNET_CONTAINER_HeapNode *expire_heap;
+
+ /**
+ * Entry for this value in the 'replication' heap.
+ */
+ struct GNUNET_CONTAINER_HeapNode *replication_heap;
+
+ /**
+ * Expiration time for this value.
+ */
+ struct GNUNET_TIME_Absolute expiration;
+
+ /**
+ * Offset of this value in the array of the 'struct ZeroAnonByType';
+ * only used if anonymity is zero.
+ */
+ unsigned int zero_anon_offset;
+
+ /**
+ * Number of bytes in 'data'.
+ */
+ uint32_t size;
+
+ /**
+ * Priority of the value.
+ */
+ uint32_t priority;
+
+ /**
+ * Anonymity level for the value.
+ */
+ uint32_t anonymity;
+
+ /**
+ * Replication level for the value.
+ */
+ uint32_t replication;
+
+ /**
+ * Type of 'data'.
+ */
+ enum GNUNET_BLOCK_Type type;
+
+};
+
+
+/**
+ * We organize 0-anonymity values in arrays "by type".
+ */
+struct ZeroAnonByType
+{
+
+ /**
+ * We keep these in a DLL.
+ */
+ struct ZeroAnonByType *next;
+
+ /**
+ * We keep these in a DLL.
+ */
+ struct ZeroAnonByType *prev;
+
+ /**
+ * Array of 0-anonymity items of the given type.
+ */
+ struct Value **array;
+
+ /**
+ * Allocated size of the array.
+ */
+ unsigned int array_size;
+
+ /**
+ * First unused offset in 'array'.
+ */
+ unsigned int array_pos;
+
+ /**
+ * Type of all of the values in 'array'.
+ */
+ enum GNUNET_BLOCK_Type type;
+};
+
+
+/**
+ * Context for all functions in this plugin.
+ */
+struct Plugin
+{
+ /**
+ * Our execution environment.
+ */
+ struct GNUNET_DATASTORE_PluginEnvironment *env;
+
+ /**
+ * Mapping from keys to 'struct Value's.
+ */
+ struct GNUNET_CONTAINER_MultiHashMap *keyvalue;
+
+ /**
+ * Heap organized by minimum expiration time.
+ */
+ struct GNUNET_CONTAINER_Heap *by_expiration;
+
+ /**
+ * Heap organized by maximum replication value.
+ */
+ struct GNUNET_CONTAINER_Heap *by_replication;
+
+ /**
+ * Head of list of arrays containing zero-anonymity values by type.
+ */
+ struct ZeroAnonByType *zero_head;
+
+ /**
+ * Tail of list of arrays containing zero-anonymity values by type.
+ */
+ struct ZeroAnonByType *zero_tail;
+
+ /**
+ * Size of all values we're storing.
+ */
+ unsigned long long size;
+
+};
+
+
+/**
+ * Get an estimate of how much space the database is
+ * currently using.
+ *
+ * @param cls our "struct Plugin*"
+ * @return number of bytes used on disk
+ */
+static unsigned long long
+heap_plugin_estimate_size (void *cls)
+{
+ struct Plugin *plugin = cls;
+
+ return plugin->size;
+}
+
+
+/**
+ * Store an item in the datastore.
+ *
+ * @param cls closure
+ * @param key key for the item
+ * @param size number of bytes in data
+ * @param data content stored
+ * @param type type of the content
+ * @param priority priority of the content
+ * @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
+ * @param expiration expiration time for the content
+ * @param msg set to error message
+ * @return GNUNET_OK on success
+ */
+static int
+heap_plugin_put (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, char **msg)
+{
+ struct Plugin *plugin = cls;
+ struct Value *value;
+
+ value = GNUNET_malloc (sizeof (struct Value) + size);
+ value->key = *key;
+ value->data = &value[1];
+ value->expire_heap = GNUNET_CONTAINER_heap_insert (plugin->by_expiration,
+ value,
+ expiration.abs_value);
+ value->replication_heap = GNUNET_CONTAINER_heap_insert (plugin->by_replication,
+ value,
+ replication);
+ value->expiration = expiration;
+ if (0 == anonymity)
+ {
+ struct ZeroAnonByType *zabt;
+
+ for (zabt = plugin->zero_head; NULL != zabt; zabt = zabt->next)
+ if (zabt->type == type)
+ break;
+ if (NULL == zabt)
+ {
+ zabt = GNUNET_malloc (sizeof (struct ZeroAnonByType));
+ zabt->type = type;
+ GNUNET_CONTAINER_DLL_insert (plugin->zero_head,
+ plugin->zero_tail,
+ zabt);
+ }
+ if (zabt->array_size == zabt->array_pos)
+ {
+ GNUNET_array_grow (zabt->array,
+ zabt->array_size,
+ zabt->array_size * 2 + 4);
+ }
+ value->zero_anon_offset = zabt->array_pos;
+ zabt->array[zabt->array_pos++] = value;
+ }
+ value->size = size;
+ value->priority = priority;
+ value->anonymity = anonymity;
+ value->replication = replication;
+ value->type = type;
+ memcpy (&value[1], data, size);
+ GNUNET_CONTAINER_multihashmap_put (plugin->keyvalue,
+ &value->key,
+ value,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
+ plugin->size += size;
+ return GNUNET_OK;
+}
+
+
+/**
+ * Delete the given value, removing it from the plugin's data
+ * structures.
+ *
+ * @param plugin the plugin
+ * @param value value to delete
+ */
+static void
+delete_value (struct Plugin *plugin,
+ struct Value *value)
+{
+ GNUNET_assert (GNUNET_YES ==
+ GNUNET_CONTAINER_multihashmap_remove (plugin->keyvalue,
+ &value->key,
+ value));
+ GNUNET_assert (value == GNUNET_CONTAINER_heap_remove_node (value->expire_heap));
+ GNUNET_assert (value == GNUNET_CONTAINER_heap_remove_node (value->replication_heap));
+ if (0 == value->anonymity)
+ {
+ struct ZeroAnonByType *zabt;
+
+ for (zabt = plugin->zero_head; NULL != zabt; zabt = zabt->next)
+ if (zabt->type == value->type)
+ break;
+ GNUNET_assert (NULL != zabt);
+ zabt->array[value->zero_anon_offset] = zabt->array[--zabt->array_pos];
+ zabt->array[value->zero_anon_offset]->zero_anon_offset = value->zero_anon_offset;
+ if (0 == zabt->array_pos)
+ {
+ GNUNET_array_grow (zabt->array,
+ zabt->array_size,
+ 0);
+ GNUNET_CONTAINER_DLL_remove (plugin->zero_head,
+ plugin->zero_tail,
+ zabt);
+ GNUNET_free (zabt);
+ }
+ }
+ plugin->size -= value->size;
+ GNUNET_free (value);
+}
+
+
+/**
+ * Closure for iterator called during 'get_key'.
+ */
+struct GetContext
+{
+
+ /**
+ * Desired result offset / number of results.
+ */
+ uint64_t offset;
+
+ /**
+ * The plugin.
+ */
+ struct Plugin *plugin;
+
+ /**
+ * Requested value hash.
+ */
+ const struct GNUNET_HashCode * vhash;
+
+ /**
+ * Requested type.
+ */
+ enum GNUNET_BLOCK_Type type;
+
+ /**
+ * Function to call with the result.
+ */
+ PluginDatumProcessor proc;
+
+ /**
+ * Closure for 'proc'.
+ */
+ void *proc_cls;
+};
+
+
+/**
+ * Test if a value matches the specification from the 'get' context
+ *
+ * @param gc query
+ * @param value the value to check against the query
+ * @return GNUNET_YES if the value matches
+ */
+static int
+match (const struct GetContext *gc,
+ struct Value *value)
+{
+ struct GNUNET_HashCode vh;
+
+ if ( (gc->type != GNUNET_BLOCK_TYPE_ANY) &&
+ (gc->type != value->type) )
+ return GNUNET_NO;
+ if (NULL != gc->vhash)
+ {
+ GNUNET_CRYPTO_hash (&value[1], value->size, &vh);
+ if (0 != memcmp (&vh, gc->vhash, sizeof (struct GNUNET_HashCode)))
+ return GNUNET_NO;
+ }
+ return GNUNET_YES;
+}
+
+
+/**
+ * Count number of matching values.
+ *
+ * @param cls the 'struct GetContext'
+ * @param key unused
+ * @param val the 'struct Value'
+ * @return GNUNET_YES (continue iteration)
+ */
+static int
+count_iterator (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *val)
+{
+ struct GetContext *gc = cls;
+ struct Value *value = val;
+
+ if (GNUNET_NO == match (gc, value))
+ return GNUNET_OK;
+ gc->offset++;
+ return GNUNET_OK;
+}
+
+
+/**
+ * Obtain matching value at 'offset'.
+ *
+ * @param cls the 'struct GetContext'
+ * @param key unused
+ * @param val the 'struct Value'
+ * @return GNUNET_YES (continue iteration), GNUNET_NO if result was found
+ */
+static int
+get_iterator (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *val)
+{
+ struct GetContext *gc = cls;
+ struct Value *value = val;
+
+ if (GNUNET_NO == match (gc, value))
+ return GNUNET_OK;
+ if (0 != gc->offset--)
+ return GNUNET_OK;
+ if (GNUNET_NO ==
+ gc->proc (gc->proc_cls,
+ key,
+ value->size,
+ &value[1],
+ value->type,
+ value->priority,
+ value->anonymity,
+ value->expiration,
+ (uint64_t) (long) value))
+ delete_value (gc->plugin, value);
+ return GNUNET_NO;
+}
+
+
+/**
+ * Get one of the results for a particular key in the datastore.
+ *
+ * @param cls closure
+ * @param offset offset of the result (modulo num-results);
+ * specific ordering does not matter for the offset
+ * @param key maybe NULL (to match all entries)
+ * @param vhash hash of the value, maybe NULL (to
+ * match all values that have the right key).
+ * Note that for DBlocks there is no difference
+ * betwen key and vhash, but for other blocks
+ * there may be!
+ * @param type entries of which type are relevant?
+ * Use 0 for any type.
+ * @param proc function to call on each matching value;
+ * will be called with NULL if nothing matches
+ * @param proc_cls closure for proc
+ */
+static void
+heap_plugin_get_key (void *cls, uint64_t offset,
+ const struct GNUNET_HashCode *key,
+ const struct GNUNET_HashCode *vhash,
+ enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc,
+ void *proc_cls)
+{
+ struct Plugin *plugin = cls;
+ struct GetContext gc;
+
+ gc.plugin = plugin;
+ gc.offset = 0;
+ gc.vhash = vhash;
+ gc.type = type;
+ gc.proc = proc;
+ gc.proc_cls = proc_cls;
+ if (NULL == key)
+ {
+ GNUNET_CONTAINER_multihashmap_iterate (plugin->keyvalue,
+ &count_iterator,
+ &gc);
+ if (0 == gc.offset)
+ {
+ proc (proc_cls,
+ NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ return;
+ }
+ gc.offset = offset % gc.offset;
+ GNUNET_CONTAINER_multihashmap_iterate (plugin->keyvalue,
+ &get_iterator,
+ &gc);
+ }
+ else
+ {
+ GNUNET_CONTAINER_multihashmap_get_multiple (plugin->keyvalue,
+ key,
+ &count_iterator,
+ &gc);
+ if (0 == gc.offset)
+ {
+ proc (proc_cls,
+ NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ return;
+ }
+ gc.offset = offset % gc.offset;
+ GNUNET_CONTAINER_multihashmap_get_multiple (plugin->keyvalue,
+ key,
+ &get_iterator,
+ &gc);
+ }
+}
+
+
+/**
+ * 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.
+ *
+ * @param cls closure
+ * @param proc function to call the value (once only).
+ * @param proc_cls closure for proc
+ */
+static void
+heap_plugin_get_replication (void *cls,
+ PluginDatumProcessor proc,
+ void *proc_cls)
+{
+ struct Plugin *plugin = cls;
+ struct Value *value;
+
+ value = GNUNET_CONTAINER_heap_remove_root (plugin->by_replication);
+ if (NULL == value)
+ {
+ proc (proc_cls,
+ NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ return;
+ }
+ if (value->replication > 0)
+ {
+ value->replication--;
+ value->replication_heap = GNUNET_CONTAINER_heap_insert (plugin->by_replication,
+ value,
+ value->replication);
+ }
+ else
+ {
+ /* need a better way to pick a random item, replication level is always 0 */
+ value->replication_heap = GNUNET_CONTAINER_heap_insert (plugin->by_replication,
+ value,
+ value->replication);
+ value = GNUNET_CONTAINER_heap_walk_get_next (plugin->by_replication);
+ }
+ if (GNUNET_NO ==
+ proc (proc_cls,
+ &value->key,
+ value->size,
+ &value[1],
+ value->type,
+ value->priority,
+ value->anonymity,
+ value->expiration,
+ (uint64_t) (long) value))
+ delete_value (plugin, value);
+}
+
+
+/**
+ * Get a random item for expiration. Call 'proc' with all values ZERO
+ * or NULL if the datastore is empty.
+ *
+ * @param cls closure
+ * @param proc function to call the value (once only).
+ * @param proc_cls closure for proc
+ */
+static void
+heap_plugin_get_expiration (void *cls, PluginDatumProcessor proc,
+ void *proc_cls)
+{
+ struct Plugin *plugin = cls;
+ struct Value *value;
+
+ value = GNUNET_CONTAINER_heap_peek (plugin->by_expiration);
+ if (NULL == value)
+ {
+ proc (proc_cls,
+ NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ return;
+ }
+ if (GNUNET_NO ==
+ proc (proc_cls,
+ &value->key,
+ value->size,
+ &value[1],
+ value->type,
+ value->priority,
+ value->anonymity,
+ value->expiration,
+ (uint64_t) (long) value))
+ delete_value (plugin, value);
+}
+
+
+/**
+ * Update the priority for a particular key in the datastore. If
+ * the expiration time in value is different than the time found in
+ * the datastore, the higher value should be kept. For the
+ * anonymity level, the lower value is to be used. The specified
+ * priority should be added to the existing priority, ignoring the
+ * priority in value.
+ *
+ * @param cls our "struct Plugin*"
+ * @param uid unique identifier of the datum
+ * @param delta by how much should the priority
+ * change? If priority + delta < 0 the
+ * priority should be set to 0 (never go
+ * negative).
+ * @param expire new expiration time should be the
+ * MAX of any existing expiration time and
+ * this value
+ * @param msg set to error message
+ * @return GNUNET_OK on success
+ */
+static int
+heap_plugin_update (void *cls,
+ uint64_t uid,
+ int delta,
+ struct GNUNET_TIME_Absolute expire, char **msg)
+{
+ struct Plugin *plugin = cls;
+ struct Value *value;
+
+ value = (struct Value*) (long) uid;
+ GNUNET_assert (NULL != value);
+ if (value->expiration.abs_value != expire.abs_value)
+ {
+ value->expiration = expire;
+ GNUNET_CONTAINER_heap_update_cost (plugin->by_expiration,
+ value->expire_heap,
+ expire.abs_value);
+ }
+ if ( (delta < 0) && (value->priority < - delta) )
+ value->priority = 0;
+ else
+ value->priority += delta;
+ return GNUNET_OK;
+}
+
+
+/**
+ * Call the given processor on an item with zero anonymity.
+ *
+ * @param cls our "struct Plugin*"
+ * @param offset offset of the result (modulo num-results);
+ * specific ordering does not matter for the offset
+ * @param type entries of which type should be considered?
+ * Use 0 for any type.
+ * @param proc function to call on each matching value;
+ * will be called with NULL if no value matches
+ * @param proc_cls closure for proc
+ */
+static void
+heap_plugin_get_zero_anonymity (void *cls, uint64_t offset,
+ enum GNUNET_BLOCK_Type type,
+ PluginDatumProcessor proc, void *proc_cls)
+{
+ struct Plugin *plugin = cls;
+ struct ZeroAnonByType *zabt;
+ struct Value *value;
+ uint64_t count;
+
+ count = 0;
+ for (zabt = plugin->zero_head; NULL != zabt; zabt = zabt->next)
+ {
+ if ( (type != GNUNET_BLOCK_TYPE_ANY) &&
+ (type != zabt->type) )
+ continue;
+ count += zabt->array_pos;
+ }
+ if (0 == count)
+ {
+ proc (proc_cls,
+ NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ return;
+ }
+ offset = offset % count;
+ for (zabt = plugin->zero_head; NULL != zabt; zabt = zabt->next)
+ {
+ if ( (type != GNUNET_BLOCK_TYPE_ANY) &&
+ (type != zabt->type) )
+ continue;
+ if (offset >= zabt->array_pos)
+ {
+ offset -= zabt->array_pos;
+ continue;
+ }
+ break;
+ }
+ GNUNET_assert (NULL != zabt);
+ value = zabt->array[offset];
+ if (GNUNET_NO ==
+ proc (proc_cls,
+ &value->key,
+ value->size,
+ &value[1],
+ value->type,
+ value->priority,
+ value->anonymity,
+ value->expiration,
+ (uint64_t) (long) value))
+ delete_value (plugin, value);
+}
+
+
+/**
+ * Drop database.
+ */
+static void
+heap_plugin_drop (void *cls)
+{
+ /* nothing needs to be done */
+}
+
+
+/**
+ * Closure for the 'return_value' function.
+ */
+struct GetAllContext
+{
+ /**
+ * Function to call.
+ */
+ PluginKeyProcessor proc;
+
+ /**
+ * Closure for 'proc'.
+ */
+ void *proc_cls;
+};
+
+
+/**
+ * Callback invoked to call callback on each value.
+ *
+ * @param cls the plugin
+ * @param key unused
+ * @param val the value
+ * @return GNUNET_OK (continue to iterate)
+ */
+static int
+return_value (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *val)
+{
+ struct GetAllContext *gac = cls;
+
+ gac->proc (gac->proc_cls,
+ key,
+ 1);
+ return GNUNET_OK;
+}
+
+
+/**
+ * Get all of the keys in the datastore.
+ *
+ * @param cls closure
+ * @param proc function to call on each key
+ * @param proc_cls closure for proc
+ */
+static void
+heap_get_keys (void *cls,
+ PluginKeyProcessor proc,
+ void *proc_cls)
+{
+ struct Plugin *plugin = cls;
+ struct GetAllContext gac;
+
+ gac.proc = proc;
+ gac.proc_cls = proc_cls;
+ GNUNET_CONTAINER_multihashmap_iterate (plugin->keyvalue,
+ &return_value,
+ &gac);
+}
+
+
+/**
+ * Entry point for the plugin.
+ *
+ * @param cls the "struct GNUNET_DATASTORE_PluginEnvironment*"
+ * @return our "struct Plugin*"
+ */
+void *
+libgnunet_plugin_datastore_heap_init (void *cls)
+{
+ struct GNUNET_DATASTORE_PluginEnvironment *env = cls;
+ struct GNUNET_DATASTORE_PluginFunctions *api;
+ struct Plugin *plugin;
+ unsigned long long esize;
+
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (env->cfg,
+ "datastore-heap",
+ "HASHMAPSIZE",
+ &esize))
+ esize = 128 * 1024;
+ plugin = GNUNET_malloc (sizeof (struct Plugin));
+ plugin->env = env;
+ plugin->keyvalue = GNUNET_CONTAINER_multihashmap_create (esize, GNUNET_YES);
+ plugin->by_expiration = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
+ plugin->by_replication = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MAX);
+ api = GNUNET_malloc (sizeof (struct GNUNET_DATASTORE_PluginFunctions));
+ api->cls = plugin;
+ api->estimate_size = &heap_plugin_estimate_size;
+ api->put = &heap_plugin_put;
+ api->update = &heap_plugin_update;
+ api->get_key = &heap_plugin_get_key;
+ api->get_replication = &heap_plugin_get_replication;
+ api->get_expiration = &heap_plugin_get_expiration;
+ api->get_zero_anonymity = &heap_plugin_get_zero_anonymity;
+ api->drop = &heap_plugin_drop;
+ api->get_keys = &heap_get_keys;
+ GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, "heap",
+ _("Heap database running\n"));
+ return api;
+}
+
+
+/**
+ * Callback invoked to free all value.
+ *
+ * @param cls the plugin
+ * @param key unused
+ * @param val the value
+ * @return GNUNET_OK (continue to iterate)
+ */
+static int
+free_value (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *val)
+{
+ struct Plugin *plugin = cls;
+ struct Value *value = val;
+
+ delete_value (plugin, value);
+ return GNUNET_OK;
+}
+
+
+/**
+ * Exit point from the plugin.
+ * @param cls our "struct Plugin*"
+ * @return always NULL
+ */
+void *
+libgnunet_plugin_datastore_heap_done (void *cls)
+{
+ struct GNUNET_DATASTORE_PluginFunctions *api = cls;
+ struct Plugin *plugin = api->cls;
+
+ GNUNET_CONTAINER_multihashmap_iterate (plugin->keyvalue,
+ &free_value,
+ plugin);
+ GNUNET_CONTAINER_multihashmap_destroy (plugin->keyvalue);
+ GNUNET_CONTAINER_heap_destroy (plugin->by_expiration);
+ GNUNET_CONTAINER_heap_destroy (plugin->by_replication);
+ GNUNET_free (plugin);
+ GNUNET_free (api);
+ return NULL;
+}
+
+/* end of plugin_datastore_heap.c */
diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c
index ed7741c..ad70e73 100644
--- a/src/datastore/plugin_datastore_mysql.c
+++ b/src/datastore/plugin_datastore_mysql.c
@@ -176,7 +176,7 @@ struct Plugin
#define UPDATE_ENTRY "UPDATE gn090 SET prio=prio+?,expire=IF(expire>=?,expire,?) WHERE uid=?"
struct GNUNET_MYSQL_StatementHandle *update_entry;
-#define DEC_REPL "UPDATE gn090 SET repl=GREATEST (0, repl - 1) WHERE uid=?"
+#define DEC_REPL "UPDATE gn090 SET repl=GREATEST (1, repl) - 1 WHERE uid=?"
struct GNUNET_MYSQL_StatementHandle *dec_repl;
#define SELECT_SIZE "SELECT SUM(BIT_LENGTH(value) DIV 8) FROM gn090"
@@ -281,7 +281,7 @@ mysql_plugin_estimate_size (void *cls)
* @return GNUNET_OK on success
*/
static int
-mysql_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size,
+mysql_plugin_put (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, char **msg)
@@ -297,15 +297,15 @@ mysql_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size,
unsigned long hashSize;
unsigned long hashSize2;
unsigned long lsize;
- GNUNET_HashCode vhash;
+ struct GNUNET_HashCode vhash;
if (size > MAX_DATUM_SIZE)
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
- hashSize = sizeof (GNUNET_HashCode);
- hashSize2 = sizeof (GNUNET_HashCode);
+ hashSize = sizeof (struct GNUNET_HashCode);
+ hashSize2 = sizeof (struct GNUNET_HashCode);
lsize = size;
GNUNET_CRYPTO_hash (data, size, &vhash);
if (GNUNET_OK !=
@@ -403,11 +403,11 @@ execute_select (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt
unsigned long size;
unsigned long long uid;
char value[GNUNET_DATASTORE_MAX_VALUE_SIZE];
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
struct GNUNET_TIME_Absolute expiration;
MYSQL_BIND rbind[7];
- hashSize = sizeof (GNUNET_HashCode);
+ hashSize = sizeof (struct GNUNET_HashCode);
memset (rbind, 0, sizeof (rbind));
rbind[0].buffer_type = MYSQL_TYPE_LONG;
rbind[0].buffer = &type;
@@ -442,8 +442,8 @@ execute_select (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt
return;
}
GNUNET_assert (size <= sizeof (value));
- if ((rbind[4].buffer_length != sizeof (GNUNET_HashCode)) ||
- (hashSize != sizeof (GNUNET_HashCode)))
+ if ((rbind[4].buffer_length != sizeof (struct GNUNET_HashCode)) ||
+ (hashSize != sizeof (struct GNUNET_HashCode)))
{
GNUNET_break (0);
proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
@@ -486,8 +486,8 @@ execute_select (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt
* @param proc_cls closure for proc
*/
static void
-mysql_plugin_get_key (void *cls, uint64_t offset, const GNUNET_HashCode * key,
- const GNUNET_HashCode * vhash,
+mysql_plugin_get_key (void *cls, uint64_t offset, const struct GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * vhash,
enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc,
void *proc_cls)
{
@@ -501,8 +501,8 @@ mysql_plugin_get_key (void *cls, uint64_t offset, const GNUNET_HashCode * key,
GNUNET_assert (key != NULL);
GNUNET_assert (NULL != proc);
- hashSize = sizeof (GNUNET_HashCode);
- hashSize2 = sizeof (GNUNET_HashCode);
+ hashSize = sizeof (struct GNUNET_HashCode);
+ hashSize2 = sizeof (struct GNUNET_HashCode);
memset (cbind, 0, sizeof (cbind));
total = -1;
cbind[0].buffer_type = MYSQL_TYPE_LONGLONG;
@@ -669,7 +669,7 @@ struct ReplCtx
* GNUNET_NO to delete the item and continue (if supported)
*/
static int
-repl_proc (void *cls, const GNUNET_HashCode * key, uint32_t size,
+repl_proc (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
@@ -763,7 +763,7 @@ mysql_plugin_get_keys (void *cls,
const char *query = "SELECT hash FROM gn090";
int ret;
MYSQL_STMT *statement;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
MYSQL_BIND cbind[1];
unsigned long length;
@@ -808,7 +808,7 @@ mysql_plugin_get_keys (void *cls,
}
while (0 == (ret = mysql_stmt_fetch (statement)))
{
- if (sizeof (GNUNET_HashCode) == length)
+ if (sizeof (struct GNUNET_HashCode) == length)
proc (proc_cls, &key, 1);
}
if (ret != MYSQL_NO_DATA)
@@ -869,7 +869,7 @@ struct ExpiCtx
* GNUNET_NO to delete the item and continue (if supported)
*/
static int
-expi_proc (void *cls, const GNUNET_HashCode * key, uint32_t size,
+expi_proc (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c
index 6dec314..83fc423 100644
--- a/src/datastore/plugin_datastore_postgres.c
+++ b/src/datastore/plugin_datastore_postgres.c
@@ -270,14 +270,14 @@ postgres_plugin_estimate_size (void *cls)
* @return GNUNET_OK on success
*/
static int
-postgres_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size,
+postgres_plugin_put (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, char **msg)
{
struct Plugin *plugin = cls;
- GNUNET_HashCode vhash;
+ struct GNUNET_HashCode vhash;
PGresult *ret;
uint32_t btype = htonl (type);
uint32_t bprio = htonl (priority);
@@ -301,8 +301,8 @@ postgres_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size,
sizeof (bprio),
sizeof (banon),
sizeof (bexpi),
- sizeof (GNUNET_HashCode),
- sizeof (GNUNET_HashCode),
+ sizeof (struct GNUNET_HashCode),
+ sizeof (struct GNUNET_HashCode),
size
};
const int paramFormats[] = { 1, 1, 1, 1, 1, 1, 1, 1 };
@@ -345,7 +345,7 @@ process_result (struct Plugin *plugin, PluginDatumProcessor proc,
uint32_t size;
unsigned int rowid;
struct GNUNET_TIME_Absolute expiration_time;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
if (GNUNET_OK !=
GNUNET_POSTGRES_check_result_ (plugin->dbh, res, PGRES_TUPLES_OK, "PQexecPrepared", "select",
@@ -380,7 +380,7 @@ process_result (struct Plugin *plugin, PluginDatumProcessor proc,
(sizeof (uint32_t) != PQfsize (res, 1)) ||
(sizeof (uint32_t) != PQfsize (res, 2)) ||
(sizeof (uint64_t) != PQfsize (res, 3)) ||
- (sizeof (GNUNET_HashCode) != PQgetlength (res, 0, 4)))
+ (sizeof (struct GNUNET_HashCode) != PQgetlength (res, 0, 4)))
{
GNUNET_break (0);
PQclear (res);
@@ -394,7 +394,7 @@ process_result (struct Plugin *plugin, PluginDatumProcessor proc,
anonymity = ntohl (*(uint32_t *) PQgetvalue (res, 0, 2));
expiration_time.abs_value =
GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, 0, 3));
- memcpy (&key, PQgetvalue (res, 0, 4), sizeof (GNUNET_HashCode));
+ memcpy (&key, PQgetvalue (res, 0, 4), sizeof (struct GNUNET_HashCode));
size = PQgetlength (res, 0, 5);
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datastore-postgres",
"Found result of size %u bytes and type %u in database\n",
@@ -443,8 +443,8 @@ process_result (struct Plugin *plugin, PluginDatumProcessor proc,
*/
static void
postgres_plugin_get_key (void *cls, uint64_t offset,
- const GNUNET_HashCode * key,
- const GNUNET_HashCode * vhash,
+ const struct GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * vhash,
enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc,
void *proc_cls)
{
@@ -461,14 +461,14 @@ postgres_plugin_get_key (void *cls, uint64_t offset,
GNUNET_assert (key != NULL);
paramValues[0] = (const char *) key;
- paramLengths[0] = sizeof (GNUNET_HashCode);
+ paramLengths[0] = sizeof (struct GNUNET_HashCode);
btype = htonl (type);
if (type != 0)
{
if (vhash != NULL)
{
paramValues[1] = (const char *) vhash;
- paramLengths[1] = sizeof (GNUNET_HashCode);
+ paramLengths[1] = sizeof (struct GNUNET_HashCode);
paramValues[2] = (const char *) &btype;
paramLengths[2] = sizeof (btype);
paramValues[3] = (const char *) &blimit_off;
@@ -499,7 +499,7 @@ postgres_plugin_get_key (void *cls, uint64_t offset,
if (vhash != NULL)
{
paramValues[1] = (const char *) vhash;
- paramLengths[1] = sizeof (GNUNET_HashCode);
+ paramLengths[1] = sizeof (struct GNUNET_HashCode);
paramValues[2] = (const char *) &blimit_off;
paramLengths[2] = sizeof (blimit_off);
nparams = 3;
@@ -628,7 +628,7 @@ struct ReplCtx
* GNUNET_NO to delete the item and continue (if supported)
*/
static int
-repl_proc (void *cls, const GNUNET_HashCode * key, uint32_t size,
+repl_proc (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
@@ -792,16 +792,16 @@ postgres_plugin_get_keys (void *cls,
struct Plugin *plugin = cls;
int ret;
int i;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
PGresult * res;
res = PQexecPrepared (plugin->dbh, "get_keys", 0, NULL, NULL, NULL, 1);
ret = PQntuples (res);
for (i=0;i<ret;i++)
{
- if (sizeof (GNUNET_HashCode) != PQgetlength (res, i, 0))
+ if (sizeof (struct GNUNET_HashCode) != PQgetlength (res, i, 0))
{
- memcpy (&key, PQgetvalue (res, i, 0), sizeof (GNUNET_HashCode));
+ memcpy (&key, PQgetvalue (res, i, 0), sizeof (struct GNUNET_HashCode));
proc (proc_cls, &key, 1);
}
}
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c
index 00195fb..e77e8b9 100644
--- a/src/datastore/plugin_datastore_sqlite.c
+++ b/src/datastore/plugin_datastore_sqlite.c
@@ -228,10 +228,8 @@ database_setup (const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_CONFIGURATION_get_value_filename (cfg, "datastore-sqlite",
"FILENAME", &afsdir))
{
- GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "sqlite",
- _
- ("Option `%s' in section `%s' missing in configuration!\n"),
- "FILENAME", "datastore-sqlite");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "datastore-sqlite", "FILENAME");
return GNUNET_SYSERR;
}
if (GNUNET_OK != GNUNET_DISK_file_test (afsdir))
@@ -245,13 +243,8 @@ database_setup (const struct GNUNET_CONFIGURATION_Handle *cfg,
/* database is new or got deleted, reset payload to zero! */
plugin->env->duc (plugin->env->cls, 0);
}
-#ifdef ENABLE_NLS
- plugin->fn =
- GNUNET_STRINGS_to_utf8 (afsdir, strlen (afsdir), nl_langinfo (CODESET));
-#else
- plugin->fn = GNUNET_STRINGS_to_utf8 (afsdir, strlen (afsdir), "UTF-8"); /* good luck */
-#endif
- GNUNET_free (afsdir);
+ /* afsdir should be UTF-8-encoded. If it isn't, it's a bug */
+ plugin->fn = afsdir;
/* Open database and precompile statements */
if (sqlite3_open (plugin->fn, &plugin->dbh) != SQLITE_OK)
@@ -480,7 +473,7 @@ delete_by_rowid (struct Plugin *plugin, unsigned long long rid)
* @return GNUNET_OK on success
*/
static int
-sqlite_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size,
+sqlite_plugin_put (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, char **msg)
@@ -489,7 +482,7 @@ sqlite_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size,
int n;
int ret;
sqlite3_stmt *stmt;
- GNUNET_HashCode vhash;
+ struct GNUNET_HashCode vhash;
uint64_t rvalue;
if (size > MAX_ITEM_SIZE)
@@ -510,10 +503,10 @@ sqlite_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size,
(SQLITE_OK != sqlite3_bind_int64 (stmt, 5, expiration.abs_value)) ||
(SQLITE_OK != sqlite3_bind_int64 (stmt, 6, rvalue)) ||
(SQLITE_OK !=
- sqlite3_bind_blob (stmt, 7, key, sizeof (GNUNET_HashCode),
+ sqlite3_bind_blob (stmt, 7, key, sizeof (struct GNUNET_HashCode),
SQLITE_TRANSIENT)) ||
(SQLITE_OK !=
- sqlite3_bind_blob (stmt, 8, &vhash, sizeof (GNUNET_HashCode),
+ sqlite3_bind_blob (stmt, 8, &vhash, sizeof (struct GNUNET_HashCode),
SQLITE_TRANSIENT)) ||
(SQLITE_OK != sqlite3_bind_blob (stmt, 9, data, size, SQLITE_TRANSIENT)))
{
@@ -648,7 +641,7 @@ execute_get (struct Plugin *plugin, sqlite3_stmt * stmt,
case SQLITE_ROW:
size = sqlite3_column_bytes (stmt, 5);
rowid = sqlite3_column_int64 (stmt, 6);
- if (sqlite3_column_bytes (stmt, 4) != sizeof (GNUNET_HashCode))
+ if (sqlite3_column_bytes (stmt, 4) != sizeof (struct GNUNET_HashCode))
{
GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, "sqlite",
_
@@ -768,8 +761,8 @@ sqlite_plugin_get_zero_anonymity (void *cls, uint64_t offset,
* @param proc_cls closure for proc
*/
static void
-sqlite_plugin_get_key (void *cls, uint64_t offset, const GNUNET_HashCode * key,
- const GNUNET_HashCode * vhash,
+sqlite_plugin_get_key (void *cls, uint64_t offset, const struct GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * vhash,
enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc,
void *proc_cls)
{
@@ -796,11 +789,11 @@ sqlite_plugin_get_key (void *cls, uint64_t offset, const GNUNET_HashCode * key,
}
sqoff = 1;
ret =
- sqlite3_bind_blob (stmt, sqoff++, key, sizeof (GNUNET_HashCode),
+ sqlite3_bind_blob (stmt, sqoff++, key, sizeof (struct GNUNET_HashCode),
SQLITE_TRANSIENT);
if ((vhash != NULL) && (ret == SQLITE_OK))
ret =
- sqlite3_bind_blob (stmt, sqoff++, vhash, sizeof (GNUNET_HashCode),
+ sqlite3_bind_blob (stmt, sqoff++, vhash, sizeof (struct GNUNET_HashCode),
SQLITE_TRANSIENT);
if ((type != 0) && (ret == SQLITE_OK))
ret = sqlite3_bind_int (stmt, sqoff++, type);
@@ -845,11 +838,11 @@ sqlite_plugin_get_key (void *cls, uint64_t offset, const GNUNET_HashCode * key,
}
sqoff = 1;
ret =
- sqlite3_bind_blob (stmt, sqoff++, key, sizeof (GNUNET_HashCode),
+ sqlite3_bind_blob (stmt, sqoff++, key, sizeof (struct GNUNET_HashCode),
SQLITE_TRANSIENT);
if ((vhash != NULL) && (ret == SQLITE_OK))
ret =
- sqlite3_bind_blob (stmt, sqoff++, vhash, sizeof (GNUNET_HashCode),
+ sqlite3_bind_blob (stmt, sqoff++, vhash, sizeof (struct GNUNET_HashCode),
SQLITE_TRANSIENT);
if ((type != 0) && (ret == SQLITE_OK))
ret = sqlite3_bind_int (stmt, sqoff++, type);
@@ -916,7 +909,7 @@ struct ReplCtx
* GNUNET_NO to delete the item
*/
static int
-repl_proc (void *cls, const GNUNET_HashCode * key, uint32_t size,
+repl_proc (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
@@ -1076,7 +1069,7 @@ sqlite_plugin_get_keys (void *cls,
void *proc_cls)
{
struct Plugin *plugin = cls;
- const GNUNET_HashCode *key;
+ const struct GNUNET_HashCode *key;
sqlite3_stmt *stmt;
int ret;
@@ -1089,9 +1082,11 @@ sqlite_plugin_get_keys (void *cls,
}
while (SQLITE_ROW == (ret = sqlite3_step (stmt)))
{
- key = sqlite3_column_blob (stmt, 1);
- if (sizeof (GNUNET_HashCode) == sqlite3_column_bytes (stmt, 1))
+ key = sqlite3_column_blob (stmt, 0);
+ if (sizeof (struct GNUNET_HashCode) == sqlite3_column_bytes (stmt, 0))
proc (proc_cls, key, 1);
+ else
+ GNUNET_break (0);
}
if (SQLITE_DONE != ret)
LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR, "sqlite_step");
diff --git a/src/datastore/plugin_datastore_template.c b/src/datastore/plugin_datastore_template.c
index 174d3d2..2978de4 100644
--- a/src/datastore/plugin_datastore_template.c
+++ b/src/datastore/plugin_datastore_template.c
@@ -71,7 +71,7 @@ template_plugin_estimate_size (void *cls)
* @return GNUNET_OK on success
*/
static int
-template_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size,
+template_plugin_put (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,
@@ -103,8 +103,8 @@ template_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size,
*/
static void
template_plugin_get_key (void *cls, uint64_t offset,
- const GNUNET_HashCode * key,
- const GNUNET_HashCode * vhash,
+ const struct GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * vhash,
enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc,
void *proc_cls)
{
@@ -213,6 +213,21 @@ template_plugin_drop (void *cls)
/**
+ * Get all of the keys in the datastore.
+ *
+ * @param cls closure
+ * @param proc function to call on each key
+ * @param proc_cls closure for proc
+ */
+static void
+template_get_keys (void *cls,
+ PluginKeyProcessor proc,
+ void *proc_cls)
+{
+}
+
+
+/**
* Entry point for the plugin.
*
* @param cls the "struct GNUNET_DATASTORE_PluginEnvironment*"
@@ -237,6 +252,7 @@ libgnunet_plugin_datastore_template_init (void *cls)
api->get_expiration = &template_plugin_get_expiration;
api->get_zero_anonymity = &template_plugin_get_zero_anonymity;
api->drop = &template_plugin_drop;
+ api->get_keys = &template_get_keys;
GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, "template",
_("Template database running\n"));
return api;
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c
index 4c07366..66ba416 100644
--- a/src/datastore/test_datastore_api.c
+++ b/src/datastore/test_datastore_api.c
@@ -30,10 +30,8 @@
#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_datastore_service.h"
+#include "gnunet_testing_lib.h"
-#define VERBOSE GNUNET_NO
-
-#define START_DATASTORE GNUNET_YES
/**
* How long until we give up on transmitting the message?
@@ -121,7 +119,7 @@ enum RunPhase
struct CpsRunContext
{
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
int i;
int rid;
const struct GNUNET_CONFIGURATION_Handle *cfg;
@@ -173,7 +171,7 @@ get_reserved (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration
static void
-check_value (void *cls, const GNUNET_HashCode * key, size_t size,
+check_value (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
@@ -219,7 +217,7 @@ check_value (void *cls, const GNUNET_HashCode * key, size_t size,
static void
-delete_value (void *cls, const GNUNET_HashCode * key, size_t size,
+delete_value (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
@@ -239,7 +237,7 @@ delete_value (void *cls, const GNUNET_HashCode * key, size_t size,
static void
-check_nothing (void *cls, const GNUNET_HashCode * key, size_t size,
+check_nothing (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
@@ -255,7 +253,7 @@ check_nothing (void *cls, const GNUNET_HashCode * key, size_t size,
static void
-check_multiple (void *cls, const GNUNET_HashCode * key, size_t size,
+check_multiple (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration, uint64_t uid)
@@ -287,7 +285,7 @@ check_multiple (void *cls, const GNUNET_HashCode * key, size_t size,
static void
-check_update (void *cls, const GNUNET_HashCode * key, size_t size,
+check_update (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
@@ -314,16 +312,12 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
struct CpsRunContext *crc = cls;
ok = (int) crc->phase;
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test in phase %u\n", crc->phase);
-#endif
switch (crc->phase)
{
case RP_PUT:
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Executing `%s' number %u\n", "PUT",
crc->i);
-#endif
GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key);
GNUNET_DATASTORE_put (datastore, 0, &crc->key, get_size (crc->i),
get_data (crc->i), get_type (crc->i),
@@ -336,10 +330,8 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
break;
case RP_GET:
crc->i--;
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Executing `%s' number %u\n", "GET",
crc->i);
-#endif
GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key);
GNUNET_DATASTORE_get_key (datastore, crc->offset, &crc->key,
get_type (crc->i), 1, 1, TIMEOUT, &check_value,
@@ -347,10 +339,8 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
break;
case RP_DEL:
crc->i--;
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Executing `%s' number %u\n", "DEL",
crc->i);
-#endif
crc->data = NULL;
GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key);
GNUNET_assert (NULL !=
@@ -359,10 +349,8 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
&delete_value, crc));
break;
case RP_DO_DEL:
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Executing `%s' number %u\n", "DO_DEL",
crc->i);
-#endif
if (crc->i == 0)
{
crc->i = ITERATIONS;
@@ -379,10 +367,8 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
break;
case RP_DELVALIDATE:
crc->i--;
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Executing `%s' number %u\n",
"DEL-VALIDATE", crc->i);
-#endif
GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key);
GNUNET_assert (NULL !=
GNUNET_DATASTORE_get_key (datastore, crc->offset, &crc->key,
@@ -433,9 +419,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
&check_update, crc));
break;
case RP_DONE:
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished, disconnecting\n");
-#endif
GNUNET_DATASTORE_disconnect (datastore, GNUNET_YES);
GNUNET_free (crc);
ok = 0;
@@ -479,11 +463,12 @@ run_tests (void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiratio
static void
-run (void *cls, char *const *args, const char *cfgfile,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
+run (void *cls,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ struct GNUNET_TESTING_Peer *peer)
{
struct CpsRunContext *crc;
- static GNUNET_HashCode zkey;
+ static struct GNUNET_HashCode zkey;
crc = GNUNET_malloc (sizeof (struct CpsRunContext));
crc->cfg = cfg;
@@ -504,88 +489,21 @@ run (void *cls, char *const *args, const char *cfgfile,
}
-static int
-check ()
+int
+main (int argc, char *argv[])
{
char cfg_name[128];
-#if START_DATASTORE
- struct GNUNET_OS_Process *proc;
-#endif
- char *const argv[] = {
- "test-datastore-api",
- "-c",
- cfg_name,
-#if VERBOSE
- "-L", "DEBUG",
-#endif
- NULL
- };
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
+ plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
GNUNET_snprintf (cfg_name, sizeof (cfg_name),
"test_datastore_api_data_%s.conf", plugin_name);
-#if START_DATASTORE
- proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
- "gnunet-service-arm",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
- "-c", cfg_name, NULL);
-#endif
- GNUNET_assert (NULL != proc);
- GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
- "test-datastore-api", "nohelp", options, &run, NULL);
-#if START_DATASTORE
- sleep (1); /* give datastore chance to receive 'DROP' request */
- if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
- {
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
- ok = 1;
- }
- GNUNET_OS_process_wait (proc);
- GNUNET_OS_process_destroy (proc);
- proc = NULL;
-#endif
- if (ok != 0)
- FPRINTF (stderr, "Missed some testcases: %u\n", ok);
+ if (0 !=
+ GNUNET_TESTING_peer_run ("test-gnunet-datastore",
+ cfg_name,
+ &run,
+ NULL))
+ return 1;
return ok;
}
-int
-main (int argc, char *argv[])
-{
- int ret;
- char *pos;
- char dir_name[128];
-
- sleep (1);
- /* determine name of plugin to use */
- plugin_name = argv[0];
- while (NULL != (pos = strstr (plugin_name, "_")))
- plugin_name = pos + 1;
- if (NULL != (pos = strstr (plugin_name, ".")))
- pos[0] = 0;
- else
- pos = (char *) plugin_name;
-
- GNUNET_snprintf (dir_name, sizeof (dir_name), "/tmp/test-gnunet-datastore-%s",
- plugin_name);
- GNUNET_DISK_directory_remove (dir_name);
- GNUNET_log_setup ("test-datastore-api",
-#if VERBOSE
- "DEBUG",
-#else
- "WARNING",
-#endif
- NULL);
- ret = check ();
- if (pos != plugin_name)
- pos[0] = '.';
- GNUNET_DISK_directory_remove (dir_name);
- return ret;
-}
-
/* end of test_datastore_api.c */
diff --git a/src/datastore/test_datastore_api_data_heap.conf b/src/datastore/test_datastore_api_data_heap.conf
new file mode 100644
index 0000000..0e6994d
--- /dev/null
+++ b/src/datastore/test_datastore_api_data_heap.conf
@@ -0,0 +1,20 @@
+@INLINE@ test_defaults.conf
+[PATHS]
+SERVICEHOME = /tmp/test-gnunet-datastore-heap/
+
+[TESTING]
+WEAKRANDOM = YES
+
+[arm]
+PORT = 42466
+DEFAULTSERVICES =
+
+[statistics]
+PORT = 22667
+
+[resolver]
+PORT = 42464
+
+[datastore]
+QUOTA = 10 MB
+DATABASE = heap
diff --git a/src/datastore/test_datastore_api_data_mysql.conf b/src/datastore/test_datastore_api_data_mysql.conf
index 8e5a3dc..92967b9 100644
--- a/src/datastore/test_datastore_api_data_mysql.conf
+++ b/src/datastore/test_datastore_api_data_mysql.conf
@@ -1,7 +1,6 @@
@INLINE@ test_defaults.conf
[PATHS]
SERVICEHOME = /tmp/test-gnunet-datastore-mysql/
-DEFAULTCONFIG = test_datastore_api_data_mysql.conf
[TESTING]
WEAKRANDOM = YES
diff --git a/src/datastore/test_datastore_api_data_postgres.conf b/src/datastore/test_datastore_api_data_postgres.conf
index 046c561..a1a2168 100644
--- a/src/datastore/test_datastore_api_data_postgres.conf
+++ b/src/datastore/test_datastore_api_data_postgres.conf
@@ -1,7 +1,6 @@
@INLINE@ test_defaults.conf
[PATHS]
SERVICEHOME = /tmp/test-gnunet-datastore-postgres/
-DEFAULTCONFIG = test_datastore_api_data_postgres.conf
[TESTING]
WEAKRANDOM = YES
diff --git a/src/datastore/test_datastore_api_data_sqlite.conf b/src/datastore/test_datastore_api_data_sqlite.conf
index 098f9d2..953aef2 100644
--- a/src/datastore/test_datastore_api_data_sqlite.conf
+++ b/src/datastore/test_datastore_api_data_sqlite.conf
@@ -1,7 +1,6 @@
@INLINE@ test_defaults.conf
[PATHS]
SERVICEHOME = /tmp/test-gnunet-datastore-sqlite/
-DEFAULTCONFIG = test_datastore_api_data_sqlite.conf
[TESTING]
WEAKRANDOM = YES
@@ -19,6 +18,4 @@ PORT = 42464
[datastore]
QUOTA = 10 MB
-[fs]
-AUTOSTART = NO
diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c
index bb3898e..9eae32f 100644
--- a/src/datastore/test_datastore_api_management.c
+++ b/src/datastore/test_datastore_api_management.c
@@ -22,13 +22,12 @@
* @brief Test for the space management functions of the datastore implementation.
* @author Christian Grothoff
*/
-
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_datastore_service.h"
+#include "gnunet_testing_lib.h"
-#define VERBOSE GNUNET_NO
/**
* How long until we give up on transmitting the message?
@@ -41,6 +40,27 @@
*/
#define ITERATIONS 5000
+enum RunPhase
+{
+ RP_PUT,
+ RP_GET,
+ RP_DONE,
+ RP_GET_FAIL
+};
+
+
+struct CpsRunContext
+{
+ struct GNUNET_HashCode key;
+ int i;
+ int found;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
+ void *data;
+ enum RunPhase phase;
+ uint64_t offset;
+};
+
+
static struct GNUNET_DATASTORE_Handle *datastore;
static struct GNUNET_TIME_Absolute now;
@@ -49,6 +69,7 @@ static int ok;
static const char *plugin_name;
+
static size_t
get_size (int i)
{
@@ -96,26 +117,6 @@ get_expiration (int i)
return av;
}
-enum RunPhase
-{
- RP_PUT,
- RP_GET,
- RP_DONE,
- RP_GET_FAIL
-};
-
-
-struct CpsRunContext
-{
- GNUNET_HashCode key;
- int i;
- int found;
- const struct GNUNET_CONFIGURATION_Handle *cfg;
- void *data;
- enum RunPhase phase;
- uint64_t offset;
-};
-
static void
run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
@@ -137,7 +138,7 @@ check_success (void *cls, int success, struct GNUNET_TIME_Absolute min_expiratio
static void
-check_value (void *cls, const GNUNET_HashCode * key, size_t size,
+check_value (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
@@ -169,7 +170,7 @@ check_value (void *cls, const GNUNET_HashCode * key, size_t size,
static void
-check_nothing (void *cls, const GNUNET_HashCode * key, size_t size,
+check_nothing (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
@@ -193,10 +194,8 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
switch (crc->phase)
{
case RP_PUT:
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Executing `%s' number %u\n", "PUT",
crc->i);
-#endif
GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key);
GNUNET_DATASTORE_put (datastore, 0, &crc->key, get_size (crc->i),
get_data (crc->i), get_type (crc->i),
@@ -214,20 +213,16 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
}
break;
case RP_GET:
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Executing `%s' number %u\n", "GET",
crc->i);
-#endif
GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key);
GNUNET_DATASTORE_get_key (datastore, crc->offset++, &crc->key,
get_type (crc->i), 1, 1, TIMEOUT, &check_value,
crc);
break;
case RP_GET_FAIL:
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Executing `%s' number %u\n", "GET(f)",
crc->i);
-#endif
GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key);
GNUNET_DATASTORE_get_key (datastore, crc->offset++, &crc->key,
get_type (crc->i), 1, 1, TIMEOUT, &check_nothing,
@@ -235,9 +230,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
break;
case RP_DONE:
GNUNET_assert (0 == crc->i);
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished, disconnecting\n");
-#endif
GNUNET_DATASTORE_disconnect (datastore, GNUNET_YES);
GNUNET_free (crc);
ok = 0;
@@ -265,11 +258,12 @@ run_tests (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, c
static void
-run (void *cls, char *const *args, const char *cfgfile,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
+run (void *cls,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ struct GNUNET_TESTING_Peer *peer)
{
struct CpsRunContext *crc;
- static GNUNET_HashCode zkey;
+ static struct GNUNET_HashCode zkey;
crc = GNUNET_malloc (sizeof (struct CpsRunContext));
crc->cfg = cfg;
@@ -290,85 +284,21 @@ run (void *cls, char *const *args, const char *cfgfile,
}
-
-static int
-check ()
+int
+main (int argc, char *argv[])
{
- struct GNUNET_OS_Process *proc;
char cfg_name[128];
- char *const argv[] = {
- "test-datastore-api-management",
- "-c",
- cfg_name,
-#if VERBOSE
- "-L", "DEBUG",
-#endif
- NULL
- };
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
+ plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
GNUNET_snprintf (cfg_name, sizeof (cfg_name),
"test_datastore_api_data_%s.conf", plugin_name);
- proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
- "gnunet-service-arm",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
- "-c", cfg_name, NULL);
- GNUNET_assert (NULL != proc);
- GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
- "test-datastore-api-management", "nohelp", options, &run,
- NULL);
- sleep (1); /* give datastore chance to process 'DROP' request */
- if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
- {
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
- ok = 1;
- }
- GNUNET_OS_process_wait (proc);
- GNUNET_OS_process_destroy (proc);
- proc = NULL;
- if (ok != 0)
- FPRINTF (stderr, "Missed some testcases: %u\n", ok);
+ if (0 !=
+ GNUNET_TESTING_peer_run ("test-gnunet-datastore-management",
+ cfg_name,
+ &run,
+ NULL))
+ return 1;
return ok;
}
-int
-main (int argc, char *argv[])
-{
- int ret;
-
- char *pos;
- char dir_name[128];
-
- sleep (1);
- /* determine name of plugin to use */
- plugin_name = argv[0];
- while (NULL != (pos = strstr (plugin_name, "_")))
- plugin_name = pos + 1;
- if (NULL != (pos = strstr (plugin_name, ".")))
- pos[0] = 0;
- else
- pos = (char *) plugin_name;
-
- GNUNET_snprintf (dir_name, sizeof (dir_name), "/tmp/test-gnunet-datastore-%s",
- plugin_name);
- GNUNET_DISK_directory_remove (dir_name);
- GNUNET_log_setup ("test-datastore-api-management",
-#if VERBOSE
- "DEBUG",
-#else
- "WARNING",
-#endif
- NULL);
- ret = check ();
- if (pos != plugin_name)
- pos[0] = '.';
- GNUNET_DISK_directory_remove (dir_name);
- return ret;
-}
-
/* end of test_datastore_api_management.c */
diff --git a/src/datastore/test_defaults.conf b/src/datastore/test_defaults.conf
index ce27c01..53bd66c 100644
--- a/src/datastore/test_defaults.conf
+++ b/src/datastore/test_defaults.conf
@@ -31,3 +31,9 @@ AUTOSTART = NO
[namestore]
AUTOSTART = NO
+
+[fs]
+AUTOSTART = NO
+
+[consensus]
+AUTOSTART = NO
diff --git a/src/datastore/test_plugin_datastore.c b/src/datastore/test_plugin_datastore.c
index 16fe40c..adfacef 100644
--- a/src/datastore/test_plugin_datastore.c
+++ b/src/datastore/test_plugin_datastore.c
@@ -27,8 +27,7 @@
#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_datastore_plugin.h"
-
-#define VERBOSE GNUNET_NO
+#include "gnunet_testing_lib.h"
/**
* Number of put operations to perform.
@@ -85,11 +84,11 @@ disk_utilization_change_cb (void *cls, int delta)
static void
-gen_key (int i, GNUNET_HashCode * key)
+gen_key (int i, struct GNUNET_HashCode * key)
{
- memset (key, 0, sizeof (GNUNET_HashCode));
+ memset (key, 0, sizeof (struct GNUNET_HashCode));
key->bits[0] = (unsigned int) i;
- GNUNET_CRYPTO_hash (key, sizeof (GNUNET_HashCode), key);
+ GNUNET_CRYPTO_hash (key, sizeof (struct GNUNET_HashCode), key);
}
@@ -98,7 +97,7 @@ put_value (struct GNUNET_DATASTORE_PluginFunctions *api, int i, int k)
{
char value[65536];
size_t size;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
char *msg;
unsigned int prio;
@@ -117,10 +116,9 @@ put_value (struct GNUNET_DATASTORE_PluginFunctions *api, int i, int k)
value[0] = k;
msg = NULL;
prio = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100);
-#if VERBOSE
- FPRINTF (stderr, "putting type %u, anon %u under key %s\n", i + 1, i,
- GNUNET_h2s (&key));
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "putting type %u, anon %u under key %s\n", i + 1, i,
+ GNUNET_h2s (&key));
if (GNUNET_OK != api->put (api->cls, &key, size, value, i + 1 /* type */ ,
prio, i /* anonymity */ ,
0 /* replication */ ,
@@ -149,7 +147,7 @@ static uint64_t guid;
static int
-iterate_one_shot (void *cls, const GNUNET_HashCode * key, uint32_t size,
+iterate_one_shot (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration, uint64_t uid)
@@ -159,12 +157,10 @@ iterate_one_shot (void *cls, const GNUNET_HashCode * key, uint32_t size,
GNUNET_assert (key != NULL);
guid = uid;
crc->phase++;
-#if VERBOSE
- FPRINTF (stderr,
- "Found result type=%u, priority=%u, size=%u, expire=%llu, key %s\n",
- type, priority, size, (unsigned long long) expiration.abs_value,
- GNUNET_h2s (key));
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Found result type=%u, priority=%u, size=%u, expire=%llu, key %s\n",
+ type, priority, size, (unsigned long long) expiration.abs_value,
+ GNUNET_h2s (key));
GNUNET_SCHEDULER_add_now (&test, crc);
return GNUNET_OK;
}
@@ -222,16 +218,15 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
int j;
unsigned long long os;
unsigned long long cs;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test aborted.\n");
crc->phase = RP_ERROR;
}
-#if VERBOSE
- FPRINTF (stderr, "In phase %d, iteration %u\n", crc->phase, crc->cnt);
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "In phase %d, iteration %u\n", crc->phase, crc->cnt);
switch (crc->phase)
{
case RP_ERROR:
@@ -325,6 +320,8 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg)
if (NULL == (ret = GNUNET_PLUGIN_load (libname, &env)))
{
FPRINTF (stderr, "Failed to load plugin `%s'!\n", name);
+ GNUNET_free (libname);
+ GNUNET_free (name);
return NULL;
}
GNUNET_free (libname);
@@ -355,67 +352,37 @@ run (void *cls, char *const *args, const char *cfgfile,
}
-static int
-check ()
+int
+main (int argc, char *argv[])
{
+ char dir_name[128];
char cfg_name[128];
-
- char *const argv[] = {
+ char *const xargv[] = {
"test-plugin-datastore",
"-c",
cfg_name,
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
- struct GNUNET_GETOPT_CommandLineOption options[] = {
+ static struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
};
- GNUNET_snprintf (cfg_name, sizeof (cfg_name),
- "test_plugin_datastore_data_%s.conf", plugin_name);
- GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
- "test-plugin-datastore", "nohelp", options, &run, NULL);
- if (ok != 0)
- FPRINTF (stderr, "Missed some testcases: %u\n", ok);
- return ok;
-}
-
-
-int
-main (int argc, char *argv[])
-{
- int ret;
- char *pos;
- char dir_name[128];
-
- sleep (1);
/* determine name of plugin to use */
- plugin_name = argv[0];
- while (NULL != (pos = strstr (plugin_name, "_")))
- plugin_name = pos + 1;
- if (NULL != (pos = strstr (plugin_name, ".")))
- pos[0] = 0;
- else
- pos = (char *) plugin_name;
-
+ plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
GNUNET_snprintf (dir_name, sizeof (dir_name),
"/tmp/test-gnunet-datastore-plugin-%s", plugin_name);
GNUNET_DISK_directory_remove (dir_name);
GNUNET_log_setup ("test-plugin-datastore",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
- ret = check ();
- if (pos != plugin_name)
- pos[0] = '.';
+ GNUNET_snprintf (cfg_name, sizeof (cfg_name),
+ "test_plugin_datastore_data_%s.conf", plugin_name);
+ GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
+ "test-plugin-datastore", "nohelp", options, &run, NULL);
+ if (0 != ok)
+ FPRINTF (stderr, "Missed some testcases: %u\n", ok);
GNUNET_DISK_directory_remove (dir_name);
-
- return ret;
+ return ok;
}
/* end of test_plugin_datastore.c */
diff --git a/src/datastore/test_plugin_datastore_data_heap.conf b/src/datastore/test_plugin_datastore_data_heap.conf
new file mode 100644
index 0000000..6e352b9
--- /dev/null
+++ b/src/datastore/test_plugin_datastore_data_heap.conf
@@ -0,0 +1,6 @@
+@INLINE@ test_defaults.conf
+[PATHS]
+SERVICEHOME = /tmp/test-gnunet-datastore-plugin-heap/
+
+[datastore]
+DATABASE = heap
diff --git a/src/datastore/test_plugin_datastore_data_mysql.conf b/src/datastore/test_plugin_datastore_data_mysql.conf
index 957818a..845454b 100644
--- a/src/datastore/test_plugin_datastore_data_mysql.conf
+++ b/src/datastore/test_plugin_datastore_data_mysql.conf
@@ -1,7 +1,6 @@
@INLINE@ test_defaults.conf
[PATHS]
SERVICEHOME = /tmp/test-gnunet-datastore-plugin-mysql/
-DEFAULTCONFIG = test_plugin_datastore_data_mysql.conf
[datastore]
DATABASE = mysql
diff --git a/src/datastore/test_plugin_datastore_data_postgres.conf b/src/datastore/test_plugin_datastore_data_postgres.conf
index d796496..8b8523d 100644
--- a/src/datastore/test_plugin_datastore_data_postgres.conf
+++ b/src/datastore/test_plugin_datastore_data_postgres.conf
@@ -1,7 +1,6 @@
@INLINE@ test_defaults.conf
[PATHS]
SERVICEHOME = /tmp/test-gnunet-datastore-plugin-postgres/
-DEFAULTCONFIG = test_plugin_datastore_data_postgres.conf
[datastore]
DATABASE = postgres
diff --git a/src/datastore/test_plugin_datastore_data_sqlite.conf b/src/datastore/test_plugin_datastore_data_sqlite.conf
index f1fcf5f..dcdea7d 100644
--- a/src/datastore/test_plugin_datastore_data_sqlite.conf
+++ b/src/datastore/test_plugin_datastore_data_sqlite.conf
@@ -1,5 +1,4 @@
@INLINE@ test_defaults.conf
[PATHS]
SERVICEHOME = /tmp/test-gnunet-datastore-plugin-sqlite/
-DEFAULTCONFIG = test_plugin_datastore_data_sqlite.conf