// TODO: unify c-tors
ConnectionString::ConnectionString(ConnectionType type,
                                   const std::string& s,
                                   const std::string& setName) {
    _type = type;
    _setName = setName;
    _fillServers(s);
    _finishInit();
}
Exemple #2
0
ConnectionString::ConnectionString(const std::string& s, ConnectionType favoredMultipleType) {
    _fillServers(s);

    if (_type != INVALID) {
        // set already
    } else if (_servers.size() == 1) {
        _type = MASTER;
    } else {
        _type = favoredMultipleType;
        verify(_type == SET || _type == SYNC);
    }

    _finishInit();
}
Exemple #3
0
ConnectionString::ConnectionString(ConnectionType type,
                                   const std::string& s,
                                   const std::string& setName) {
    _type = type;
    _setName = setName;
    _fillServers(s);

    switch (_type) {
        case MASTER:
            verify(_servers.size() == 1);
            break;
        case SET:
            verify(_setName.size());
            verify(_servers.size() >= 1);  // 1 is ok since we can derive
            break;
        default:
            verify(_servers.size() > 0);
    }

    _finishInit();
}
ConnectionString::ConnectionString(const std::string& s, ConnectionType connType)
    : _type(connType) {
    _fillServers(s);
    _finishInit();
}