// Copyright 2022 Memgraph Ltd. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source // License, and you may not use this file except in compliance with the Business Source License. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by the Apache License, Version 2.0, included in the file // licenses/APL.txt. #include #include #include #include #include #include #include #include #include #include #include "query/exceptions.hpp" #include "query/frontend/opencypher/generated/MemgraphCypher.h" #include "query/frontend/opencypher/generated/MemgraphCypherLexer.h" #include "query/interpret/eval.hpp" #include "storage_service.hpp" using apache::thrift::RocketRoutingHandler; using apache::thrift::ThriftServer; using apache::thrift::ThriftServerAsyncProcessorFactory; using manual::storage::StorageServiceHandler; std::unique_ptr createRoutingHandler(std::shared_ptr server) { return std::make_unique(*server); } template std::shared_ptr createServer(::storage::Storage &db, int32_t port) { auto handler = std::make_shared(db); auto proc_factory = std::make_shared>(handler); auto server = std::make_shared(); server->setPort(port); server->setInterface(handler); return server; } int main(int argc, char **argv) { spdlog::set_level(spdlog::level::trace); // Main storage and execution engines initialization storage::Config db_config{ .gc = {.type = storage::Config::Gc::Type::PERIODIC, .interval = std::chrono::seconds(1000)}, .items = {.properties_on_edges = true}, .durability = {.storage_directory = "data", .recover_on_startup = false, .snapshot_wal_mode = storage::Config::Durability::SnapshotWalMode::PERIODIC_SNAPSHOT_WITH_WAL, .snapshot_interval = std::chrono::seconds(0), .snapshot_retention_count = 2, .wal_file_size_kibibytes = 20480, .wal_file_flush_every_n_tx = 1, .snapshot_on_exit = true}, .transaction = {.isolation_level = storage::IsolationLevel::SNAPSHOT_ISOLATION}}; storage::Storage db(db_config); folly::init(&argc, &argv); auto storage_server = createServer(db, 7779); std::shared_ptr threadManager( apache::thrift::concurrency::PriorityThreadManager::newPriorityThreadManager(8)); threadManager->setNamePrefix("executor"); threadManager->start(); storage_server->setThreadManager(threadManager); std::cout << "alma\n"; LOG(ERROR) << "Storage Server running on port: " << 7779; storage_server->serve(); return 0; }