aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Storages/Cache/RemoteFileMetadataFactory.h
blob: 2cd46ca0682f4fc9d4a4936c739bbcbe0e6ffe4d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once
#include <Storages/Cache/IRemoteFileMetadata.h>
#include <memory>
#include <functional>
#include <unordered_map>
namespace DB
{

class RemoteFileMetadataFactory : private boost::noncopyable
{
public:
    using MetadataCreator = std::function<IRemoteFileMetadataPtr()>;

    ~RemoteFileMetadataFactory() = default;

    static RemoteFileMetadataFactory & instance();

    IRemoteFileMetadataPtr get(const String & name);

    void registerRemoteFileMatadata(const String &name, MetadataCreator creator);

protected:
    RemoteFileMetadataFactory() = default;

private:
    std::unordered_map<String, MetadataCreator> remote_file_metadatas;
};

}