work in progress; TODO: change commit message

This commit is contained in:
Marko Budiselic
2016-12-14 10:27:41 +01:00
parent 58b9c45ff2
commit 7b3c4c270e
16 changed files with 464 additions and 16 deletions

View File

@@ -1,5 +1,7 @@
#pragma once
#include <experimental/filesystem>
#include "database/db.hpp"
#include "logging/default.hpp"
#include "query/exception/query_engine.hpp"
@@ -13,6 +15,8 @@
* -> [code_compiler] -> code_executor
*/
namespace fs = std::experimental::filesystem;
// query engine has to be aware of the Stream because Stream
// is passed to the dynamic shared library
template <typename Stream>
@@ -44,6 +48,17 @@ public:
}
}
// preload functionality
auto load(const uint64_t hash, const fs::path& path)
{
program_loader.load(hash, path);
}
auto load(const std::string& query)
{
program_loader.load(query);
}
protected:
Logger logger;

View File

@@ -20,9 +20,6 @@ public:
std::string flags;
// TODO: sync this with cmake configuration
#ifdef BARRIER
flags += " -DBARRIER";
#endif
#ifdef NDEBUG
flags += " -DNDEBUG -O2";
#endif
@@ -53,9 +50,6 @@ public:
"-I../include",
"-I../libs/fmt", // TODO: load from config
"-I../../libs/fmt", "-L./ -L../",
#ifdef BARRIER
"-lbarrier_pic",
#endif
"-lmemgraph_pic",
"-shared -fPIC" // shared library flags
);
@@ -67,6 +61,8 @@ public:
// if compilation has failed throw exception
if (compile_status == -1) {
logger.debug("FAIL: Query Code Compilation: {} -> {}", in_file,
out_file);
throw PlanCompilationException(
"Code compilation error. Generated code is not compilable or "
"compilation settings are wrong");

View File

@@ -3,6 +3,7 @@
#include <memory>
#include <string>
#include <unordered_map>
#include <experimental/filesystem>
#include "config/config.hpp"
#include "logging/default.hpp"
@@ -16,6 +17,8 @@
#include "utils/file.hpp"
#include "utils/hashing/fnv.hpp"
namespace fs = std::experimental::filesystem;
template <typename Stream>
class ProgramLoader
{
@@ -26,6 +29,16 @@ public:
ProgramLoader() : logger(logging::log->logger("PlanLoader")) {}
// TODO: decouple load(query) method
auto load(const uint64_t hash, const fs::path &path)
{
// TODO: get lib path (that same folder as path folder or from config)
// TODO: compile
// TODO: dispose the old lib
// TODO: store the compiled lib
}
auto load(const std::string &query)
{
auto preprocessed = preprocessor.preprocess(query);

View File

@@ -8,8 +8,6 @@
auto VertexAccessor::out() const
{
DbTransaction &t = this->db;
std::cout << "VA OUT" << std::endl;
std::cout << record->data.out.size() << std::endl;
return iter::make_map(iter::make_iter_ref(record->data.out),
[&](auto e) -> auto { return EdgeAccessor(*e, t); });
}

View File

@@ -6,4 +6,6 @@ class NotYetImplemented : public BasicException
{
public:
using BasicException::BasicException;
NotYetImplemented() : BasicException("") {}
};