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

Method commit

plugins/experimental/txn_box/plugin/src/Context.cc:278–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

276}
277
278FeatureView
279Context::commit(FeatureView const &view)
280{
281 FeatureView zret{view};
282 if (view._literal_p) { // already committed.
283 } else if (view._direct_p) {
284 auto span{_arena->alloc(view.size())};
285 memcpy(span, view);
286 zret = TextView(span.rebind<char>()); // update full to be the localized copy.
287 zret._direct_p = false;
288 zret._literal_p = true;
289 } else if (auto r{_arena->remnant()}; r.contains(view.data())) {
290 // it's in transient memory, finalize it.
291 // Need to commit everything before it as well.
292 size_t n = (view.data() - r.rebind<char>().data()) + view.size();
293 _arena->alloc(n);
294 _transient = (n >= _transient ? 0 : _transient - n);
295 zret._literal_p = true;
296 } else if (_arena->contains(view.data())) { // it's already been committed, mark it so.
297 zret._literal_p = true;
298 }
299 return zret;
300}
301
302Feature &
303Context::commit(Feature &feature)

Callers 6

invokeMethod · 0.45
operator()Method · 0.45
operator()Method · 0.45
Context.ccFile · 0.45
operator()Method · 0.45
util.ccFile · 0.45

Calls 7

TextViewClass · 0.85
memcpyFunction · 0.50
allocMethod · 0.45
sizeMethod · 0.45
remnantMethod · 0.45
containsMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected