Line data Source code
1 : #pragma once 2 : 3 : // This component provides an interface, `DictWriter`, that represents a 4 : // write-only key/value mapping of strings. It's used when injecting trace 5 : // context into externalized formats: HTTP headers, gRPC metadata, etc. 6 : // 7 : // Note that while the data structure modeled is a mapping, duplicate keys are 8 : // permitted to result from repeated invocations of `DictWriter::set` with the 9 : // same key. 10 : 11 : #include "string_view.h" 12 : 13 : namespace datadog { 14 : namespace tracing { 15 : 16 : class DictWriter { 17 : public: 18 504 : virtual ~DictWriter() {} 19 : 20 : // Associate the specified `value` with the specified `key`. An 21 : // implementation may, but is not required to, overwrite any previous value at 22 : // `key`. 23 : virtual void set(StringView key, StringView value) = 0; 24 : }; 25 : 26 : } // namespace tracing 27 : } // namespace datadog