Commit 91337232 authored by Giorgio Azzinnaro's avatar Giorgio Azzinnaro

config file; merged descriptor dbs as members

parent fa393bf6
......@@ -65,12 +65,12 @@ Loader::Loader(
, schemaSourceTree(std::move(schema))
, includeDb(includeSourceTree.get())
, schemaDb(schemaSourceTree.get())
, mergedSchema(&includeDb, &schemaDb)
, mergedNormalized(&includeDb, &normalizedDescriptorDb)
{
auto schemaPool = std::make_shared<DescriptorPool>(
new MergedDescriptorDatabase(&includeDb, &schemaDb), &errorCollector);
auto schemaPool = std::make_shared<DescriptorPool>(&mergedSchema, &errorCollector);
auto normalizedPool = std::make_shared<DescriptorPool>(
new MergedDescriptorDatabase(&includeDb, &normalizedDescriptorDb), &errorCollector);
auto normalizedPool = std::make_shared<DescriptorPool>(&mergedNormalized, &errorCollector);
this->pools.emplace(SCHEMA, schemaPool);
this->pools.emplace(NORMALIZED, normalizedPool);
......
......@@ -38,6 +38,7 @@ namespace format {
namespace protobuf {
// TODO Loader could populate a lookup table with the Key field and other info for any given Message
// Loader is a utility class to populate a schemaPool and normalizedPool
// which profanedb::format::protobuf::Marshaller requires
class Loader
......@@ -110,14 +111,28 @@ private:
};
BoostLogErrorCollector errorCollector;
// Loading proto files from a path is done using RootSourceTree
std::unique_ptr<RootSourceTree> includeSourceTree;
std::unique_ptr<RootSourceTree> schemaSourceTree;
// includeDb is common to both DescriptorPools (SCHEMA and NORMALIZED)
// it usually holds files such as google/protobuf/any.proto
google::protobuf::compiler::SourceTreeDescriptorDatabase includeDb;
google::protobuf::compiler::SourceTreeDescriptorDatabase schemaDb;
// schemaDb is loaded from schemaSourceTree,
// it keeps user defined schemas
google::protobuf::compiler::SourceTreeDescriptorDatabase schemaDb;
// normalizedDescriptorDb is populated during Loader initialization,
// changing nested keyable messages into references
google::protobuf::SimpleDescriptorDatabase normalizedDescriptorDb;
// MergedDescriptorDatabases put together the include path (includeDb)
// respectively with schemaDb,
// and normalizedDescriptorDb
google::protobuf::MergedDescriptorDatabase mergedSchema;
google::protobuf::MergedDescriptorDatabase mergedNormalized;
// SCHEMA and NORMALIZED pools are stored in here
// SCHEMA is the original DescriptorPool as provided by the user
// NORMALIZED holds references to nested keyable messages
......
......@@ -10,3 +10,4 @@ add_executable(profanedb_server main.cpp server.cpp config.cpp)
target_link_libraries(profanedb_server ${Boost_LIBRARIES} profanedb_format profanedb_vault profanedb_grpc)
install(TARGETS profanedb_server RUNTIME DESTINATION bin)
install(FILES server.conf DESTINATION etc/profanedb)
......@@ -55,7 +55,7 @@ Config::Config(int argc, char * argv[])
"Display this help message")
("profanedb_config_file,c",
value<path>()->default_value("/etc/profanedb.conf"),
value<path>()->default_value("/etc/profanedb/server.conf"),
"The path to ProfaneDB configuration file");
cmd.add(conf);
......@@ -109,7 +109,7 @@ const std::vector<path> Config::SchemaPath() const
const path Config::RocksPath() const
{
return this->vm["rocksdb_path"].as<path>();
return this->vm["rocksdb.path"].as<path>();
}
// TODO From file
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment