Changeset: d54e3c3a441f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d54e3c3a441f
Added Files:
        common/stream/mhapi.proto
Modified Files:
        bootstrap
        common/stream/Makefile.ag
        common/stream/stream.h
        configure.ag
Branch: protocol
Log Message:

bringing back some protobuf for testing


diffs (147 lines):

diff --git a/bootstrap b/bootstrap
--- a/bootstrap
+++ b/bootstrap
@@ -59,3 +59,6 @@ autoconf
 if [ -f buildtools/conf/install-sh -a ! -x buildtools/conf/install-sh ]; then
     chmod +x buildtools/conf/install-sh
 fi
+
+
+protoc-c common/stream/mhapi.proto --c_out .
diff --git a/common/stream/Makefile.ag b/common/stream/Makefile.ag
--- a/common/stream/Makefile.ag
+++ b/common/stream/Makefile.ag
@@ -14,6 +14,7 @@ INCLUDES = $(zlib_CFLAGS) \
                   $(lz4_CFLAGS) \
                   $(liblzma_CFLAGS) \
                   $(openssl_CFLAGS) \
+                  $(protobuf_CFLAGS) \
                   $(curl_CFLAGS)
 
 lib_stream  =  {
@@ -30,6 +31,13 @@ lib_stream  =  {
                   $(LTLIBICONV)
 }
 
+lib_stream_protobuf = {
+       COND = HAVE_LIBPROTOBUF
+       SOURCES = mhapi.pb-c.h mhapi.pb-c.c
+       VERSION = 42
+       LIBS =  $(protobuf_LIBS)
+}
+
 headers_common = {
        DIR = includedir/monetdb
        HEADERS = h
diff --git a/common/stream/mhapi.proto b/common/stream/mhapi.proto
new file mode 100644
--- /dev/null
+++ b/common/stream/mhapi.proto
@@ -0,0 +1,33 @@
+package mhapi;
+
+message QueryResult {
+       required int32 result_id = 1;
+       required int64 row_count = 2;
+       required int64 col_count = 3;
+
+       message Column {
+               required string table_name = 1;
+               required string column_name = 2;
+               required string type_name = 3;
+
+               repeated string string_values = 4;
+               repeated int64  int64_values = 5 [packed=true];
+               repeated int32  int32_value = 6 [packed=true];
+               repeated double double_values = 7 [packed=true];
+       }
+
+
+       message ColumnUnpacked {
+               required string table_name = 1;
+               required string column_name = 2;
+               required string type_name = 3;
+
+               repeated string string_values = 4;
+               repeated int64  int64_values = 5;
+               repeated int32  int32_value = 6;
+               repeated double double_values = 7;
+       }
+
+       repeated Column columns = 4;
+       repeated ColumnUnpacked columns_unpacked = 5;
+}
diff --git a/common/stream/stream.h b/common/stream/stream.h
--- a/common/stream/stream.h
+++ b/common/stream/stream.h
@@ -252,7 +252,8 @@ typedef enum {
 typedef enum {
        COLUMN_COMPRESSION_AUTO = 255,
        COLUMN_COMPRESSION_NONE = 0,
-       COLUMN_COMPRESSION_PFOR = 1
+       COLUMN_COMPRESSION_PFOR = 1,
+       COLUMN_COMPRESSION_PROTOBUF = 2
 } column_compression;
 
 stream_export stream *block_stream2(stream *s, size_t bufsiz, 
compression_method comp, column_compression colcomp);
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -1726,6 +1726,49 @@ AC_SUBST([pfor_CFLAGS])
 AC_SUBST([pfor_LIBS])
 AM_CONDITIONAL([HAVE_PFOR], [test x$have_pfor != xno])
 
+dnl  check for protobuf-c serialization library
+org_have_protobuf=auto
+have_protobuf=$org_have_protobuf
+protobuf_CFLAGS=""
+protobuf_LIBS=""
+AC_ARG_WITH([protobuf],
+       [AS_HELP_STRING([--with-protobuf=DIR],
+               [protobuf library is installed in DIR])],
+       [have_protobuf="$withval"])
+
+AS_CASE(["$have_protobuf"],
+       [yes|no|auto], [],
+       [
+               protobuf_CFLAGS="-I$withval/include"
+               protobuf_LIBS="-L$withval/lib"])
+
+AC_MSG_CHECKING([for protobuf])
+AS_VAR_IF([have_protobuf], [no], [], [
+       save_CPPFLAGS="$CPPFLAGS"
+       CPPFLAGS="$CPPFLAGS $protobuf_CFLAGS"
+       save_LIBS="$LIBS"
+       LIBS="$LIBS $protobuf_LIBS -lprotobuf-c"
+       AC_LINK_IFELSE([AC_LANG_PROGRAM([[@%:@include <stdio.h>
+@%:@include <protobuf-c/protobuf-c.h>]], 
[[(void)protobuf_c_version_number();]])],
+               protobuf_LIBS="$protobuf_LIBS -lprotobuf-c",
+               [ AS_VAR_IF([have_protobuf], [auto], [], [
+                       AC_MSG_ERROR([protobuf library not found])])
+                 have_protobuf=no
+                 why_have_protobuf="(protobuf library not found)" ])
+       LIBS="$save_LIBS"
+       CPPFLAGS="$save_CPPFLAGS"])
+
+AS_VAR_IF([have_protobuf], [no], [], [
+       AC_DEFINE([HAVE_LIBPROTOBUF], 1, [Define if you have the protobuf 
library])
+       AC_MSG_RESULT([yes: $protobuf_LIBS])], [
+       protobuf_CFLAGS=""
+       protobuf_LIBS=""
+       AC_MSG_RESULT([no])])
+
+AC_SUBST([protobuf_CFLAGS])
+AC_SUBST([protobuf_LIBS])
+AM_CONDITIONAL([HAVE_LIBPROTOBUF], [test x$have_protobuf != xno])
+
 
 DL_LIBS=""
 AC_CHECK_LIB([dl], [dlopen], [DL_LIBS="-ldl" ] )
@@ -3371,6 +3414,7 @@ for comp in \
        'pcre         ' \
        'perl         ' \
        'proj         ' \
+       'protobuf     ' \
        'pthread      ' \
        'python2      ' \
        'python3      ' \
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to