MCPcopy Create free account
hub / github.com/apache/trafficserver / _set

Method _set

src/cripts/Configs.cc:94–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94bool
95Records::_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
131bool
132Records::SetSV(const cripts::Context *context, const cripts::string_view value) const

Callers

nothing calls this directly

Calls 6

TSHttpTxnConfigIntSetFunction · 0.85
TSHttpTxnConfigFloatSetFunction · 0.85
TSErrorFunction · 0.50
c_strMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected