Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
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
30
31
32
33
34
35
36
37
38
39
40
#ifndef DGRIDD_CONFIG_H
#define DGRIDD_CONFIG_H
 
#include <string>
#include "dgrid.h"
 
#define DEFAULT_CONFIG_FILE "/etc/dgridd.conf"
 
namespace DGrid {
 
using std::string;
 
class Config {
private:
    Config();
    ~Config();
    static Config* _instance;
    static NodeID  _node_id;
 
public:
    static Config* instance();
    static void destroy_instance();
    static NodeID node_id();
    bool load(const std::string& fname);
 
    std::string get_cluster_key() const;
    std::string get(const std::string& key, const std::string& default_value = "") const;
    uint16_t get(const std::string& key, const uint16_t value) const;
    const std::vector<stringmap>& getnodes() const;
 
private:
    void clear();
 
    stringmap common;
    std::vector<stringmap> nodes;
};
 
} // namespace DGrid
 
#endif // DGRIDD_CONFIG_H