27 #ifndef Common_ClusterDefinition_ClusterDefinition_h
28 #define Common_ClusterDefinition_ClusterDefinition_h
33 #include <unordered_map>
66 std::vector<std::string> &members,
67 int64_t *generation =
nullptr);
80 void add_role(
const std::string &text);
92 std::unordered_map<std::string, std::vector<std::string>>
m_roles;
100 #endif // Common_ClusterDefinition_ClusterDefinition_h
void add_role(const std::string &text)
Parses a role definition statement Parses the role definition statement contained in text and adds th...
void load_file()
Load cluster definition from file Loads the cluster definition from the file m_fname, if the file was modified since the last time it was loaded.
Represents a cluster definition.
void get_role_members(const std::string &role, std::vector< std::string > &members, int64_t *generation=nullptr)
Get list of members of a role This method first refreshes its view of the cluster definition by reloa...
std::string m_fname
Name of cluster definition file.
time_t m_last_mtime
Last modification time of cluster definition file.
ClusterDefinition(const std::string &fname)
Constructor.
std::unordered_map< std::string, std::vector< std::string > > m_roles
Map from role names to members.
std::mutex m_mutex
Mutex for serializing access to members.