| 129 | } |
| 130 | |
| 131 | bool |
| 132 | OperatorSetConfig::exec(const Resources &res) const |
| 133 | { |
| 134 | if (TS_CONFIG_NULL != _key) { |
| 135 | switch (_type) { |
| 136 | case TS_RECORDDATATYPE_INT: |
| 137 | if (TS_SUCCESS == TSHttpTxnConfigIntSet(res.state.txnp, _key, _value.get_int_value())) { |
| 138 | Dbg(pi_dbg_ctl, "OperatorSetConfig::exec() invoked on %s=%d", _config.c_str(), _value.get_int_value()); |
| 139 | } else { |
| 140 | Dbg(pi_dbg_ctl, "OperatorSetConfig::exec() invocation failed on %s=%d", _config.c_str(), _value.get_int_value()); |
| 141 | } |
| 142 | break; |
| 143 | case TS_RECORDDATATYPE_FLOAT: |
| 144 | if (TS_SUCCESS == TSHttpTxnConfigFloatSet(res.state.txnp, _key, _value.get_float_value())) { |
| 145 | Dbg(pi_dbg_ctl, "OperatorSetConfig::exec() invoked on %s=%f", _config.c_str(), _value.get_float_value()); |
| 146 | } else { |
| 147 | Dbg(pi_dbg_ctl, "OperatorSetConfig::exec() invocation failed on %s=%f", _config.c_str(), _value.get_float_value()); |
| 148 | } |
| 149 | break; |
| 150 | case TS_RECORDDATATYPE_STRING: |
| 151 | if (TS_SUCCESS == TSHttpTxnConfigStringSet(res.state.txnp, _key, _value.get_value().c_str(), _value.size())) { |
| 152 | Dbg(pi_dbg_ctl, "OperatorSetConfig::exec() invoked on %s=%s", _config.c_str(), _value.get_value().c_str()); |
| 153 | } else { |
| 154 | Dbg(pi_dbg_ctl, "OperatorSetConfig::exec() invocation failed on %s=%s", _config.c_str(), _value.get_value().c_str()); |
| 155 | } |
| 156 | break; |
| 157 | default: |
| 158 | TSError("[%s] unknown data type, whut?", PLUGIN_NAME); |
| 159 | break; |
| 160 | } |
| 161 | } |
| 162 | return true; |
| 163 | } |
| 164 | |
| 165 | // OperatorSetStatus |
| 166 | void |
no test coverage detected