mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-18 04:12:19 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
47 lines
1.0 KiB
C++
47 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include "config_formats.h"
|
|
#if USE_PROTOBUF
|
|
|
|
#include <memory>
|
|
#include <unordered_map>
|
|
#include <Core/Types.h>
|
|
#include <boost/noncopyable.hpp>
|
|
|
|
|
|
namespace google
|
|
{
|
|
namespace protobuf
|
|
{
|
|
class Descriptor;
|
|
}
|
|
}
|
|
|
|
namespace DB
|
|
{
|
|
class FormatSchemaInfo;
|
|
|
|
/** Keeps parsed google protobuf schemas parsed from files.
|
|
* This class is used to handle the "Protobuf" input/output formats.
|
|
*/
|
|
class ProtobufSchemas : private boost::noncopyable
|
|
{
|
|
public:
|
|
static ProtobufSchemas & instance();
|
|
|
|
ProtobufSchemas();
|
|
~ProtobufSchemas();
|
|
|
|
/// Parses the format schema, then parses the corresponding proto file, and returns the descriptor of the message type.
|
|
/// The function never returns nullptr, it throws an exception if it cannot load or parse the file.
|
|
const google::protobuf::Descriptor * getMessageTypeForFormatSchema(const FormatSchemaInfo & info);
|
|
|
|
private:
|
|
class ImporterWithSourceTree;
|
|
std::unordered_map<String, std::unique_ptr<ImporterWithSourceTree>> importers;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|