From 6706ef53325e7ca456c255efb531d99deaa01183 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Wed, 4 Jan 2012 09:45:55 +0100 Subject: [PATCH] reorganisation of directory tree structure --- Makefile.files | 255 ++++++++++++++++++++++++++++++++++++++++++++ VocBase/durham.h | 67 ++++++++++++ config/bison-c++.sh | 56 ++++++++++ config/flex-c++.sh | 41 +++++++ config/flex-c.sh | 44 ++++++++ config/js2c.sh | 6 ++ 6 files changed, 469 insertions(+) create mode 100644 Makefile.files create mode 100644 VocBase/durham.h create mode 100755 config/bison-c++.sh create mode 100755 config/flex-c++.sh create mode 100755 config/flex-c.sh create mode 100755 config/js2c.sh diff --git a/Makefile.files b/Makefile.files new file mode 100644 index 0000000000..5b9e874cfa --- /dev/null +++ b/Makefile.files @@ -0,0 +1,255 @@ +################################################################################ +## avocadodb +################################################################################ + +libavocadodb_a_CPPFLAGS = \ + @BOOST_CPPFLAGS@ \ + @LIBEV_CPPFLAGS@ \ + @MATH_CPPFLAGS@ \ + @NCURSES_CPPFLAGS@ \ + @OPENSSL_CPPFLAGS@ \ + @READLINE_CPPFLAGS@ \ + @V8_CPPFLAGS@ + +libavocadodb_a_SOURCES = \ + Admin/ApplicationAdminServer.cpp \ + Admin/RestAdminBaseHandler.cpp \ + Admin/RestAdminFeConfigurationHandler.cpp \ + Admin/RestAdminLogHandler.cpp \ + Admin/RestBaseHandler.cpp \ + Admin/RestVersionHandler.cpp \ + ApplicationServer/ApplicationServer.cpp \ + ApplicationServer/ApplicationServerImpl.cpp \ + ApplicationServer/ApplicationServerSchedulerImpl.cpp \ + Basics/ConditionLocker.cpp \ + Basics/ConditionVariable.cpp \ + Basics/FileUtils.cpp \ + Basics/Initialise.cpp \ + Basics/LibraryLoader.cpp \ + Basics/Mutex.cpp \ + Basics/MutexLocker.cpp \ + Basics/ProgramOptions.cpp \ + Basics/ProgramOptionsDescription.cpp \ + Basics/Random.cpp \ + Basics/ReadLocker.cpp \ + Basics/ReadUnlocker.cpp \ + Basics/ReadWriteLock.cpp \ + Basics/StringUtils.cpp \ + Basics/Thread.cpp \ + Basics/Timing.cpp \ + Basics/WriteLocker.cpp \ + Basics/WriteUnlocker.cpp \ + BasicsC/associative-multi.c \ + BasicsC/associative.c \ + BasicsC/conversions.c \ + BasicsC/csv.c \ + BasicsC/error.c \ + BasicsC/files.c \ + BasicsC/hashes.c \ + BasicsC/init.c \ + BasicsC/json.c \ + BasicsC/locks-macos.c \ + BasicsC/locks-posix.c \ + BasicsC/logging.c \ + BasicsC/memory.c \ + BasicsC/process-utils.c \ + BasicsC/random.c \ + BasicsC/socket-utils.c \ + BasicsC/string-buffer.c \ + BasicsC/strings.c \ + BasicsC/structures.c \ + BasicsC/system-functions.c \ + BasicsC/terminal-utils-ncurses.c \ + BasicsC/terminal-utils.c \ + BasicsC/threads-posix.c \ + BasicsC/vector.c \ + Dispatcher/ApplicationServerDispatcher.cpp \ + Dispatcher/ApplicationServerDispatcherImpl.cpp \ + Dispatcher/DispatcherImpl.cpp \ + Dispatcher/DispatcherQueue.cpp \ + Dispatcher/DispatcherThread.cpp \ + Dispatcher/Job.cpp \ + GeneralServer/GeneralFigures.cpp \ + GeoIndex/GeoIndex.c \ + HttpServer/ApplicationHttpServer.cpp \ + HttpServer/ApplicationHttpServerImpl.cpp \ + HttpServer/HttpCommTask.cpp \ + HttpServer/HttpHandler.cpp \ + HttpServer/HttpHandlerFactory.cpp \ + HttpServer/PathHandler.cpp \ + HttpServer/RedirectHandler.cpp \ + HttpServer/ServiceUnavailableHandler.cpp \ + HttpsServer/ApplicationHttpsServer.cpp \ + HttpsServer/ApplicationHttpsServerImpl.cpp \ + HttpsServer/HttpsAsyncCommTask.cpp \ + HttpsServer/HttpsServer.cpp \ + HttpsServer/HttpsServerImpl.cpp \ + JsonParser/json-parser.c \ + JsonParserX/InputParser.cpp \ + JsonParserX/JsonParserX.cpp \ + JsonParserX/JsonParserXDriver.cpp \ + JsonParserX/JsonScannerX.cpp \ + Logger/Logger.cpp \ + Logger/LoggerData.cpp \ + Logger/LoggerInfo.cpp \ + Logger/LoggerStream.cpp \ + Logger/LoggerTiming.cpp \ + ProgramOptions/program-options.c \ + Rest/AddressPort.cpp \ + Rest/AnyServer.cpp \ + Rest/HttpRequest.cpp \ + Rest/HttpResponse.cpp \ + Rest/Initialise.cpp \ + Rest/SslInterface.cpp \ + Rest/Url.cpp \ + ResultGenerator/HtmlResultGenerator.cpp \ + ResultGenerator/Initialise.cpp \ + ResultGenerator/JsonResultGenerator.cpp \ + ResultGenerator/JsonXResultGenerator.cpp \ + ResultGenerator/OutputGenerator.cpp \ + ResultGenerator/PhpResultGenerator.cpp \ + ResultGenerator/ResultGenerator.cpp \ + ResultGenerator/XmlResultGenerator.cpp \ + Scheduler/AsyncTask.cpp \ + Scheduler/ConnectionTask.cpp \ + Scheduler/ListenTask.cpp \ + Scheduler/PeriodicTask.cpp \ + Scheduler/Scheduler.cpp \ + Scheduler/SchedulerImpl.cpp \ + Scheduler/SchedulerLibev.cpp \ + Scheduler/SchedulerThread.cpp \ + Scheduler/SignalTask.cpp \ + Scheduler/SocketTask.cpp \ + Scheduler/Task.cpp \ + Scheduler/TimerTask.cpp \ + ShapedJson/json-shaper.c \ + ShapedJson/shape-accessor.c \ + ShapedJson/shaped-json.c \ + V8/v8-actions.cpp \ + V8/v8-json.cpp \ + V8/v8-shell.cpp \ + V8/v8-utils.cpp \ + V8/v8-vocbase.cpp \ + Variant/VariantArray.cpp \ + Variant/VariantBlob.cpp \ + Variant/VariantBoolean.cpp \ + Variant/VariantDate.cpp \ + Variant/VariantDatetime.cpp \ + Variant/VariantDouble.cpp \ + Variant/VariantFloat.cpp \ + Variant/VariantInt16.cpp \ + Variant/VariantInt32.cpp \ + Variant/VariantInt64.cpp \ + Variant/VariantInt8.cpp \ + Variant/VariantMatrix2.cpp \ + Variant/VariantNull.cpp \ + Variant/VariantObject.cpp \ + Variant/VariantString.cpp \ + Variant/VariantUInt16.cpp \ + Variant/VariantUInt32.cpp \ + Variant/VariantUInt64.cpp \ + Variant/VariantUInt8.cpp \ + Variant/VariantVector.cpp \ + VocBase/blob-collection.c \ + VocBase/collection.c \ + VocBase/compactor.c \ + VocBase/datafile.c \ + VocBase/document-collection.c \ + VocBase/headers.c \ + VocBase/index.c \ + VocBase/query.c \ + VocBase/result-set.c \ + VocBase/simple-collection.c \ + VocBase/synchroniser.c \ + VocBase/voc-shaper.c \ + VocBase/vocbase.c + +avocadodb_CPPFLAGS = \ + @BOOST_CPPFLAGS@ \ + @LIBEV_CPPFLAGS@ \ + @MATH_CPPFLAGS@ \ + @NCURSES_CPPFLAGS@ \ + @OPENSSL_CPPFLAGS@ \ + @READLINE_CPPFLAGS@ \ + @V8_CPPFLAGS@ + +avocadodb_LDFLAGS = \ + -L. \ + @BOOST_LDFLAGS@ \ + @LIBEV_LDFLAGS@ \ + @MATH_LDFLAGS@ \ + @NCURSES_LDFLAGS@ \ + @OPENSSL_LDFLAGS@ \ + @READLINE_LDFLAGS@ \ + @V8_LDFLAGS@ + +avocadodb_LDADD = \ + -lavocadodb \ + @BOOST_LIBS@ \ + @LIBEV_LIBS@ \ + @MATH_LIBS@ \ + @NCURSES_LIBS@ \ + @OPENSSL_LIBS@ \ + @READLINE_LIBS@ \ + @V8_LIBS@ + +avocadodb_SOURCES = \ + RestHandler/RestActionHandler.cpp \ + RestHandler/RestDocumentHandler.cpp \ + RestHandler/RestSystemActionHandler.cpp \ + RestHandler/RestVocbaseBaseHandler.cpp \ + RestServer/ActionDispatcherThread.cpp \ + RestServer/AvocadoHttpServer.cpp \ + RestServer/AvocadoServer.cpp \ + RestServer/JSLoader.cpp \ + RestServer/SystemActionDispatcherThread.cpp \ + RestServer/avocado.cpp + +################################################################################ +## JavaScript source code as header +################################################################################ + +BUILT_SOURCES += \ + @builddir@/js/js-json.h \ + @builddir@/js/js-shell.h \ + @builddir@/js/js-actions.h \ + @builddir@/js/js-graph.h \ + @builddir@/js/js-modules.h + +@builddir@/js/js-modules.h: @srcdir@/js/modules.js + @top_srcdir@/config/js2c.sh $^ > $@ + +@builddir@/js/js-json.h: @srcdir@/js/json.js + @top_srcdir@/config/js2c.sh $^ > $@ + +@builddir@/js/js-graph.h: @srcdir@/js/graph.js + @top_srcdir@/config/js2c.sh $^ > $@ + +@builddir@/js/js-shell.h: @srcdir@/js/shell.js + @top_srcdir@/config/js2c.sh $^ > $@ + +@builddir@/js/js-actions.h: @srcdir@/js/actions.js + @top_srcdir@/config/js2c.sh $^ > $@ + +################################################################################ +## FLEX +################################################################################ + +BUILT_SOURCES += \ + JsonParser/json-parser.c + +################################################################################ +## FLEX++ +################################################################################ + +BUILT_SOURCES += \ + V8/v8-json.cpp \ + JsonParserX/JsonScannerX.cpp + +################################################################################ +## BISON++ +################################################################################ + +BUILT_SOURCES += \ + JsonParserX/JsonParserX.cpp + diff --git a/VocBase/durham.h b/VocBase/durham.h new file mode 100644 index 0000000000..cfd96a8076 --- /dev/null +++ b/VocBase/durham.h @@ -0,0 +1,67 @@ +//////////////////////////////////////////////////////////////////////////////// +/// @brief storage engine +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright by triAGENS GmbH - All rights reserved. +/// +/// The Programs (which include both the software and documentation) +/// contain proprietary information of triAGENS GmbH; they are +/// provided under a license agreement containing restrictions on use and +/// disclosure and are also protected by copyright, patent and other +/// intellectual and industrial property laws. Reverse engineering, +/// disassembly or decompilation of the Programs, except to the extent +/// required to obtain interoperability with other independently created +/// software or as specified by law, is prohibited. +/// +/// The Programs are not intended for use in any nuclear, aviation, mass +/// transit, medical, or other inherently dangerous applications. It shall +/// be the licensee's responsibility to take all appropriate fail-safe, +/// backup, redundancy, and other measures to ensure the safe use of such +/// applications if the Programs are used for such purposes, and triAGENS +/// GmbH disclaims liability for any damages caused by such use of +/// the Programs. +/// +/// This software is the confidential and proprietary information of +/// triAGENS GmbH. You shall not disclose such confidential and +/// proprietary information and shall use it only in accordance with the +/// terms of the license agreement you entered into with triAGENS GmbH. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Dr. Frank Celler +/// @author Copyright 2011, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @mainpage +/// +/// The Durham Storage Engine stores documents (aka objects or JSON documents) +/// in datafiles within the filesystem. These documents are mapped into the +/// process space using mmap. Instead of using JSON, BSON, or XML to store the +/// documents a very concise representation, namely JSON Shapes, is used. +/// This allows for verbose attributes name, while still being space efficient. +/// Access to attributes can be precompiled and is therefore incredible fast. +/// +/// @section Interface +/// +/// The Store Engine groups documents into collections. Each +/// collection can be accessed using queries. These queries can either +/// be expressed using a @ref FluentInterface "fluent interface" (see +/// @ref JavaScriptFuncIndex "Index of JavaScript Functions"), using +/// the SQL-select operator find, or using UNQL. +/// +/// @section DataStructures Data Structures +/// +/// The key data structures are @ref ShapedJson "JSON Shapes". JSON Shapes +/// allow the Durham Storage Engine to store documents in a very space +/// efficient way. +/// +/// @section CollectionsDatafiles Collections and Datafiles +/// +/// All data is stored in datafiles. The internal structure of a datafile is +/// described in @ref DurhamDatafiles "Datafiles". All datafiles of a set of +/// documents are grouped together in a @ref DurhamCollections "Collection". +//////////////////////////////////////////////////////////////////////////////// diff --git a/config/bison-c++.sh b/config/bison-c++.sh new file mode 100755 index 0000000000..1841009064 --- /dev/null +++ b/config/bison-c++.sh @@ -0,0 +1,56 @@ +#!/bin/sh + +BISON="$1" +SRC="$2" +DST="$2" +FILE="$3" + +if test "x$BISON" = x -o "x$SRC" = x -o "x$DST" = x -o "x$FILE" = x; then + echo "usage: $0 " + exit 1 +fi + +if test ! -d "$SRC"; then + echo "$0: expecting '$SRC' to be a directory" + exit 1 +fi + +if test ! -d "$DST"; then + echo "$0: expecting '$DST' to be a directory" + exit 1 +fi + +############################################################################# +## bison +############################################################################# + +${BISON} -l -d -ra -S lalr1.cc -o "${DST}/${FILE}.cpp" "${SRC}/${FILE}.yy" + +############################################################################# +## sanity checks +############################################################################# + +test -f ${SRC}/${FILE}.hpp || exit 1 +test -f ${SRC}/${FILE}.cpp || exit 1 +test -f ${SRC}/position.hh || exit 1 + +############################################################################# +## rename file +############################################################################# + +mv ${SRC}/${FILE}.hpp ${SRC}/${FILE}.h || exit 1 + +############################################################################# +## fix header file name in source, fix defines +############################################################################# + +sed -e 's:\.hpp:.h:' < ${SRC}/${FILE}.cpp \ + | sed -e 's:# if YYENABLE_NLS:# if defined(YYENABLE_NLS) \&\& YYENABLE_NLS:' \ + > ${SRC}/${FILE}.cpp.tmp + +# give some information +diff -u ${SRC}/${FILE}.cpp ${SRC}/${FILE}.cpp.tmp + +# and move the files to the final destination +mv ${SRC}/${FILE}.cpp.tmp ${SRC}/${FILE}.cpp || exit 1 + diff --git a/config/flex-c++.sh b/config/flex-c++.sh new file mode 100755 index 0000000000..9f1920607a --- /dev/null +++ b/config/flex-c++.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +FLEX="$1" +DIR="$2" +FILE="$3" + +if test "x$FLEX" = "x" -o "x$DIR" = "x" -o "x$FILE" = "x" -o ! -d "$DIR"; then + echo "usage: $0 " + exit 1 +fi + +if test ! -d "$DIR"; then + echo "$0: expecting '$DIR' to be a directory" + exit 1 +fi + +############################################################################# +## flex +############################################################################# + +${FLEX} -L -o${DIR}/${FILE}.cpp ${DIR}/${FILE}.ll + +############################################################################# +## sanity checks +############################################################################# + +test -f ${DIR}/${FILE}.cpp || exit 1 + +############################################################################# +## fix casts +############################################################################# + +cat ${DIR}/${FILE}.cpp \ + | sed -e 's:(yy_n_chars), (size_t) num_to_read );:(yy_n_chars), (int) num_to_read );:' \ + > ${DIR}/${FILE}.cpp.tmp + +# give some information +diff -u ${DIR}/${FILE}.cpp ${DIR}/${FILE}.cpp.tmp + +# and move the files to the final destination +mv ${DIR}/${FILE}.cpp.tmp ${DIR}/${FILE}.cpp || exit 1 diff --git a/config/flex-c.sh b/config/flex-c.sh new file mode 100755 index 0000000000..e014159d8f --- /dev/null +++ b/config/flex-c.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +FLEX="$1" +DIR="$2" +FILE="$3" + +if test "x$FLEX" = "x" -o "x$DIR" = "x" -o "x$FILE" = "x" -o ! -d "$DIR"; then + echo "usage: $0 " + exit 1 +fi + +if test ! -d "$DIR"; then + echo "$0: expecting '$DIR' to be a directory" + exit 1 +fi + +############################################################################# +## flex +############################################################################# + +${FLEX} -L -o${DIR}/${FILE}.c ${DIR}/${FILE}.l + +############################################################################# +## sanity checks +############################################################################# + +test -f ${DIR}/${FILE}.c || exit 1 + +############################################################################# +## fix casts +############################################################################# + +cat ${DIR}/${FILE}.c \ + | sed -e 's:yy_n_chars, (size_t) num_to_read );:yy_n_chars, (int) num_to_read );:' \ + | sed -e 's:extern int isatty (int );:#ifndef _WIN32\ +\0\ +#endif:' \ + > ${DIR}/${FILE}.c.tmp + +# give some information +diff -u ${DIR}/${FILE}.c ${DIR}/${FILE}.c.tmp + +# and move the files to the final destination +mv ${DIR}/${FILE}.c.tmp ${DIR}/${FILE}.c || exit 1 diff --git a/config/js2c.sh b/config/js2c.sh new file mode 100755 index 0000000000..b219b89abb --- /dev/null +++ b/config/js2c.sh @@ -0,0 +1,6 @@ +#!/bin/bash +NAME=`basename $1 .js` + +cat $1 \ + | sed -e 's:\(["\]\):\\\0:g' \ + | awk 'BEGIN {print "static string JS_'$NAME' = " } { print " \"" $$0 "\\n\"" } END { print ";"}' \ No newline at end of file