| 92 | } |
| 93 | |
| 94 | bool |
| 95 | Records::_set(const cripts::Context *context, const ValueType &value) const |
| 96 | { |
| 97 | TSAssert(context->state.txnp); |
| 98 | |
| 99 | switch (_type) { |
| 100 | case TS_RECORDDATATYPE_INT: { |
| 101 | TSMgmtInt i = std::get<TSMgmtInt>(value); |
| 102 | |
| 103 | if (TSHttpTxnConfigIntSet(context->state.txnp, _key, i) != TS_SUCCESS) { |
| 104 | TSError("Failed to set integer configuration '%s'", _name.c_str()); |
| 105 | return false; |
| 106 | } |
| 107 | CDebug("Set integer configuration '{}' to {}", _name.c_str(), i); |
| 108 | } break; |
| 109 | case TS_RECORDDATATYPE_FLOAT: { |
| 110 | TSMgmtFloat f = std::get<TSMgmtFloat>(value); |
| 111 | |
| 112 | if (TSHttpTxnConfigFloatSet(context->state.txnp, _key, f) != TS_SUCCESS) { |
| 113 | TSError("Failed to set float configuration '%s'", _name.c_str()); |
| 114 | return false; |
| 115 | } |
| 116 | CDebug("Set float configuration '{}' to {}", _name.c_str(), f); |
| 117 | } break; |
| 118 | case TS_RECORDDATATYPE_STRING: { |
| 119 | auto &str = std::get<std::string>(value); |
| 120 | |
| 121 | SetSV(context, {str.data(), str.size()}); |
| 122 | } break; |
| 123 | default: |
| 124 | CFatal("[Records]: Invalid configuration type"); |
| 125 | return false; |
| 126 | } |
| 127 | |
| 128 | return true; // Success |
| 129 | } |
| 130 | |
| 131 | bool |
| 132 | Records::SetSV(const cripts::Context *context, const cripts::string_view value) const |
nothing calls this directly
no test coverage detected