Line data Source code
1 : #pragma once 2 : 3 : #include "envoy/stream_info/stream_id_provider.h" 4 : 5 : namespace Envoy { 6 : namespace StreamInfo { 7 : 8 : // Simple implementation of StreamIdProvider that returns the unique 9 : // stream ID. 10 : class StreamIdProviderImpl : public StreamIdProvider { 11 : public: 12 173 : StreamIdProviderImpl(std::string&& id) : id_(std::move(id)) {} 13 : 14 : // StreamInfo::StreamIdProvider 15 0 : absl::optional<absl::string_view> toStringView() const override { 16 0 : return absl::make_optional<absl::string_view>(id_); 17 0 : } 18 : 19 : // This is only supported for UUID format ids. 20 : absl::optional<uint64_t> toInteger() const override; 21 : 22 : private: 23 : const std::string id_; 24 : }; 25 : 26 : } // namespace StreamInfo 27 : } // namespace Envoy