userver: baggage::Baggage Class Reference
Loading...
Searching...
No Matches
baggage::Baggage Class Reference

#include <userver/baggage/baggage.hpp>

Detailed Description

Baggage header. Contains entries (key, value, optional<properties>).

For more details on header check the official site https://w3c.github.io/baggage/

See also
baggage::BaggageManagerComponent

Definition at line 89 of file baggage.hpp.

Public Member Functions

 Baggage (std::string header, std::unordered_set< std::string > allowed_keys)
 
 Baggage (const Baggage &) noexcept
 
 Baggage (Baggage &&) noexcept
 
std::string ToString () const
 
const std::vector< BaggageEntry > & GetEntries () const
 
bool HasEntry (const std::string &key) const
 check that header contains entry with selected key
 
const BaggageEntryGetEntry (const std::string &key) const
 find first entry with selected key
 
bool IsValidEntry (const std::string &key) const
 entry's key validation
 
void AddEntry (std::string key, std::string value, BaggageProperties properties)
 Add entry to baggage header.
 
std::unordered_set< std::string > GetAllowedKeys () const
 get baggage allowed keys
 

Protected Member Functions

std::optional< BaggageEntryTryMakeBaggageEntry (std::string_view entry)
 parsers
 

Static Protected Member Functions

static std::optional< BaggageEntryPropertyTryMakeBaggageEntryProperty (std::string_view property)
 

Member Function Documentation

◆ AddEntry()

void baggage::Baggage::AddEntry ( std::string key,
std::string value,
BaggageProperties properties )

Add entry to baggage header.

Exceptions
BaggageExceptionIf key, value or properties don't match with requirements or if allowed_keys don't contain selected key

◆ GetEntries()

const std::vector< BaggageEntry > & baggage::Baggage::GetEntries ( ) const
Returns
vector of entries

◆ GetEntry()

const BaggageEntry & baggage::Baggage::GetEntry ( const std::string & key) const

find first entry with selected key

Exceptions
BaggageExceptionIf key doesn't exist

◆ TryMakeBaggageEntry()

std::optional< BaggageEntry > baggage::Baggage::TryMakeBaggageEntry ( std::string_view entry)
protected

parsers

Returns
std::nullopt If key, value or properties don't match with requirements or if allowed_keys don't contain selected key

The documentation for this class was generated from the following file: